[英]Convert markdown linked .md to .html
I am using marked cli to convert my markdown file to html file.我正在使用标记的 cli将我的 markdown 文件转换为 html 文件。
I want to convert hyper linked markdown file (.md) to (.html)我想将超链接的 markdown 文件 (.md) 转换为 (.html)
Current output:当前 output:
$ echo "[test](./doc/test.md)" | marked
<p><a href="./doc/test.md">test</a></p>
Expected output:预期 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.是否有任何选项可以获得所需的 output。 I can use the marked lib with JavaScript if there is an option in that.
如果有选项,我可以将标记的库与 JavaScript 一起使用。
Looking at marked documentation , there isn't any build in way of changing URLs.查看标记的文档,没有任何构建方式可以更改 URL。
I'd recommend using sed to change every .md">
to .html">
like so:我建议使用sed将每个
.md">
更改为.html">
,如下所示:
echo "[test](./doc/test.md)" | marked | sed -e 's/\.md\"\>/.html">/g'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.