在浏览器中 Asciidoc 文件,仅仅是编辑 Asciidoc 文件的若干方法之一。它的缺点是插入图片需要到别的地方找图床,这就很不方便。
我们都有自己熟悉的文本编辑器,或者集成开发环境(IDE)。在自己喜欢的 IDE 中,编辑 Asciidoc 文件,然后实时预览,岂不美哉?
Asciidoc 的发展史
最早,Asciidoc 是作为一种标记规范提出的,生态不丰富。直到 Dan Allen 用 Ruby 写了一个 Asciidoc 解析器,这个解析器叫做 Asciidoctor,它可以将一个 asciidoc 文档,转换成 HTML 或者 PDF 格式。
Asciidoctor is a fast, open source, Ruby-based text processor for parsing AsciiDoc® into a document model and converting it to output formats such as HTML 5, DocBook 5, manual pages, PDF, EPUB 3, and other formats.
逐渐地,围绕 Asciidoctor, Asciidoc 的生态逐渐丰富起来。
首先,当然是人们在自己的本地编辑器,写Asciidoc文档,然后用命令行,调用 Asciidoctor 将 Asciidoc 文档转化为 PDF 或者别的格式。在转化的过程中,Asciidoctor有个默认的格式模板,因此无论你输出 html 或者 pdf 都能得到一个一致的,并且排版足够优雅的文档。例如本篇文档的 html 输出结果: