464 lines
8.3 KiB
Plaintext
464 lines
8.3 KiB
Plaintext
|
---
|
||
|
title: "AsciiDoctor Syntax Test"
|
||
|
date: 2023-06-07T20:44:48+08:00
|
||
|
tags: []
|
||
|
categories: []
|
||
|
weight: 50
|
||
|
show_comments: true
|
||
|
draft: false
|
||
|
---
|
||
|
|
||
|
This article is a test for AsciiDoc syntax, and will try to use
|
||
|
as many AsciiDoc features as possible. Most content come from
|
||
|
https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#more-delimited-blocks[
|
||
|
AsciiDoc Syntax Quick Reference].
|
||
|
Now let's go.
|
||
|
|
||
|
== Paragraphs
|
||
|
|
||
|
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.
|
||
|
|
||
|
=== Literal paragraph
|
||
|
|
||
|
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.
|
||
|
|
||
|
=== Hard line break
|
||
|
|
||
|
Roses are red, +
|
||
|
violets are blue.
|
||
|
|
||
|
[%hardbreaks]
|
||
|
A ruby is red.
|
||
|
Java is black.
|
||
|
|
||
|
=== Lead paragraph
|
||
|
|
||
|
[.lead]
|
||
|
This text will be styled as a lead paragraph (i.e., larger font).
|
||
|
|
||
|
This paragraph will not be.
|
||
|
|
||
|
== Text formatting
|
||
|
|
||
|
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_*`.
|
||
|
|
||
|
|
||
|
**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__**!
|
||
|
|
||
|
|
||
|
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.
|
||
|
|
||
|
|
||
|
^super^script
|
||
|
|
||
|
~sub~script
|
||
|
|
||
|
|
||
|
"`double curved quotes`"
|
||
|
|
||
|
'`single curved quotes`'
|
||
|
|
||
|
"plain double 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.
|
||
|
|
||
|
== Links
|
||
|
|
||
|
https://asciidoctor.org - automatic!
|
||
|
|
||
|
https://asciidoctor.org[Asciidoctor]
|
||
|
|
||
|
devel@discuss.example.org
|
||
|
|
||
|
mailto:devel@discuss.example.org[Discuss]
|
||
|
|
||
|
mailto:join@discuss.example.org[Subscribe,Subscribe me,I want to join!]
|
||
|
|
||
|
|
||
|
https://chat.asciidoc.org[Discuss AsciiDoc,role=external,window=_blank]
|
||
|
|
||
|
https://chat.asciidoc.org[Discuss AsciiDoc^]
|
||
|
|
||
|
|
||
|
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.
|
||
|
|
||
|
|
||
|
== Includes
|
||
|
|
||
|
include::external.adoc[]
|
||
|
|
||
|
== Lists
|
||
|
|
||
|
* List item
|
||
|
** Nested list item
|
||
|
*** Deeper nested list item
|
||
|
* List item
|
||
|
** Another nested list item
|
||
|
* List item
|
||
|
|
||
|
|
||
|
* 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
|
||
|
|
||
|
|
||
|
. Step 1
|
||
|
. Step 2
|
||
|
.. Step 2a
|
||
|
.. Step 2b
|
||
|
. Step 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
|
||
|
|
||
|
|
||
|
* [*] checked
|
||
|
* [x] also checked
|
||
|
* [ ] not checked
|
||
|
* normal list item
|
||
|
|
||
|
|
||
|
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.
|
||
|
|
||
|
|
||
|
[qanda]
|
||
|
What is the answer?::
|
||
|
This is the answer.
|
||
|
|
||
|
Are cameras allowed?::
|
||
|
Are backpacks allowed?::
|
||
|
No.
|
||
|
|
||
|
|
||
|
Operating Systems::
|
||
|
Linux:::
|
||
|
. Fedora
|
||
|
* Desktop
|
||
|
. Ubuntu
|
||
|
* Desktop
|
||
|
* Server
|
||
|
BSD:::
|
||
|
. FreeBSD
|
||
|
. NetBSD
|
||
|
|
||
|
Cloud Providers::
|
||
|
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 complex content.
|
||
|
+
|
||
|
|===
|
||
|
|Column 1, Header Row |Column 2, Header Row
|
||
|
|
||
|
|Column 1, Row 1
|
||
|
|Column 2, Row 1
|
||
|
|===
|
||
|
|
||
|
|
||
|
== Images
|
||
|
|
||
|
image::sunset.jpg[]
|
||
|
|
||
|
image::sunset.jpg[Sunset]
|
||
|
|
||
|
.A mountain sunset
|
||
|
[#img-sunset,caption="Figure 1: ",link=/essays/asciidoctor-test/sunset.jpg]
|
||
|
image::sunset.jpg[Sunset,200,100]
|
||
|
|
||
|
image::https://asciidoctor.org/images/octocat.jpg[GitHub mascot]
|
||
|
|
||
|
image:sunset.jpg[Sunset,150,150,role=right] What a beautiful sunset!
|
||
|
|
||
|
|
||
|
== Keyboard, button, and menu macros
|
||
|
|
||
|
|===
|
||
|
|Shortcut |Purpose
|
||
|
|
||
|
|kbd:[F11]
|
||
|
|Toggle fullscreen
|
||
|
|
||
|
|kbd:[Ctrl+T]
|
||
|
|Open a new tab
|
||
|
|===
|
||
|
|
||
|
== Literals and source code
|
||
|
|
||
|
Output literal monospace text, such as `+{backtick}+` or `+http://localhost:8080+`,
|
||
|
by enclosing the text in a pair of pluses surrounded by a pair backticks. Another way
|
||
|
to monospace text is use single `backtick`.
|
||
|
|
||
|
|
||
|
Normal line.
|
||
|
|
||
|
Indent line by one space to create a literal line.
|
||
|
|
||
|
Normal line.
|
||
|
|
||
|
|
||
|
....
|
||
|
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/
|
||
|
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
|
||
|
----
|
||
|
|
||
|
|
||
|
[source,ruby]
|
||
|
----
|
||
|
require 'sinatra' // <1>
|
||
|
|
||
|
get '/hi' do // <2>
|
||
|
"Hello World!" // <3>
|
||
|
end
|
||
|
----
|
||
|
<1> Library import
|
||
|
<2> URL mapping
|
||
|
<3> HTTP response body
|
||
|
|
||
|
|
||
|
== Admonitions
|
||
|
|
||
|
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.
|
||
|
|
||
|
|
||
|
[NOTE]
|
||
|
====
|
||
|
An admonition block may contain complex content.
|
||
|
|
||
|
.A list
|
||
|
- one
|
||
|
- two
|
||
|
- three
|
||
|
|
||
|
Another paragraph.
|
||
|
====
|
||
|
|
||
|
|
||
|
== More delimited blocks
|
||
|
|
||
|
[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
|
||
|
|
||
|
|
||
|
== Tables
|
||
|
|
||
|
.Applications
|
||
|
[cols="1,1,2"]
|
||
|
|===
|
||
|
|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="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]!
|
||
|
|===
|
||
|
|
||
|
|
||
|
[cols="e,m,^,>s",width="25%"]
|
||
|
|===
|
||
|
|1 >s|2 |3 |4
|
||
|
^|5 2.2+^.^|6 .3+<.>m|7
|
||
|
^|8
|
||
|
|9 2+>|10
|
||
|
|===
|
||
|
|
||
|
== Comments
|
||
|
|
||
|
There will show no other content, because comments are not shown.
|
||
|
|
||
|
// A single-line comment
|
||
|
|
||
|
////
|
||
|
A multi-line comment.
|
||
|
|
||
|
Notice it's a delimited block.
|
||
|
////
|
||
|
|
||
|
|
||
|
== Footnotes
|
||
|
|
||
|
A statement.footnote:[Clarification about this statement.]
|
||
|
|
||
|
A bold statement!footnote:disclaimer[Opinions are my own.]
|
||
|
|
||
|
Another bold statement.footnote:disclaimer[]
|
||
|
|