AsciiDoc 语法快速参考
| 此页面上的示例演示了内置 HTML 转换器生成的输出。Asciidoc 转换器在生成 PDF、EPUB 和 DocBook 等其他输出格式时,预期会产生互补的输出。 |
段落
Paragraphs don't require special markup in AsciiDoc.
A paragraph is defined by one or more consecutive lines of text.
Line breaks within a paragraph are not displayed.
Leave at least one empty line to begin a new paragraph.
查看 示例 1 的结果
在 AsciiDoc 中,段落不需要特殊标记。段落由一个或多个连续的文本行定义。段落内的换行符不会显示。
留出至少一个空行以开始一个新段落。
A normal paragraph.
A literal paragraph.
One or more consecutive lines indented by at least one space.
The text is shown in a fixed-width (typically monospace) font.
The lines are preformatted (i.e., as formatted in the source).
Spaces and newlines,
like the ones in this sentence,
are preserved.
查看 示例 2 的结果
一个普通段落。
A literal paragraph. One or more consecutive lines indented by at least one space.
The text is shown in a fixed-width (typically monospace) font. The lines are preformatted (i.e., as formatted in the source). Spaces and newlines, like the ones in this sentence, are preserved.
Roses are red, +
violets are blue.
[%hardbreaks]
A ruby is red.
Java is black.
查看 示例 3 的结果
玫瑰是红色的,
紫罗兰是蓝色的。
红宝石是红色的。
Java 是黑色的。
[.lead]
This text will be styled as a lead paragraph (i.e., larger font).
This paragraph will not be.
查看 示例 4 的结果
此文本将被样式化为引言段落(即,字体较大)。
此段落不会。
| 如果引言段落上没有指定角色,则默认的 Asciidoctor 样式会自动将序言的第一段样式化为引言段落。 |
文本格式化
It has *strong* significance to me.
I _cannot_ stress this enough.
Type `OK` to accept.
That *_really_* has to go.
Can't pick one? Let's use them `*_all_*`.
查看 示例 5 的结果
这对我很**重要**。
我**强调**这一点也不为过。
键入 OK 即可接受。
那**_真的_**得走了。
选不出来?我们**都**用上吧。
**C**reate, **R**ead, **U**pdate, and **D**elete (CRUD)
That's fan__freakin__tastic!
Don't pass generic ``Object``s to methods that accept ``String``s!
It was Beatle**__mania__**!
查看 示例 6 的结果
**C**reate, **R**ead, **U**pdate, and **D**elete (CRUD)
那太棒了!
不要将通用 Object 传递给接受 String 的方法!
那是一场甲壳虫**狂潮**!
Mark my words, #automation is essential#.
##Mark##up refers to text that contains formatting ##mark##s.
Where did all the [.underline]#cores# go?
We need [.line-through]#ten# twenty VMs.
A [.myrole]#custom role# must be fulfilled by the theme.
查看 示例 7 的结果
我说了,自动化是必不可少的。
标记 指的是包含格式标记的文本。
所有的内核都去哪儿了?
我们需要十个二十台虚拟机。
一个自定义角色必须由主题来满足。
^super^script
~sub~script
查看 示例 8 的结果
上标
下标
"`double curved quotes`"
'`single curved quotes`'
Olaf's desk was a mess.
A ``std::vector```'s size is the number of items it contains.
All of the werewolves`' desks were a mess.
Olaf had been with the company since the `'00s.
查看 示例 9 的结果
“双弯引号”
‘单弯引号’
奥拉夫的桌子很乱。
std::vector 的大小是它包含的项的数量。
所有的狼人的桌子都很乱。
奥拉夫自 ’00 年代起就一直在这家公司工作。
链接
https://asciidoctor.org.cn - automatic!
https://asciidoctor.org.cn[Asciidoctor]
devel@discuss.example.org
mailto:devel@discuss.example.org[Discuss]
mailto:join@discuss.example.org[Subscribe,Subscribe me,I want to join!]
查看 示例 10 的结果
https://chat.asciidoc.org[Discuss AsciiDoc,role=external,window=_blank]
https://chat.asciidoc.org[Discuss AsciiDoc^]
查看 示例 11 的结果
当目标以 https: 等 URL 方案开头时,*不*需要 link: 宏前缀。URL 方案充当隐式宏前缀。 |
| 如果链接文本包含逗号,并且文本后面跟有一个或多个命名属性,则必须将文本括在双引号中。否则,文本将在逗号处被截断(剩余文本将被拉入属性解析)。 |
link:++https://example.org/?q=[a b]++[URL with special characters]
https://example.org/?q=%5Ba%20b%5D[URL with special characters]
link:index.html[Docs]
link:\\server\share\whitepaper.pdf[Whitepaper]
[[bookmark-a]]Inline anchors make arbitrary content referenceable.
[#bookmark-b]#Inline anchors can be applied to a phrase like this one.#
anchor:bookmark-c[]Use a cross reference to link to this location.
[[bookmark-d,last paragraph]]The xreflabel attribute will be used as link text in the cross-reference link.
See <<paragraphs>> to learn how to write paragraphs.
Learn how to organize the document into <<section-titles,sections>>.
Refer to xref:document-b.adoc#section-b[Section B of Document B] for more information.
If you never return from xref:document-b.adoc[Document B], we'll send help.
文档头
文档头是可选的。它可能不包含任何空行,并且必须与内容之间至少有一个空行分隔。
= Document Title
This document provides...
= Document Title
Author Name <author@email.org>
This document provides...
= Document Title
Author Name <author@email.org>; Another Author <a.author@email.org>
v2.0, 2019-03-22
This document provides...
= Document Title
Author Name <author@email.org>
v2.0, 2019-03-22
:toc:
:homepage: https://example.org
This document provides...
节标题
当文档类型为 article(默认)时,文档只能有一个 0 级节标题(=),即文档标题(doctitle)。
= Document Title (Level 0)
== Level 1 Section Title
=== Level 2 Section Title
==== Level 3 Section Title
===== Level 4 Section Title
====== Level 5 Section Title
== Another Level 1 Section Title
查看 示例 22 的结果
文档标题(0 级)
1 级节标题
2 级节标题
3 级节标题
4 级节标题
5 级节标题
另一个 1 级节标题
book 文档类型可以有额外的 0 级节标题,这些标题被解释为部分。存在至少一个部分会隐式地将文档视为多部分书籍。
= Document Title (Level 0)
== Level 1 Section Title
= Level 0 Section Title (Part)
== Level 1 Section Title
=== Level 2 Section Title
==== Level 3 Section Title
===== Level 4 Section Title
====== Level 5 Section Title
= Another Level 0 Section Title (Part)
[discrete]
=== I'm an independent heading!
This paragraph is its sibling, not its child.
查看 示例 24 的结果
我是一个独立的标题!
这个段落是它的同级,而不是它的子级。
包含
= Reference Documentation
Lead Developer
This is documentation for project X.
include::basics.adoc[]
include::installation.adoc[]
include::example.adoc[]
include::filename.txt[tag=definition]
include::filename.txt[lines=5..10]
include::https://raw.githubusercontent.com/asciidoctor/asciidoctor/main/README.adoc[]
从 URL 包含内容可能存在危险,因此如果安全模式为 SECURE 或更高,则会禁用它。假设安全模式低于 SECURE,您还必须设置 allow-uri-read 属性以允许 AsciiDoc 处理器从 URL 读取内容。 |
列表
* List item
** Nested list item
*** Deeper nested list item
* List item
** Another nested list item
* List item
查看 示例 29 的结果
-
列表项
-
嵌套列表项
-
更深层嵌套的列表项
-
-
-
列表项
-
另一个嵌套列表项
-
-
列表项
列表前后需要一个空行才能将其与其他块分隔。您可以通过在第二个列表上方添加一个空的属性列表(即 [])或在第一个列表后插入一个空行后跟一个行注释来强制两个相邻的列表分开。如果您使用行注释,约定是使用 //- 来提示其他作者它作为列表分隔符。 |
* Level 1 list item
** Level 2 list item
*** Level 3 list item
**** Level 4 list item
***** Level 5 list item
****** etc.
* Level 1 list item
查看 示例 30 的结果
-
1 级列表项
-
2 级列表项
-
3 级列表项
-
4 级列表项
-
5 级列表项
-
等等。
-
-
-
-
-
-
1 级列表项
可以使用列表样式(例如 square)更改无序列表标记。
. Step 1
. Step 2
.. Step 2a
.. Step 2b
. Step 3
查看 示例 31 的结果
-
步骤 1
-
步骤 2
-
步骤 2a
-
步骤 2b
-
-
步骤 3
. Level 1 list item
.. Level 2 list item
... Level 3 list item
.... Level 4 list item
..... Level 5 list item
. Level 1 list item
查看 示例 32 的结果
-
1 级列表项
-
2 级列表项
-
3 级列表项
-
4 级列表项
-
5 级列表项
-
-
-
-
-
1 级列表项
有序列表支持编号样式,例如 lowergreek 和 decimal-leading-zero。
* [*] checked
* [x] also checked
* [ ] not checked
* normal list item
查看 示例 33 的结果
-
已勾选
-
也已勾选
-
未勾选
-
普通列表项
First term:: The description can be placed on the same line
as the term.
Second term::
Description of the second term.
The description can also start on its own line.
查看 示例 34 的结果
- 第一个术语
-
描述可以放在术语的同一行上。
- 第二个术语
-
第二个术语的描述。描述也可以开始在新的一行。
[qanda]
What is the answer?::
This is the answer.
Are cameras allowed?::
Are backpacks allowed?::
No.
查看 示例 35 的结果
-
答案是什么?
这就是答案。
-
允许带相机吗?
允许带背包吗?
不可以。
Operating Systems::
Linux:::
. Fedora
* Desktop
. Ubuntu
* Desktop
* Server
BSD:::
. FreeBSD
. NetBSD
Cloud Providers::
PaaS:::
. OpenShift
. CloudBees
IaaS:::
. Amazon EC2
. Rackspace
查看 示例 36 的结果
- 操作系统
-
- Linux
-
-
Fedora
-
桌面
-
-
Ubuntu
-
桌面
-
服务器
-
-
- BSD
-
-
FreeBSD
-
NetBSD
-
- 云提供商
-
- PaaS
-
-
OpenShift
-
CloudBees
-
- IaaS
-
-
Amazon EC2
-
Rackspace
-
| 列表可以缩进。前导空格不重要。 |
* Every list item has at least one paragraph of content,
which may be wrapped, even using a hanging indent.
+
Additional paragraphs or blocks are adjoined by putting
a list continuation on a line adjacent to both blocks.
+
list continuation:: a plus sign (`{plus}`) on a line by itself
* A literal paragraph does not require a list continuation.
$ cd projects/my-book
* AsciiDoc lists may contain any compound content.
+
|===
|Column 1, Header Row |Column 2, Header Row
|Column 1, Row 1
|Column 2, Row 1
|===
查看 示例 37 的结果
-
每个列表项至少有一个段落内容,可以换行,甚至可以使用悬挂缩进。
附加的段落或块通过在与两个块相邻的行上放置列表延续来连接。
- 列表延续
-
单独一行的加号 (
+)
-
字面段落不需要列表延续。
$ cd projects/my-book
-
AsciiDoc 列表可以包含任何复合内容。
第 1 列,标题行 第 2 列,标题行 第 1 列,第 1 行
第 2 列,第 1 行
图片
您可以使用imagesdir 属性来避免在每个图像宏中硬编码图像的常见路径。此属性的值可以是绝对路径、相对路径或基本 URL。如果图像目标是相对路径,则该属性的值将被预置(即,相对于 imagesdir 属性的值解析)。如果图像目标是 URL 或绝对路径,则该属性的值*不会*被预置。
image::sunset.jpg[]
image::sunset.jpg[Sunset]
.A mountain sunset
[#img-sunset,caption="Figure 1: ",link=https://www.flickr.com/photos/javh/5448336655]
image::macros:sunset.jpg[Sunset,200,100]
image::https://asciidoctor.org.cn/images/octocat.jpg[GitHub mascot]
查看 示例 38 的结果
宏中图像关键字后面的两个冒号(即 image::)表示块图像(也称为图形),而图像关键字后面的一个冒号(即 image:)表示行内图像。(所有宏都遵循此模式)。当您需要在文本行中放置图像时,可以使用行内图像。否则,您应该优先使用块形式。
Click image:play.png[] to get the party started.
Click image:pause.png[title=Pause] when you need a break.
查看 示例 39 的结果
点击
开始派对。
休息时,请点击
。
image:sunset.jpg[Sunset,150,150,role=right] What a beautiful sunset!
查看 示例 40 的结果
多么美丽的日落!
= Document Title
:data-uri:
当设置 data-uri 属性时,文档中的所有图像(包括劝告图标)都将作为数据 URI嵌入到文档中。您也可以使用 -a data-uri 作为命令行参数传递它。
音频
audio::ocean-waves.wav[]
audio::ocean-waves.wav[start=60,opts=autoplay]
您可以通过宏上的其他属性和选项来控制音频设置。
视频
video::video-file.mp4[]
video::video-file.mp4[width=640,start=60,opts=autoplay]
video::RvRhUHTV_8k[youtube]
video::67480300[vimeo]
您可以通过宏上的其他属性和选项来控制视频设置。
字面量和源代码
Output literal monospace text, such as `+{backtick}+` or `+https://:8080+`, by enclosing the text in a pair of pluses surrounded by a pair of backticks.
查看 示例 49 的结果
输出字面等宽文本,例如 {backtick} 或 https://:8080,方法是将文本用一对由一对反引号包围的加号括起来。
Normal line.
Indent line by one space to create a literal line.
Normal line.
查看 示例 50 的结果
普通行。
Indent line by one space to create a literal line.
普通行。
....
error: 1954 Forbidden search
absolutely fatal: operation lost in the dodecahedron of doom
Would you like to try again? y/n
....
查看 示例 51 的结果
error: 1954 Forbidden search absolutely fatal: operation lost in the dodecahedron of doom Would you like to try again? y/n
.Gemfile.lock
----
GEM
remote: https://rubygems.org.cn/
specs:
asciidoctor (2.0.15)
PLATFORMS
ruby
DEPENDENCIES
asciidoctor (~> 2.0.15)
----
查看 示例 52 的结果
GEM
remote: https://rubygems.org.cn/
specs:
asciidoctor (2.0.15)
PLATFORMS
ruby
DEPENDENCIES
asciidoctor (~> 2.0.15)
.Some Ruby code
[source,ruby]
----
require 'sinatra'
get '/hi' do
"Hello World!"
end
----
查看 示例 53 的结果
require 'sinatra'
get '/hi' do
"Hello World!"
end
|
您必须通过在文档头、CLI 或 API 中设置
请参阅语法高亮,了解使用 Asciidoctor 时接受哪些值。 |
[source,ruby]
----
require 'sinatra' // <1>
get '/hi' do // <2>
"Hello World!" // <3>
end
----
<1> Library import
<2> URL mapping
<3> HTTP response body
查看 示例 54 的结果
require 'sinatra' (1)
get '/hi' do (2)
"Hello World!" (3)
end
| 1 | 库导入 |
| 2 | URL 映射 |
| 3 | HTTP 响应正文 |
----
line of code // <1>
line of code # <2>
line of code ;; <3>
line of code <!--4-->
----
<1> A callout behind a line comment for C-style languages.
<2> A callout behind a line comment for Ruby, Python, Perl, etc.
<3> A callout behind a line comment for Clojure.
<4> A callout behind a line comment for XML or SGML languages like HTML.
查看 示例 55 的结果
line of code (1)
line of code (2)
line of code (3)
line of code (4)
| 1 | C 风格语言的行注释后的注释。 |
| 2 | Ruby、Python、Perl 等语言的行注释后的注释。 |
| 3 | Clojure 的行注释后的注释。 |
| 4 | HTML 等 XML 或 SGML 语言的行注释后的注释。 |
[,ruby]
----
include::app.rb[]
----
:sourcedir: src/main/java
[source,java]
----
include::{sourcedir}/org/asciidoctor/Asciidoctor.java[]
----
[source,ruby]
----
include::lib/app.rb[tag=main,indent=0]
----
|
当缩进为 0 时,会剥离前导块缩进。 当缩进大于 0 时,首先会剥离前导块缩进,然后块会根据此值指定的列数进行缩进。 |
[source,xml]
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
This is normal content.
查看 示例 59 的结果
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
这是普通内容。
劝告
NOTE: An admonition draws the reader's attention to auxiliary information.
Here are the other built-in admonition types:
IMPORTANT: Don't forget the children!
TIP: Look for the warp zone under the bridge.
CAUTION: Slippery when wet.
WARNING: The software you're about to use is untested.
IMPORTANT: Sign off before stepping away from your computer.
查看 示例 60 的结果
| 劝告能引起读者对辅助信息的注意。 |
这里是其他内置的劝告类型
| 别忘了孩子! |
| 在桥下寻找传送带。 |
| 潮湿时湿滑。 |
| 您即将使用的软件未经测试。 |
| 离开电脑前请签离。 |
[NOTE]
====
An admonition block may contain compound content.
.A list
- one
- two
- three
Another paragraph.
====
查看 示例 61 的结果
|
劝告块可以包含复合内容。 一个列表
另一个段落。 |
更多分隔块
任何块都可以有标题。块标题是通过在块上方开始于点的文本行定义的。该点后面不能跟空格。对于块图像,标题显示在块下方。对于所有其他块,标题通常显示在它上方。
查看 示例 62 的结果
====
Here's a sample AsciiDoc document:
----
= Title of Document
Doc Writer
:toc:
This guide provides...
----
The document header is useful, but not required.
====
查看 示例 63 的结果
这是一个示例 AsciiDoc 文档
= Title of Document
Doc Writer
:toc:
This guide provides...
文档头很有用,但不是必需的。
[quote,Abraham Lincoln,Address delivered at the dedication of the Cemetery at Gettysburg]
____
Four score and seven years ago our fathers brought forth
on this continent a new nation...
____
[quote,Albert Einstein]
A person who never made a mistake never tried anything new.
____
A person who never made a mistake never tried anything new.
____
[quote,Charles Lutwidge Dodgson,'Mathematician and author, also known as https://en.wikipedia.org/wiki/Lewis_Carroll[Lewis Carroll]']
____
If you don't know where you are going, any road will get you there.
____
"I hold it that a little rebellion now and then is a good thing,
and as necessary in the political world as storms in the physical."
-- Thomas Jefferson, Papers of Thomas Jefferson: Volume 11
查看 示例 64 的结果
四分之二年前,我们的祖先在这片大陆上建立了一个新国家……
在葛底斯堡公墓落成典礼上的演讲
一个从未犯过错误的人,从未尝试过新事物。
一个从未犯过错误的人,从未尝试过新事物。
如果你不知道你要去哪里,任何一条路都会带你到那里。
数学家和作家,又名刘易斯·卡罗尔
我认为偶尔的小规模叛乱是件好事,在政治世界中与物理世界中的风暴一样有必要。
托马斯·杰斐逊论文:第 11 卷
--
An open block can be an anonymous container,
or it can masquerade as any other block.
--
[source]
--
puts "I'm a source block!"
--
查看 示例 65 的结果
一个开放块可以是一个匿名的容器,也可以伪装成任何其他块。
puts "I'm a source block!"
++++
<p>
Content in a passthrough block is passed to the output unprocessed.
That means you can include raw HTML, like this embedded Gist:
</p>
<script src="https://gist.github.com/mojavelinux/5333524.js">
</script>
++++
查看 示例 66 的结果
直通块中的内容将未经处理地传递到输出。这意味着您可以包含原始 HTML,例如此嵌入的 Gist
:release-version: 2.4.3
[source,xml,subs=attributes+]
----
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>{release-version}</version>
</dependency>
----
查看 示例 67 的结果
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>2.4.3</version>
</dependency>
表格
.Table Title
|===
|Column 1, Header Row |Column 2, Header Row (1)
(2)
|Cell in column 1, row 1
|Cell in column 2, row 1
|Cell in column 1, row 2
|Cell in column 2, row 2
|===
| 1 | 除非指定了 cols 属性,否则列数等于第一行(非空行)的单元格分隔符数量。 |
| 2 | 当表格开头的一个非空行后紧跟着一个空行时,第一行中的单元格将被提升为表头。 |
查看 示例 68 的结果
| 第 1 列,标题行 | 第 2 列,标题行 |
|---|---|
第 1 列,第 1 行的单元格 |
第 2 列,第 1 行的单元格 |
第 1 列,第 2 行的单元格 |
第 2 列,第 2 行的单元格 |
[%header,cols=2*] (1)
|===
|Name of Column 1
|Name of Column 2
|Cell in column 1, row 1
|Cell in column 2, row 1
|Cell in column 1, row 2
|Cell in column 2, row 2
|===
| 1 | cols 属性中的 * 是重复运算符。它表示将列规范重复到剩余的列。在这种情况下,我们将默认格式重复到 2 列。当标题行中的单元格未在单行上定义时,您必须使用 cols 属性设置表格的列数以及 %header 选项(或 options=header 属性)将第一行提升为表头。 |
查看 示例 69 的结果
| 第 1 列名称 | 第 2 列名称 |
|---|---|
第 1 列,第 1 行的单元格 |
第 2 列,第 1 行的单元格 |
第 1 列,第 2 行的单元格 |
第 2 列,第 2 行的单元格 |
.Applications
[cols="1,1,2"] (1)
|===
|Name |Category |Description
|Firefox
|Browser
|Mozilla Firefox is an open source web browser.
It's designed for standards compliance,
performance, portability.
|Arquillian
|Testing
|An innovative and highly extensible testing platform.
Empowers developers to easily create real, automated tests.
|===
| 1 | 在此示例中,cols 属性有两个功能。它指定此表格有三列,并设置它们的相对宽度。 |
查看 示例 70 的结果
| 名称 | 类别 | 描述 |
|---|---|---|
Firefox |
浏览器 |
Mozilla Firefox 是一款开源网页浏览器。它专为标准合规性、性能和可移植性而设计。 |
Arquillian |
测试 |
一个创新且高度可扩展的测试平台。使开发人员能够轻松创建真实的自动化测试。 |
[cols="2,2,5a"]
|===
|Firefox
|Browser
|Mozilla Firefox is an open source web browser.
It's designed for:
* standards compliance
* performance
* portability
https://getfirefox.com[Get Firefox]!
|===
查看 示例 71 的结果
Firefox |
浏览器 |
,===
Artist,Track,Genre
Baauer,Harlem Shake,Hip Hop
,===
查看 示例 72 的结果
| 艺术家 | 曲目 | 流派 |
|---|---|---|
Baauer |
Harlem Shake |
嘻哈 |
[%header,format=csv]
|===
Artist,Track,Genre
Baauer,Harlem Shake,Hip Hop
The Lumineers,Ho Hey,Folk Rock
|===
查看 示例 73 的结果
| 艺术家 | 曲目 | 流派 |
|---|---|---|
Baauer |
Harlem Shake |
嘻哈 |
Lumineers |
Ho Hey |
民谣摇滚 |
,===
include::customers.csv[]
,===
:===
Artist:Track:Genre
Robyn:Indestructible:Dance
:===
查看 示例 75 的结果
| 艺术家 | 曲目 | 流派 |
|---|---|---|
Robyn |
Indestructible |
舞曲 |
[cols="e,m,^,>s",width="25%"]
|===
|1 >s|2 |3 |4
^|5 2.2+^.^|6 .3+<.>m|7
^|8
|9 2+>|10
|===
查看 示例 76 的结果
1 |
2 |
3 |
4 |
5 |
|
|
|
8 |
|||
9 |
|
||
ID、角色和选项
[#goals.incremental]
* Goal 1
* Goal 2
|
[id="goals",role="incremental"]
* Goal 1
* Goal 2
[#null-values]
== Primitive types and null values
[#id-name.role-name]`monospace text`
[#free-world.goals]*free the world*
[%header%footer%autowidth]
|===
|Header A |Header B
|Footer A |Footer B
|===
[options="header,footer,autowidth"]
|===
|Header A |Header B
|Footer A |Footer B
|===
// options can be shorted to opts
[opts="header,footer,autowidth"]
|===
|Header A |Header B
|Footer A |Footer B
|===
注释
// A single-line comment
////
A multi-line comment.
Notice it's a delimited block.
////
属性和替换
:url-home: https://asciidoctor.org.cn
:link-docs: https://asciidoctor.org.cn/docs[documentation]
:summary: AsciiDoc is a mature, plain-text document format for \
writing notes, articles, documentation, books, and more. \
It's also a text processor & toolchain for translating \
documents into various output formats (i.e., backends), \
including HTML, DocBook, PDF and ePub.
:checkedbox: pass:normal[{startsb}✔{endsb}]
Check out {url-home}[Asciidoctor]!
{summary}
Be sure to read the {link-docs} too!
{checkedbox} That's done!
查看 示例 86 的结果
看看Asciidoctor! AsciiDoc 是一种成熟的纯文本文档格式,用于编写笔记、文章、文档、书籍等。它也是一种文本处理器和工具链,用于将文档翻译成各种输出格式(即后端),包括 HTML、DocBook、PDF 和 ePub。 一定要阅读文档! [✔] 完成! |
要了解有关可用属性和替换组的更多信息,请参阅
.Parts{counter2:index:0}
|===
|Part Id |Description
|PX-{counter:index}
|Description of PX-{index}
|PX-{counter:index}
|Description of PX-{index}
|===
查看 示例 87 的结果
| 部件 ID | 描述 |
|---|---|
PX-1 |
PX-1 的描述 |
PX-2 |
PX-2 的描述 |
文本替换
| 名称 | 语法 | Unicode 替换 | 渲染 | 注释 |
|---|---|---|---|---|
版权 |
(C) |
© |
© |
|
注册 |
(R) |
® |
® |
|
商标 |
(TM) |
™ |
™ |
|
长破折号 |
-- |
— |
— |
仅当介于两个单词字符之间、单词字符和行边界之间,或被空格包围时才替换。 当被空格包围时(例如 |
省略号 |
... |
… |
… |
省略号后会有一个零宽空格(​)以提供断开机会。 |
单右箭头 |
-> |
→ |
→ |
|
双右箭头 |
=> |
⇒ |
⇒ |
|
单左箭头 |
<- |
← |
← |
|
双左箭头 |
<= |
⇐ |
⇐ |
|
印刷体撇号 |
Sam's |
Sam’s |
Sam’s |
打字机撇号将被替换为印刷体(也称为弯曲或智能)撇号。 |
任何命名、数字或十六进制XML 字符引用都受支持。
转义替换
In /items/\{id}, the id attribute isn't replaced.
The curly braces around it are preserved.
\*Stars* isn't displayed as bold text.
The asterisks around it are preserved.
\§ appears as an entity reference.
It's not converted into the section symbol (§).
\=> The backslash prevents the equals sign followed by a greater
than sign from combining to form a double arrow character (=>).
\[[Word]] is not interpreted as an anchor.
The double brackets around it are preserved.
[\[[Word]]] is not interpreted as a bibliography anchor.
The triple brackets around it are preserved.
\((DD AND CC) OR (DD AND EE)) is not interpreted as a flow index term.
The double brackets around it are preserved.
The URL \https://example.org isn't converted into an active link.
查看 示例 88 的结果
在 /items/{id} 中,id 属性不会被替换。它周围的花括号会被保留。
*Stars* 不会显示为粗体文本。它周围的星号会被保留。
§ 显示为实体引用。它不会转换为节符号(§)。
=> 反斜杠阻止等号后跟大于号组合成双箭头字符(⇒)。
[[Word]] 不会被解释为锚点。它周围的双括号会被保留。
[[[Word]]] 不会被解释为书目锚点。它周围的三括号会被保留。
((DD AND CC) OR (DD AND EE)) 不会被解释为流程索引词。它周围的双括号会被保留。
URL https://example.org 不会被转换为活动链接。
A word or phrase between single pluses, such as +/user/{id}+,
is not substituted.
However, the special characters like +<+ and +>+ are still
escaped in the output.
An attribute reference within a word, such as dev++{conf}++,
is not replaced.
A plus passthrough will escape standalone formatting marks,
like +``+, or formatting marks within a word, like all-natural++*++.
查看 示例 89 的结果
夹在单加号之间的单词或短语,例如 /user/{id},不会被替换。但是,像 < 和 > 这样的特殊字符仍然会在输出中被转义。
单词内的属性引用,例如 dev{conf},不会被替换。
加号直通会转义独立的格式标记,如 `,或单词内的格式标记,如 all-natural*。
+++<del>strike this</del>+++ is marked as deleted.
pass:[<del>strike this</del>] is also marked as deleted.
查看 示例 90 的结果
删除这个被标记为已删除。
删除这个也标记为已删除。
书目
_The Pragmatic Programmer_ <<pp>> should be required reading for all developers.
To learn all about design patterns, refer to the book by the "`Gang of Four`" <<gof>>.
[bibliography]
== References
* [[[pp]]] Andy Hunt & Dave Thomas. The Pragmatic Programmer:
From Journeyman to Master. Addison-Wesley. 1999.
* [[[gof,gang]]] Erich Gamma, Richard Helm, Ralph Johnson & John Vlissides.
Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. 1994.
查看 示例 91 的结果
Markdown 兼容性
Markdown 兼容语法是 AsciiDoc 语言的可选功能,目前仅在使用 Asciidoctor 时可用。
# Document Title (Level 0)
## Section Level 1
### Section Level 2
#### Section Level 3
##### Section Level 4
###### Section Level 5
查看 示例 93 的结果
文档标题(0 级)
1 级节
2 级节
3 级节
4 级节
5 级节
```ruby
require 'sinatra'
get '/hi' do
"Hello World!"
end
```
查看 示例 94 的结果
require 'sinatra'
get '/hi' do
"Hello World!"
end
> I hold it that a little rebellion now and then is a good thing,
> and as necessary in the political world as storms in the physical.
> -- Thomas Jefferson, Papers of Thomas Jefferson: Volume 11
查看 示例 95 的结果
我认为偶尔的小规模叛乱是件好事,在政治世界中与物理世界中的风暴一样有必要。
托马斯·杰斐逊论文:第 11 卷
> > What's new?
>
> I've got Markdown in my AsciiDoc!
>
> > Like what?
>
> * Blockquotes
> * Headings
> * Fenced code blocks
>
> > Is there more?
>
> Yep. AsciiDoc and Markdown share a lot of common syntax already.
查看 示例 96 的结果
有什么新鲜事?
我的 AsciiDoc 里有 Markdown 了!
什么?
引用块
标题
围栏代码块
还有更多吗?
是的。AsciiDoc 和 Markdown 已经共享了很多常用语法。
---
- - -
***
* * *