如果块与块之间的标记发生了重叠,可以简单地将外层多加几个标记,例如:

[, asciidoc]
-----
[, python]
---
print(10)
---
-----

代码块

代码块的语法如下:

[source, python] (1)
.title (2)
----
print(10)
----
  1. source 是可选的。

  2. title 是可选的

列表

列表有两种:

  • 无序列表:

    - item 1
    - item 2
  • 有序列表:

    . item 1
    . item 2

在列表中添加复杂内容:

- item
+
[, python]
----
print(1)
----

也可以只有复杂内容:

- {empty}
+
[, python]
----
print(1)
----

Admonition

asciidoc 定义了以下几种 admonition:

  • NOTE

  • TIP

  • IMPORTANT

  • CAUTION

  • WARNING

创建 admonition 有两种方式:

NOTE: xxxxx
[NOTE]
.title
====
xxxx
====

交叉引用

锚点

asciidoctor 会为文档中的以下元素自动生成锚点:

  • title

除此之外,还可以手动创建锚点:

[[bookmark-a]] Inline anchors. (1)
  1. 创建一个名为 bookmark-a 的锚点。

引用锚点

锚点的引用有以下几种方式:

  1. [#anchor_name]
  2. anchor:anchor_name[title_name]
  3. <<anchor_name>>
  4. link:anchor_name[title_name]
  5. xref:anchor_name[title_name]

上面最后都会转换为普通的 a 标签。

passthrough

passthrough 会将包裹的内容原封不动地传递到输出文件中。

inline passthrough 语法如下:

  1. pass:[content_that_need_passthrough]
  2. +content+
  3. +++content+++

inline block 语法如下:

[pass]
----
content
----
Last moify: 2022-12-04 15:11:33
Build time:2025-07-18 09:41:42
Powered By asphinx