← 返回命令列表

Linux command

asciidoc 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Convert an AsciiDoc file

asciidoc [document.txt]

Convert to HTML5

asciidoc -b html5 [document.txt]

Convert to DocBook

asciidoc -b docbook [document.txt]

Generate a man page

asciidoc -b html5 -d manpage [command.1.txt]

Set document attributes

asciidoc -a toc -a icons [document.txt]

Specify output file

asciidoc -o [output.html] [document.txt]

Enable section numbering

asciidoc --section-numbers [document.txt]

说明

asciidoc converts plain text documents written in AsciiDoc markup to HTML, DocBook, and other formats. AsciiDoc is a lightweight markup language designed for writing documentation, articles, books, and man pages. The default backend is HTML (xhtml11). DocBook output can be further processed with tools like dblatex for PDF generation or xmlto for various formats. The tool reads configuration from /etc/asciidoc/ and ~/.asciidoc/. Document attributes control output features like table of contents (-a toc), embedded images (-a data-uri), icons (-a icons), and maximum width (-a max-width=55em). Attributes can also be set within the document itself. If FILE is -, input is read from standard input, enabling pipeline processing.

参数

-b _backend_, --backend=_backend_
Output format: html, html5, xhtml11, html4, docbook, docbook45, docbook5, slidy, wordpress, latex
-d _doctype_, --doctype=_doctype_
Document type: article (default), book, manpage
-o _file_, --out-file=_file_
Write output to file (default: input filename with new extension)
-a _name=value_, --attribute=_name=value_
Set a document attribute
-f _file_, --conf-file=_file_
Use additional configuration file
-n, --section-numbers
Auto-number section titles
-s, --no-header-footer
Output document body only (no HTML head/body tags)
--safe
Enable safe mode (disable potentially dangerous features)
-v, --verbose
Print processing information to stderr
--help _topic_
Print help (topics: syntax, manpage)
--version
Print version number

FAQ

What is the asciidoc command used for?

asciidoc converts plain text documents written in AsciiDoc markup to HTML, DocBook, and other formats. AsciiDoc is a lightweight markup language designed for writing documentation, articles, books, and man pages. The default backend is HTML (xhtml11). DocBook output can be further processed with tools like dblatex for PDF generation or xmlto for various formats. The tool reads configuration from /etc/asciidoc/ and ~/.asciidoc/. Document attributes control output features like table of contents (-a toc), embedded images (-a data-uri), icons (-a icons), and maximum width (-a max-width=55em). Attributes can also be set within the document itself. If FILE is -, input is read from standard input, enabling pipeline processing.

How do I run a basic asciidoc example?

Run `asciidoc [document.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b _backend_, --backend=_backend_ do in asciidoc?

Output format: html, html5, xhtml11, html4, docbook, docbook45, docbook5, slidy, wordpress, latex