- 段落
- 格式化文本
- Document Header
- Section Titles (Headings)
- 引入文件
- 水平规则和分页
- 列表
- 链接
- 图片
- 视频
- 源代码
- 更多分隔块
- 块的ID、角色和选项
- 分配块的ID和角色的传统标记方法
- 分配块的ID和角色的简写标记方法(仅Asciidoctor适用)
- Traditional markup method for assigning quoted text anchor (id) and role
- Shorthand markup method for assigning quoted text anchor (id) and role (Asciidoctor only)
- Role assigned to text enclosed in backticks
- Traditional markup method for assigning block options
- Shorthand markup method for assigning block options (Asciidoctor only)
- 注释
- 表格
- UI Macros
- Attributes and Substitutions
- 文本替换
- 转义文本
- Table of Contents (ToC)
- Bibliography
- Footnotes
- Markdown兼容
- 用户手册和帮助
AsciiDoc是一种轻量级标记语言,用于创作笔记、文章、文档、书籍、网页、幻灯片和纯文本的个人页面。本指南是用于常用的AsciiDoc文档和文本格式标记的快速参考。
Note
|
这些示例集中于通过HTML后台生成的输出。AsciiDoc produces complementary output when generating PDF, EPUB, and DocBook. 想要在遗留的AsciiDoc Python处理器上应用大多数只基于Asciidoctor的特性,可以使用Asciidoctor提供的 AsciiDoc配置文件。 |
Note
|
告诫(admonition)段落吸引读者关注辅助信息。 它的用途由段落开头的标签决定。 |
这里包含了其它内建的告诫(admonition类型:
Tip
|
小贴士…… |
Important
|
不要忘记…… |
Warning
|
小心…… |
Caution
|
确保…… |
Note
|
你也可以创建http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#admon-bl[告诫块(admonition blocks)]. |
[.lead] 这部分文本会作为lead paragraph被样式化(例如,更大的字体)。
Note
|
默认的Asciidoctor样式表会自动地将前言的第一个段落作为lead paragraph样式化。 |
参考Asciidoctor User Manual的下列章节来获取更多的信息和示例。
italic phrase
italic letters
bold phrase
bold letters
bold italic phrase
bold italic letters
monospace phrase
and lett
ers
monospace italic phrase
and lett
ers
monospace bold phrase
and lett
ers
monospace bold italic phrase
and lett
ers
Werewolves are allergic to cinnamon.
Do werewolves believe in small print?
Once upon an infinite loop.
‘single curved quotes’
“double curved quotes”
Olaf’s desk was a mess.
All of the werewolves’ desks were a mess.
Olaf had been with the company since the ’60s.
参考Asciidoctor User Manual的下列章节来获取更多的信息和示例
Important
|
header是可选的。 |
Caution
|
The header may not contain blank lines and must be offset from the content by at least one blank line. |
= My Document's Title Doc Writer <[email protected]> My document provides...
Tip
|
Asciidoctor允许作者行包含多个作者。使用分号(;)字符来分隔每个作者。 |
= My Document's Title Doc Writer <[email protected]> v1.0, 2014-01-01 My document provides...
Important
|
不能只有修订行而没有作者行。 |
= My Document's Title Doc Writer <[email protected]> v1.0, 2014-01-01 :toc: :imagesdir: assets/images :homepage: http://asciidoctor.org My document provides...
= 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
Warning
|
如果使用article doctype(默认的),你只能有一个level-0的章节(例如,文档标题),且它必须位于document header。 |
Note
|
The number of equal signs matches the heading level in the HTML output. For example, Section Level 1 becomes an <h2> heading.
|
= Document Title (Level 0) == Section Level 1 === Section Level 2 ==== Section Level 3 ===== Section Level 4 ====== Section Level 5 = Section Level 0
= Reference Documentation Lead Developer This is documentation for project X. link:basics.adoc[role=include] link:installation.adoc[role=include] link:example.adoc[role=include]
Caution
|
Asciidoctor does not insert blank lines between adjacent include statements to keep the content separated. Be sure to add a blank line in the source document to avoid unexpected results, such as a section title being swallowed. |
:asciidoctor-source: https://raw.githubusercontent.com/asciidoctor/asciidoctor/master link:{asciidoctor-source}/README.adoc[role=include]
Note
|
Including content from a URI is potentially dangerous, so it’s disabled if the safe mode is SECURE or greater. Assuming the safe mode is less than SECURE, you must also set the allow-uri-read attribute to permit Asciidoctor to read content from a URI. |
-
Edgar Allen Poe
-
Sheri S. Tepper
-
Bill Bryson
Note
|
在列表的前后都需要空行。 |
Tip
|
You can force two lists apart with a line comment, as the previous example demonstrates. The text in the comment, (^ ), is optional, but serves as a hint to other authors that this line serves as an “end of list” marker.
|
-
level 1
-
level 2
-
level 3
-
level 4
-
level 5
-
-
-
-
-
level 1
Tip
|
The unordered list marker can be changed using block styles. |
-
✓ checked
-
✓ also checked
-
❏ not checked
-
normal list item
Tip
|
Checklists can use font-based icons and be interactive. |
-
level 1
-
level 2
-
level 3
-
level 4
-
level 5
-
-
-
-
-
level 1
For ordered lists, Asciidoctor supports numeration styles such as lowergreek
and decimal-leading-zero
.
-
What is Asciidoctor?
An implementation of the AsciiDoc processor in Ruby.
-
What is the answer to the Ultimate Question?
42
- Operating Systems
-
- Linux
-
-
Fedora
-
Desktop
-
-
Ubuntu
-
Desktop
-
Server
-
-
- BSD
-
-
FreeBSD
-
NetBSD
-
- Cloud Providers
-
- PaaS
-
-
OpenShift
-
CloudBees
-
- IaaS
-
-
Amazon EC2
-
Rackspace
-
Tip
|
Lists can be indented. Leading whitespace is not significant.列表可以缩进。首部空白符是没有意义的。 |
-
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 (
+
) on a line by itself
-
A literal paragraph does not require a list continuation.
$ gem install asciidoctor
-
AsciiDoc lists may contain any complex content.
Application Language AsciiDoc
Python
Asciidoctor
Ruby
http://discuss.asciidoctor.org[Discuss Asciidoctor, role="external", window="_blank"] http://discuss.asciidoctor.org[Discuss Asciidoctor^] http://example.org["Google, Yahoo, Bing^", role="teal"]
Note
|
Links with attributes (including the subject and body segments on mailto links) are a feature unique to Asciidoctor. To enable them, you must set thelinkattrs attribute on the document. When they are enabled, you must quote the link text if it contains a comma.
|
Important
|
Images are resolved relative to the value of the imagesdir document attribute, which defaults to an empty value.imagesdir 属性可以是一个绝对路径、相对路径或基础URL。如果目标图片是一个URL或绝对路径,不会添加imagesdir前缀。
|
Tip
|
在所有的图片宏中,你应该使用imagesdir 属性来避免对图片的共享路径进行硬编码。
|
= Document Title :data-uri:
Note
|
When the data-uri attribute is set, all images in the document--including admonition icons--are embedded into the document as data URIs.
|
Tip
|
Instead of declaring the data-uri attribute in the document, you can pass it as a command-line argument using -a data-uri .
|
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual absolutely fatal: operation initiation lost in the dodecahedron of doom would you like to die again? y/n
GEM remote: https://rubygems.org/ specs: asciidoctor (0.1.4) PLATFORMS ruby DEPENDENCIES asciidoctor (~> 0.1.4)
require 'sinatra' // (1)
get '/hi' do // (2)
"Hello World!" // (3)
end
-
Library import
-
URL mapping
-
Content for response
line of code // (1) line of code # (2) line of code ;; (3)
-
A callout behind a line comment for C-style languages.
-
A callout behind a line comment for Ruby, Python, Perl, etc.
-
A callout behind a line comment for Clojure.
<title>Section Title</title> <!--(1)-->
-
The section title is required.
link:lib/document.rb[role=include]
Note
|
|
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
This is normal content.
Important
|
Enabling the syntax highlighter
Syntax highlighting is enabled by setting the :source-highlighter: pygments The valid options are |
AsciiDoc was first released in Nov 2002 by Stuart Rackham. It was designed from the start to be a shorthand syntax for producing professional documents like DocBook and LaTeX.
Note
|
所有块都可以有一个位于它上方的标题。块的标题是一个以点开始的文本行。点后面不能跟着空格。 |
Here’s a sample AsciiDoc document:
= Title of Document Doc Writer :toc: This guide provides...
The document header is useful, but not required.
Note
|
一个告诫(admonition)块可以包含复杂的内容。 A list
另一个段落。 |
Tip
|
告诫和编号图标 Asciidoctor可以使用 Font Awesome和CSS来“绘制”图标。 To use this feature, set the value of the |
Four score and seven years ago our fathers brought forth on this continent a new nation…
Address delivered at the dedication of the Cemetery at Gettysburg
A person who never made a mistake never tried anything new.
A person who never made a mistake never tried anything new.
If you don’t know where you are going, any road will get you there.
Mathematician and author, also known as Lewis Carroll
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.
Papers of Thomas Jefferson: Volume 11
"" When the President does it, that means that it’s not illegal. ""
Content in a passthrough block is passed to the output unprocessed. That means you can include raw HTML, like this embedded Gist:
An open block can be an anonymous container, or it can masquerade as any other block.
puts "I'm a source block!"
[#goals.incremental] * Goal 1 * Goal 2
Tip
|
|
[[free_the_world]][big goal]_free the world_
[#free_the_world.big.goal]_free the world_
[options="header,footer,autowidth"] |=== |Cell A |Cell B |===
.Table Title |=== |Name of Column 1 |Name of Column 2 |Name of Column 3// (1) // (2) |Cell in column 1, row 1 |Cell in column 2, row 1 |Cell in column 3, row 1 |Cell in column 1, row 2 |Cell in column 2, row 2 |Cell in column 3, row 2 |===
-
Unless the
cols
attribute is specified, the number of columns is equal to the number of vertical bars on the first non-blank line inside the block delimiters. -
When a blank line follows a single line of column titles, the column titles row will be styled as a header row by default.
[cols="2*", options="header"] // (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 |===
-
The * in the cols attribute is the repeat operator. It means repeat the column specification for the remainder of columns. In this case, it means to repeat the default formatting across 4 columns. When the header row is not defined on a single line, you must use the cols attribute to set the number of columns and options attributes to make the first row a header.
[cols="1,1,2", options="header"] // (1) .Applications |=== |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. |===
-
在这个例子中,cols属性有两个功能。它指出表格有三列,并且设置了列之间的相对宽度。
Firefox |
Browser |
Mozilla Firefox is an open-source web browser. It’s designed for:
|
Artist | Track | Genre |
---|---|---|
Baauer |
Harlem Shake |
Hip Hop |
Artist | Track | Genre |
---|---|---|
Robyn |
Indestructable |
Dance |
= AsciiDoc Writer's Guide Doc Writer <[email protected]> v1.0, 2013-08-01 :toc:
= AsciiDoc Writer's Guide Doc Writer <[email protected]> v1.0, 2014-08-01 :toc: right
Tip
|
The ToC title, levels, and positioning can be customized. |
只有使用Asciidoctor才能兼容Markdown语法。
# Document Title (Level 0) ## Section Level 1 ### Section Level 2 #### Section Level 3 ##### Section Level 4 ###### Section Level 5
```ruby 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.
Papers of Thomas Jefferson: Volume 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.
To learn more about Asciidoctor and its capabilities, check out the other Asciidoctor guides and its User Manual. Also, don’t forget to join the Asciidoctor mailing list, where you can ask questions and leave comments.