如何将Markdown文档整体转换为HTML? [英] How can I convert Markdown documents to HTML en masse?

查看:441
本文介绍了如何将Markdown文档整体转换为HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Markdown中编写一些文档,并为文档的每个部分创建一个单独的文件.我希望能够一次将所有文件转换为HTML,但找不到其他尝试过相同方法的人.我在Mac上,因此我认为一个简单的bash脚本应该可以处理它,但是我从来没有在bash中做过任何事情,也没有运气.看来写点东西应该很简单,这样我就可以运行:

I'm writing some documentation in Markdown, and creating a separate file for each section of the doc. I would like to be able to convert all the files to HTML in one go, but I can't find anyone else who has tried the same thing. I'm on a Mac, so I would think a simple bash script should be able to handle it, but I've never done anything in bash and haven't had any luck. It seems like it should be simple to write something so I could just run:

markdown-batch ./*.markdown

有什么想法吗?

推荐答案

这是在Bash中执行的方法.

This is how you would do it in Bash.

for i in ./*.markdown; do perl markdown.pl --html4tags $i > $i.html; done;

当然,您需要 Markdown脚本.

这篇关于如何将Markdown文档整体转换为HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆