asciidoctor格式

格式化文本

加粗斜体等宽

加粗斜体等宽可组合叠加

例如:

_italic phrase_

__i__talic le__tt__ers

*bold phrase*

**b**old le**tt**ers

*_bold italic phrase_*

**__b__**old italic le**__tt__**ers

`monospace phrase` and le``tt``ers

`_monospace italic phrase_` and le``__tt__``ers

`*monospace bold phrase*` and le``**tt**``ers

`*_monospace bold italic phrase_*` and le``**__tt__**``ers

italic phrase

italic letters

bold phrase

bold letters

bold italic phrase

bold italic letters

monospace phrase and letters

monospace italic phrase and letters

monospace bold phrase and letters

monospace bold italic phrase and letters

高亮

Werewolves are #allergic to cinnamon#.

Werewolves are allergic to cinnamon.

字体大小

Do werewolves believe in [small]#small print#?

[big]##O##nce upon an infinite loop.

Do werewolves believe in small print?

Once upon an infinite loop.

上角下角

^super^script phrase

~sub~script phrase

superscript phrase

subscript phrase

警告

书写内容:

1
2
3
4
5
6
7
8
9
NOTE: 这是一个NOTE信息

TIP: 提示信息

IMPORTANT: 重要信息..

WARNING: 警告信息

CAUTION: 注意信息

展示结果如下:

这是一个NOTE信息
提示信息
重要信息..
警告信息
注意信息

还可添加侧边栏:

1
2
3
4
[NOTE]
====
There are things to note!
====

输出结果如下:

There are things to note!


列表

有序列表

. Step 1
. Step 2
. Step 3

结果是:

  1. Step 1

  2. Step 2

  3. Step 3

. Step 1
. Step 2
.. Step 2a
.. Step 2b
. Step 3

结果是:

  1. Step 1

  2. Step 2

    1. Step 2a

    2. Step 2b

  3. Step 3

代码块

代标注的代码块

1
2
3
public static void main( String args[] ) {
    System.out.println("Foobar!"); (1)
}
1 Print something

画图

参考地址: asciidoctor-diagram

ditaa

[ditaa]
....
                   +-------------+
                   | Asciidoctor |-------+
                   |   diagram   |       |
                   +-------------+       | PNG out
                       ^                 |
                       | ditaa in        |
                       |                 v
 +--------+   +--------+----+    /---------------\
 |        | --+ Asciidoctor +--> |               |
 |  Text  |   +-------------+    |   Beautiful   |
 |Document|   |   !magic!   |    |    Output     |
 |     {d}|   |             |    |               |
 +---+----+   +-------------+    \---------------/
     :                                   ^
     |          Lots of work             |
     +-----------------------------------+
....

效果:

                   +-------------+
                   | Asciidoctor |-------+
                   |   diagram   |       |
                   +-------------+       | PNG out
                       ^                 |
                       | ditaa in        |
                       |                 v
 +--------+   +--------+----+    /---------------\
 |        | --+ Asciidoctor +--> |               |
 |  Text  |   +-------------+    |   Beautiful   |
 |Document|   |   !magic!   |    |    Output     |
 |     {d}|   |             |    |               |
 +---+----+   +-------------+    \---------------/
     :                                   ^
     |          Lots of work             |
     +-----------------------------------+

plantuml

[plantuml, diagram-classes, png]
....
class BlockProcessor
class DiagramBlock
class DitaaBlock
class PlantUmlBlock

BlockProcessor <|-- DiagramBlock
DiagramBlock <|-- DitaaBlock
DiagramBlock <|-- PlantUmlBlock
....

效果:

class BlockProcessor
class DiagramBlock
class DitaaBlock
class PlantUmlBlock

BlockProcessor <|-- DiagramBlock
DiagramBlock <|-- DitaaBlock
DiagramBlock <|-- PlantUmlBlock

文件操作

图片

语法:

image::http://asciidoctor.org/images/octocat.jpg[GitHub mascot]

效果:

GitHub mascot

本地图片:

image::/img/test.png[alt]

效果:

alt

视频

嵌入 Vimeo 视频

语法:

video::67480300[vimeo]

效果:

文档属性

文档属性只适用asciidoc(tor)! 不兼容markdown!
  • :sectnums: 文章的标题级别使用数字表示

  • :sectanchors: 设置文章自链接

包含文件

包含文件会直接在构建后的结果文件中展示加入包含的文件内容。

include::hgf.adoc[]

从URL中链接

:asciidoctor-source: https://raw.githubusercontent.com/asciidoctor/asciidoctor/master include::{asciidoctor-source}/README.adoc[]

comments powered by Disqus