Search code examples
javascriptnode.jsmarkdownjavascript-marked

Convert markdown linked .md to .html


I am using marked cli to convert my markdown file to html file.

I want to convert hyper linked markdown file (.md) to (.html)

Current output:

$ echo "[test](./doc/test.md)" | marked
<p><a href="./doc/test.md">test</a></p>

Expected output:

$ echo "[test](./doc/test.md)" | marked --some-option
<p><a href="./doc/test.html">test</a></p>

Is there any option to get the required output. I can use the marked lib with JavaScript if there is an option in that.


Solution

  • Looking at marked documentation, there isn't any build in way of changing URLs.


    I'd recommend using to change every .md"> to .html"> like so:

    echo "[test](./doc/test.md)" | marked | sed -e 's/\.md\"\>/.html">/g'