AsciiDoc 是一种人类可读的文档格式,它可以将文档内容转换为多种输出格式,如 HTML、PDF、EPUB 等
在 Debian 或 Ubuntu 系统上,可以使用以下命令安装 AsciiDoc:
sudo apt-get install asciidoctor 在 Fedora 或 CentOS 系统上,可以使用以下命令安装 AsciiDoc:
sudo dnf install asciidoctor 使用文本编辑器(如 Vim、Nano 或 Emacs)创建一个新文件,例如 example.adoc。在文件中输入以下内容:
= AsciiDoc Example Document :toc: macro :icons: font :lang: en :doctype: book :backend: html_5 Introduction ============ This is an example document created using AsciiDoc. Table of Contents ================= [section1] [section2] Section 1 -------- This is the first section of the document. Section 2 -------- This is the second section of the document. 这个示例文档包含一个引言、一个目录(由 :toc: 指令生成)、两个章节和一个表格(由 :icons: 和 :lang: 指令自定义)。
在终端中,导航到包含 .adoc 文件的目录,然后运行以下命令:
asciidoctor example.adoc 这将生成一个名为 example.html 的 HTML 文件。你可以使用任何现代浏览器打开此文件以查看文档。
AsciiDoc 支持多种输出格式,只需将文件扩展名更改为相应的格式即可。例如,要生成 PDF 文件,将文件名更改为 example.pdf,然后在终端中运行以下命令:
asciidoctor -b pdf example.adoc 更多关于 AsciiDoc 的信息和用法,请参阅官方文档:https://asciidoctor.org/docs/