有什么方法可以将 markdown 转换为 asciidoc (或者能够生成相同的 HTML 输出)?
这是我的问题,通常我将 asciidoc 文档转换为 HTML(或更准确地说 asciidoc --> docbook --> html),但在这里我得到了一个 markdown 文档。
我希望能够从该 markdown 文档生成一个 HTML 文档,该文档看起来与来自 asciidoc 相同,或者能够以某种方式将此 markdown 转换为 asciidoc 吗?
Here is my problem, normally I convert asciidoc documents to HTML (or more precisely asciidoc --> docbook --> html) but here I've been given a markdown document.
I would like to be able to produce an HTML document from that markdown document that would look the same as if it was coming from an asciidoc OR be able to convert this markdown to asciidoc somehow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为了回应@akosma评论, pandoc 确实有 AsciiDoc 支持:
您还可以直接从 Markdown 转为 HTML:(
-S
只是为了生成漂亮的弯引号和其他智能排版变化)To echo @akosma comment, pandoc does indeed have AsciiDoc support:
You can also go directly from Markdown to HTML:
(The
-S
just to produce nice curly quotes and other Smart typographical changes)尝试使用Pandoc 将 Markdown 源转换为 docbook xml。
从那里,应该可以使用与之前用于 asciidoc 输入相同的技术将 docbook xml 转换为 html,例如,对 docbook->html 使用相同的 xslt 翻译。
Try to use Pandoc to convert the markdown source to docbook xml.
From there, it should be possible to convert the docbook xml to html with the same technique as you used before for the asciidoc input, e.g. use the same xslt-translations for docbook->html.
根据我的经验,Pandoc 无法正确转换很多文档,因此我创建了自己的转换器,可以在 这里。
它是一个用 Java 编写的简单工具,已成功用于转换许多文档,包括来自 Geb 的手册。
In my experience, Pandoc doesn't convert a lot of documents correctly, so I've created my own converter, which can be found here.
It's a simple tool written in Java which has been successfully used to convert a lot of documents, including the manual from Geb.
我会再加入一个。我为 Kramdown 编写了一个自定义转换器,可将 Markdown 转换为 AsciiDoc。
https://github.com/opendevise/kramdown-asciidoc
这个库的好处是 Kramdown非常擅长解析 GitHub 风格的 Markdown,这可能是 Markdown 人们最感兴趣的转换来源。
I'll throw another one into the mix. I've written a custom converter for Kramdown that converts Markdown to AsciiDoc.
https://github.com/opendevise/kramdown-asciidoc
The benefit of this library is that Kramdown is extremely good at parsing GitHub-flavored Markdown, which is likely the Markdown people are most interested converting from.
这是最好的pandoc解决方案:
我使用的版本是
pandoc 2.11.0.4
。This is the best pandoc solution:
The version I used is
pandoc 2.11.0.4
.