AsciiDocチートシート
1. Document Attributes
//Document Attributes
:source-highlighter: coderay
:doctype: book
:imagesdir: images
:icons: font
:experimental:
:pagenums:
:sectanchors:
:sectlinks:
:sectnums:
:toc: left
:toclevels: 3
//Document Attributes (Custum)
:disclaimer: Disclaimer…
:url-repo: https://github.com/tommylife88/asciidoc
:chapter-label:
このドキュメントのもととなるコードはMITライセンスで {url-repo}[公開します].
WARNING: {disclaimer}
2. Element Attributes
2.1. ID Attributes
内部リンクや相互参照アンカー。CSSのIDセレクタのような特定の要素にスタイルを追加するために使用する。
[[attributes-id-anchor]]
=== ID属性
内部相互参照は、<<attributes-id-anchor,このように>>記述します。
3. Document Header
= AsciiDoc Cheat sheet
//Document Header
:description: AsciiDoc Cheat sheet
:author: <Your name>
:revdate: <Date>
:revnumber: 1.0
:lang: ja
3.1. Document Types
Article (article) |
デフォルトの |
Book (book) |
|
Man page (manpage) |
UnixおよびUnixライクなマニュアルページ(manページ)を作成するために使用する。 |
Inline (inline) |
AsciiDoc フォーマットをインラインで作成する場合に使用する。 |
4. Section
DocType
によって意味が異なるが、Book
の場合。
= ドキュメントのタイトル(レベル0)
[[section-hoge-id]]//IDの付与
== セクション レベル1
=== セクション レベル2
==== セクション レベル3
===== セクション レベル4
====== セクション レベル5
== セクション レベル1
セクションアンカーとリンクは以下のドキュメント属性を定義する。
:sectanchors: //セクションアンカーアイコンを表示
:sectlinks: //セクションタイトルに自分自身へのリンクを付与
4.1. Styles
例えば、Book
ドキュメントタイプでは、次のセクションスタイルが用意されている。
-
colophon (奥付)
-
dedication (献身)
-
acknowledgments (謝辞)
-
preface (序文)
-
part (部)
-
chapter (章)
-
appendix(付録)
-
glossary(用語集)
-
bibliography(参考文献)
-
index(索引)
Colophon
The Asciidoctor Press, Ceres and Denver.
© 2020 by The Asciidoctor Press
Published in the Milky Way Galaxy.
This book is designed by Dagger Flush, Denver, Colorado. The types are handset Volcano Dust and Papaya, designed by Leeloo. Leeloo created the typefaces to soften the bluntness of documentation.
Built with Asciidoctor on Fedora 33.
Printing and binding by Ceres Lithographing, Inc., Ceres, Milky Way.
Abstract
This article will take you on a wonderful adventure of knowledge.
You’ll start with the basics. Beyond that, where you go is up to you.
Preface
I awoke one morning and was confronted by the dark and stormy eyes of the chinchilla. She had conquered the mountain of government reports that had eroded into several minor foothills and a creeping alluvial plain of loose papers.
Appendix A: Appendix
hoge
Glossary
- mud
-
wet, cold dirt
- rain
-
water falling from the sky
Bibliography
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” [gang].
5. Paragraphs
Paragraphs don't require any special markup in AsciiDoc.
A paragraph is just one or more lines of consecutive text.
To begin a new paragraph, separate it by at least one blank line from the previous paragraph or block.
5.1. Inline line break
Rubies are red, +
Topazes are blue.
5.2. Paragraph Alignment
[.text-center]
This text is centered, so it must be important.
6. Discrete Headings
****
Discrete headings are useful for making headings inside of other blocks, like this sidebar.
[discrete]
== Discrete Heading
Discrete headings can be used where sections are not permitted.
****
8. Text Formatting
8.1. Bold,Italic,Monospace
A bold *word*, and a bold *phrase of text*.
Bold c**hara**cter**s** within a word.
`*_monospace bold italic phrase_*` & ``**__char__**``acter``**__s__**``
An italic _word_, and an italic _phrase of text_.
Italic c__hara__cter__s__ within a word.
"`Wait!`" Indigo plucked a small vial from her desk's top drawer
and held it toward us.
The vial's label read: `E=mc^2^`; the `E` represents _energy_,
but also pure _genius!_
8.2. Marks, etc…
The text #marker me# is markered.
The text [.underline]#underline me# is underlined.
The text [.overline]#overline me# is overlined.
The text [.small]#small me# is smalled.
The text [.big]#big me# is big.
The text [.line-through]#line-through me# is line-through.
8.3. Subscript and Superscript
"`Well the H~2~O formula written on their whiteboard could be part
of a shopping list, but I don't think the local bodega sells
E=mc^2^,`" Lazarus replied.
8.4. Quotation Marks and Apostrophes
"`What kind of charm?`" Lazarus asked.
"`An odoriferous one or a mineral one?`"
Kizmet shrugged.
"`The note from Olaf's desk says '`wormwood and licorice,`'
but these could be normal groceries for werewolves.`"
9. Lists
.Unordered Lists
* Edgar Allan Poe
* Sheri S. Tepper
* Bill Bryson
.Ordered Lists
. Protons
. Electrons
. Neutrons
.Checklists
* [*] checked
* [x] also checked
* [ ] not checked
* normal list item
.Basic description list
CPU:: The brain of the computer.
Hard drive:: Permanent storage for operating system and/or user files.
RAM:: Temporarily stores information the CPU uses during operation.
Keyboard:: Used to enter text or control items on the screen.
Mouse:: Used to point to and select items on your computer screen.
Monitor:: Displays information in visual form using text and graphics.
.Basic description list
[horizontal]
CPU:: The brain of the computer.
Hard drive:: Permanent storage for operating system and/or user files.
RAM:: Temporarily stores information the CPU uses during operation.
Keyboard:: Used to enter text or control items on the screen.
Mouse:: Used to point to and select items on your computer screen.
Monitor:: Displays information in visual form using text and graphics.
.Question and Answer Lists
[qanda]
What is the answer?::
This is the answer.
Have you seen my duck?:: No.
.list continuation
* parent list item
.. second child list item
*** third list item
.. second child list item
*** third list item
+
paragraph attached to parent list item
10. Links
https://docs.asciidoctor.org/ - atuo link
https://docs.asciidoctor.org/[Asciidoctor]
https://github.com/asciidoctor[Asciidoctor @ *GitHub*]
//Windows形式でもOK
link:\\server\share\whitepaper.pdf[Whitepaper]
//相対パスもOK
link:downloads/report.pdf[Get Report]
//ルール指定
https://discuss.asciidoctor.org[Discuss Asciidoctor,role=resource,window=_blank]
11. Footnotes
The hail-and-rainbow protocol can be initiated at five levels:
. doublefootnote:[The double hail-and-rainbow level makes my toes tingle.]
. tertiary
. supernumerary
. supermassive
. apocalyptic
A bold statement!footnote:disclaimer[Opinions are my own.]
Another outrageous statement.footnote:disclaimer[]
12. Images
image::sunset.jpg[Sunset]
[#img-sunset]
.A mountain sunset
[link=https://www.flickr.com/photos/javh/5448336655]
image::sunset.jpg[Sunset,200,100]
You can find image:https://upload.wikimedia.org/wikipedia/commons/3/35/Tux.svg[Linux,25,35] everywhere these days.
image::sample.svg[Static,300]
13. Media
video::RvRhUHTV_8k/PLDitloyBcHOm49bxNhvGgg0f9NRZ5lSaP[youtube,width=640,height=480]
14. Icon
14.1. Icon Fonts
NOTE: NOTE
TIP: TIP
IMPORTANT: IMPORTANT
WARNING: WARNING
CAUTION: CAUTION
15. Keyboard Macro
|===
|Shortcut |Purpose
|kbd:[F11]
|Toggle fullscreen
|kbd:[Ctrl+T]
|Open a new tab
|kbd:[Ctrl+Shift+N]
|New incognito window
|kbd:[\ ]
|Used to escape characters
|kbd:[Ctrl+\]]
|Jump to keyword
|kbd:[Ctrl + +]
|Increase zoom
|===
16. UI Macro
Press the btn:[OK] button when you are finished.
Select a file in the file navigator and click btn:[Open].
To save the file, select menu:File[Save].
Select menu:View[Zoom > Reset] to reset the zoom level to the default setting.
17. Block
17.1. Example Blocks
[example]
This is an example of an example block.
.Onomatopoeia
====
The book hit the floor with a *thud*.
He could hear doves *cooing* in the pine trees`' branches.
====
17.2. Blockquotes
.After landing the cloaked Klingon bird of prey in Golden Gate park:
[quote, Captain James T. Kirk, Star Trek IV: The Voyage Home]
Everybody remember where we parked.
[quote, Monty Python and the Holy Grail]
____
Dennis: Come and see the violence inherent in the system. Help! Help! I'm being repressed!
King Arthur: Bloody peasant!
Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh? That's what I'm on about! Did you see him repressing me? You saw him, Didn't you?
____
17.3. Source Code
:source-highlighter: coderay
[source,ruby]
-----
require 'sinatra'
get '/hi' do
"Hello World!"
end
-----
17.4. Open
--
An open block can be an anonymous container,
or it can masquerade as any other block.
--
17.5. Collapsible
.Click to reveal the answer
[%collapsible]
====
This is the answer.
====
18. Tables
.表の見出し
|===
|カラム名1 |カラム名2 |カラム名3
|セル11
|セル12
|セル13
|セル21
|セル22
|セル23
|===
.セルの結合
[cols="1a,1a,1a",options="autowidth"]
|===
|1A|1B|1C
2+|「数値+」で横結合|2C
.2+|「.数値+」で縦結合|3B|3C
|4B
|* 4C
* セル内でも
* *asciidoc 書ける*
|===
.CSV
[%header,format=csv]
|===
Artist,Track,Genre
Baauer,Harlem Shake,Hip Hop
The Lumineers,Ho Hey,Folk Rock
|===
.表の属性
[cols=>1h;2d,width=50%,frame=topbot]
|===
| Attribute Name | Values
| options
| header,footer,autowidth
| cols
| colspec[;colspec;...]
| grid
| all \| cols \| rows \| none
| frame
| all \| sides \| topbot \| none
| stripes
| all \| even \| odd \| none
| width
| (0%..100%)
| format
| psv {vbar} csv {vbar} dsv
|===
19. Comments
// A single-line comment.
////
A block comment.
Notice it's a delimited block.
////
20. TOC
:toc: left
:toclevels: 3
:toc-title: 目次
21. Captions
表や図のキャプションを入れることができる。番号も自動で割り振ってくれる。
:example-caption: 例
:table-caption: 表
:figure-caption: 図
#図や表のブロックの前に ".キャプション" を付ける
.GitHub mascot
image::https://asciidoctor.org/images/octocat.jpg[GitHub mascot]
22. Includes
include::docs/subdoc.adoc[]
23. Diagram
Asciidoctor-PDF だと期待した結果にならない場合も。 |
Activity::
[plantuml,activity,svg]
-----
@startuml
start
:Hello world;
:This is defined on
several **lines**;
end
@enduml
-----
Class::
[plantuml,class,svg]
-----
@startuml
class Foo {
+ field1
+ field2
}
class Bar {
+ field3
+ field4
}
Foo::field1 --> Bar::field3 : foo
Foo::field2 --> Bar::field4 : bar
@enduml
-----
Sequence::
[plantuml,sequence,svg]
-----
include::sequence.pu[]
-----
State::
[plantuml,state,svg]
-----
include::state.pu[]
-----
Use Case::
[plantuml,usecase,svg]
-----
include::usecase.pu[]
-----