Repository navigation
Expand file tree
/
Copy pathAsciiDoctor.rb
More file actions
1053 lines (925 loc) · 30.5 KB
/
Copy pathAsciiDoctor.rb
File metadata and controls
1053 lines (925 loc) · 30.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cheatsheet do
title 'AsciiDoctor'
docset_file_name 'AsciiDoctor'
keyword 'adoc'
source_url 'https://github.com/holyjak/dash-asciidoc-cheatsheet'
# resources 'resources_dir' # An optional resources folder which can contain images or anything else
style '
div.name p {font-weight: bold}
.title {
font-size: 1.1em;
margin-bottom: 0.5em;
color: #527bbd;
font-weight: 400;
}
.admon td:nth-child(1) { width: 6em; }
.underline {text-decoration: underline}
.line-through {text-decoration: line-through}
.exampleblock > .content {
background: #fffef7;
border: 1px solid #e0e0dc;
box-shadow: 0 1px 4px #e0e0dc;
padding: 0.75em;
border-radius: 4px;
}
'
introduction '<p>An opinionated AsciiDoctor cheat sheet for authoring HTML, by
<a onclick="window.dash.openExternal_(this.href); return false;" href="https://holyjak.cz">Jakub Holý</a></p>'
category do
id 'Structure'
entry do
name 'Document header'
html_notes <<-'HTMLEND'
<div class="literalblock">
<div class="content">
<pre>= Main Header <b class="conum">(1)</b>
Jakub Holý <holyjak@example.com> <b class="conum">(2)</b>
v1.2.3, 2021-09-29: my optional revision remark <b class="conum">(3)</b>
:author: Jakub Holý <b class="conum">(4)</b>
:email: <holyjak@example.com> <b class="conum">(5)</b>
:revnumber: 1.2.3 <b class="conum">(6)</b>
:revdate: 2021-09-29 <b class="conum">(7)</b>
:revremark: my optional revision remark <b class="conum">(8)</b>
<b class="conum">(9)</b></pre>
</div>
</div>
<div class="colist arabic">
<ol>
<li>
<p>Optional document title</p>
</li>
<li>
<p>Optional author line</p>
</li>
<li>
<p>Optional revision info (version, date, remark - each optional); can <em>only</em> be used if there is an author line. See <a href="https://docs.asciidoctor.org/asciidoc/latest/document/revision-information/">revision Information</a></p>
</li>
<li>
<p>An alternative way to set the optional author name; see <a href="https://docs.asciidoctor.org/asciidoc/latest/document/author-information/">author info</a> docs</p>
</li>
<li>
<p>An alternative way to set the optional author email</p>
</li>
<li>
<p>An alternative way to set the optional revision number (no 'v' prefix)</p>
</li>
<li>
<p>An alternative way to set the optional revision date</p>
</li>
<li>
<p>An alternative way to set the optional revision remark</p>
</li>
<li>
<p>Blank line that ends the document header</p>
</li>
</ol>
</div>
HTMLEND
end
end
category do
id 'Attributes'
entry do
name 'Document attributes'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p>Configure and turn on/off built-in features, built-in asset locations, set "variables" for reuse elsewhere in the document. See <a href="https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes/#what-does-defining-a-document-attribute-mean">rules for values</a>.</p>
</div>
<div class="paragraph">
<p>Most document attributes are set right under the main header / document title, some can be (re)set anywhere (e.g. <code>sectnums</code>):</p>
</div>
<div class="literalblock">
<div class="content">
<pre>= Document Title
:sectnums: // turn on a boolean attr
:!sectnums: // turn it off
:imagesdir: ./my/img/subdir/ // built-in attr. with a value
:my-homepage: https://holyjak.cz // a custom attribute
A reference to an attribute such as link:{my-homepage}[my www]
will be replaced with the value automatically.</pre>
</div>
</div>
<div class="paragraph">
<p>See <a href="https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-ref/">Document Attributes Reference</a> for a full list.</p>
</div>
HTMLEND
end
entry do
name 'Element attributes'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p>Override the built-in settings of blocks, macros, or inline elements and add custom settings (e.g. id, CSS classes) by using attribute lists. Attributes are <em>comma-separated</em> and can be <em>positional</em> (come first) and/or <em>named</em>:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>image:path[Image alt text,200,150]
image:path["Image alt text",height=150,width=200]</pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>Values can be enclosed in double <code>"</code> or single <code>'</code> <em>quotes</em>; only inside <code>'…'</code> do normal substitutions (basic formatting etc.) apply</p>
</li>
<li>
<p>Document <em>attribute references</em> such as <code>{some-attr}</code> are replaced with their values</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For <em>blocks</em> and block elements, put the attributes on the preceding line:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>[square]
* one
* two</pre>
</div>
</div>
HTMLEND
end
end
category do
id 'Section Titles'
entry do
name 'Section Titles'
command 'sectnumlevels'
command 'sectnums'
command 'discrete'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p>Mark titles with <code>=</code>:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>= Document title (h1)
== Level 1 (h2)
...
====== Level 5 (h6)</pre>
</div>
</div>
<div class="paragraph">
<p>To auto-number sections, turn on <a id="sectnumlevels"></a><a id="sectnums"></a><code>sectnums</code>:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>:sectnums:
:sectnumlevels: 2 <b class="conum">(1)</b>
== Numbered section
:!sectnums:
== Unnumbered again</pre>
</div>
</div>
<div class="colist arabic">
<ol>
<li>
<p>Number section headings at levels 1 and 2. Optional, default: levels 1-3</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>To use a heading where sections are not allowed (e.g. inside a block), set the <a id="discrete"></a><code>[discrete]</code> attribute.</p>
</div>
HTMLEND
end
end
category do
id 'Paragraphs'
entry do
name 'Paragraphs'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p></p><table><tbody><tr style="vertical-align:top"><td><p></p>
<div class="literalblock">
<div class="title">Paragraphs' source</div>
<div class="content">
<pre>.Optional Title
Just text. Line breaks
ignored. but can be forced +
with a plus.
Another paragraph.
A literal paragraph is indented</pre>
</div>
</div>
<div class="paragraph">
<p></p></div></td><td><p></p>
<div class="openblock">
<div class="title">Paragraphs rendered</div>
<div class="content">
<div class="paragraph">
<div class="title">Optional Title</div>
<p>Just text. Line breaks
ignored. but can be forced<br>
with a plus.</p>
</div>
<div class="paragraph">
<p>Another paragraph.</p>
</div>
<div class="literalblock">
<div class="content">
<pre>A literal paragraph is indented</pre>
</div>
</div>
</div>
</div>
<div class="paragraph">
<p></p></div></td></tr></tbody></table><p></p>
</div>
<div class="paragraph">
<p>To pass inline text through unchanged to HTML, wrap with three <code>+</code>:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>+++<div id=x>+++</pre>
</div>
</div>
HTMLEND
end
entry do
name 'Assign id and CSS class(es) (a.k.a. roles) to inline text'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p>Roles = CSS classes can be assigned similarly as ID,
see <a href="#//dash_ref/Category/Links+and+anchors">Links and anchors</a> below.<br>
Ex.: <code>[.class.another]#some text#</code>.</p>
</div>
HTMLEND
end
end
category do
id 'Text Formatting'
entry do
name 'Text Formatting'
command 'apostrophes'
command 'quotes'
command 'superscript'
command 'line-through'
command 'monospace'
command 'italic'
command 'subscript'
command 'highlight'
command 'bold'
command 'underline'
command 'literal'
html_notes <<-'HTMLEND'
<table class="tableblock frame-all grid-all fit-content">
<colgroup>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="bold"></a><strong>bold</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>*bold*</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="italic"></a><em>italic</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>_italic_</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>both</em></strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>*_both_*</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="monospace"></a><code>mon<strong>os</strong>pace</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>`mon**os**pace`</code> - formatting applies</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="literal"></a><code>li**t**eral monospace</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">`+li**t**eral+` - add <code>+</code> to suppress formatting etc.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>b</strong>ol<em>d</em> c<code>od</code>e</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">double to stop mid-word: <code>**b**ol__d__ c``od``e</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="highlight"></a><mark>highlight</mark></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>#highlight#</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="underline"></a><span class="underline">underline</span></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>[.underline]#underline#</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="line-through"></a><span class="line-through">line-through</span></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>[.line-through]#line-through#</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><span class="my-class">txt</span></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">assign arbitrary css class: <code>[.my-class]#txt#</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="superscript"></a><sup>super</sup>script</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>^super^script</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="subscript"></a><sub>sub</sub>script</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>~sub~script</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="quotes"></a>“double curved quotes”</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">"`double curved quotes`"</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">‘single curved quotes’</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">'`single curved quotes`'</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="apostrophes"></a>apostrophes’ vs x'</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">apostrophes`' vs x'</p></td>
</tr>
</tbody>
</table>
HTMLEND
end
end
category do
id 'Blocks and admonitions'
entry do
name 'Admonitions'
command 'TIP'
command 'WARNING'
command 'NOTE'
command 'IMPORTANT'
command 'CAUTION'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p></p><table><tbody><tr style="vertical-align:top"><td><p></p>
<div class="literalblock">
<div class="title">Admonitions' source</div>
<div class="content">
<pre>NOTE: An admonition *paragraph* draws
attention to auxiliary information.
[NOTE]
====
* An admonition *block* may contain
complex content.
====</pre>
</div>
</div>
<div class="paragraph">
<p></p></div></td><td><p></p>
<div class="openblock">
<div class="title">Admonitions rendered</div>
<div class="content">
<div class="admonitionblock note">
<table>
<tbody><tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
An admonition <strong>paragraph</strong> draws
attention to auxiliary information.
</td>
</tr>
</tbody></table>
</div>
<div class="admonitionblock note">
<table>
<tbody><tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
<div class="ulist">
<ul>
<li>
<p>An admonition <strong>block</strong> may contain
complex content.</p>
</li>
</ul>
</div>
</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<div class="paragraph">
<p></p></div></td></tr></tbody></table><p></p>
</div>
<div class="paragraph">
<p>All admonitions: <a id="NOTE"></a>NOTE, <a id="TIP"></a>TIP, <a id="IMPORTANT"></a>IMPORTANT, <a id="WARNING"></a>WARNING, <a id="CAUTION"></a>CAUTION.</p>
</div>
HTMLEND
end
entry do
name 'Blocks'
command 'passthrough'
command 'example'
command 'pass'
command 'sidebar'
command 'open_block'
command 'quote'
command 'source_code'
command 'role'
command 'id'
command 'opts'
command 'options'
html_notes <<-'HTMLEND'
<div class="literalblock">
<div class="title">General structure of a block:</div>
<div class="content">
<pre>.Optional title
[optional attributes]
<separator (2 or 4 characters)>
<content>
<separator></pre>
</div>
</div>
<table class="tableblock frame-all grid-all fit-content">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">block type</th>
<th class="tableblock halign-left valign-top">separator, attributes, comments</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="source_code"></a>source code</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>----</code>; attributes: <code>[source,ruby]</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">source code (markdown)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="pass"></a><code>```<language> ... ```</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="sidebar"></a>sidebar</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>****</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="example"></a>example</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>====</code>; expandable<sup>1</sup>: <code>[%collapsible]</code>, closable: <code>[%collapsible%open]</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="quote"></a>quote</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>____</code>; attributes: <code>[quote, Author, Source]</code><sup>2</sup></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">quote, alternative</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">"Text in quotes", on a new line <code>-- Author, Source</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="open_block"></a>open<sup>1</sup></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>--</code> An anonymous container; can masquerade as any other by naming it: <code>[source|...]</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="passthrough"></a>passthrough</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>++++</code>, pass content unchanged; e.g. to include HTML</p></td>
</tr>
</tbody>
</table>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>The expandable example block and open block may contain other blocks</p>
</li>
<li>
<p>Wrap the quote source in <code>'</code> to enable basic AsciiDoc such as links</p>
</li>
</ol>
</div>
<div class="paragraph">
<p><strong>Common block attributes</strong>: <a id="id"></a><a href="https://docs.asciidoctor.org/asciidoc/latest/attributes/ids/#anchor"><code>id</code></a>
(or <code>#</code>), <a id="role"></a><a href="https://docs.asciidoctor.org/asciidoc/latest/attributes/role/"><code>role</code></a> (or <code>.</code>) = css class,
<a id="options"></a><a id="opts"></a><a href="https://docs.asciidoctor.org/asciidoc/latest/attributes/options/"><code>options</code></a>
(or <code>opts</code> for short or the repeatable <code>%<name></code>).
Example of all, using the shorthand forms: <code>[quote#roads.movie.class2%fakeOpt, Dr. Emmett Brown]</code>.</p>
</div>
HTMLEND
end
entry do
name 'Source code listing'
html_notes <<-'HTMLEND'
<div class="literalblock">
<div class="content">
<pre>[source]
----
clojure, SQL ; <1>
C-like // <2>
Python etc. # <3>
XML <!--4-->
# Include from a file, specific lines only (-1 = until the end):
include::filename.txt[lines=7;14..25;30..-1]
# or include regions between tags; also, un-indent:
include::lib/app.rb[tag=mytag,indent=0]
----
<1> callout
<2> callout
<3> callout
<4> callout</pre>
</div>
</div>
<div class="paragraph">
<p>When including regions by tags, mark them using line comments like these:</p>
</div>
<div class="literalblock">
<div class="content">
<pre># tag::mytag[]
...
# end::mytag[]</pre>
</div>
</div>
<div class="paragraph">
<p>See <a href="https://docs.asciidoctor.org/asciidoc/latest/directives/include-with-indent/">include-with-indent</a>, <a href="https://docs.asciidoctor.org/asciidoc/latest/directives/include-tagged-regions/">include-tagged-regions</a> and <a href="https://docs.asciidoctor.org/asciidoc/latest/directives/include-lines/">include-lines</a>.</p>
</div>
HTMLEND
end
end
category do
id 'Lists'
entry do
name 'Lists'
html_notes <<-'HTMLEND'
<div class="literalblock">
<div class="title">(Un)ordered lists source</div>
<div class="content">
<pre>* Level 1 item of an unordered list
** Level 2, ... up to 5
*** Lists can be indented. Leading whitespace isn't significant.
. Nested level 1 ordered list item
.. ordered list item 2nd level
+
====
To include complex content, unindent it and
put the list continuation sign `+` on the line
between it and the list item
====
.. but a literal paragraph does not require a list
continuation:
$ echo "it works"
.. end
[]
. To split a list into 2, put an empty line and a
block attribute line (possibly empty) before the second list</pre>
</div>
</div>
<div class="openblock">
<div class="title">(Un)ordered lists rendered</div>
<div class="content">
<div class="ulist">
<ul>
<li>
<p>Level 1 item of an unordered list</p>
<div class="ulist">
<ul>
<li>
<p>Level 2, … up to 5</p>
<div class="ulist">
<ul>
<li>
<p>Lists can be indented. Leading whitespace isn’t significant.</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Nested level 1 ordered list item</p>
<div class="olist loweralpha">
<ol class="loweralpha" type="a">
<li>
<p>ordered list item 2nd level</p>
<div class="exampleblock">
<div class="content">
<div class="paragraph">
<p>To include complex content, unindent it and
put the list continuation sign <code>+</code> on the line
between it and the list item</p>
</div>
</div>
</div>
</li>
<li>
<p>but a literal paragraph does not require a list
continuation:</p>
<div class="literalblock">
<div class="content">
<pre>$ echo "it works"</pre>
</div>
</div>
</li>
<li>
<p>end</p>
</li>
</ol>
</div>
</li>
</ol>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>To split a list into 2, put an empty line and a
block attribute line (possibly empty) before the second list</p>
</li>
</ol>
</div>
</div>
</div>
<div class="paragraph">
<p></p><table><tbody><tr style="vertical-align:top"><td><p></p>
<div class="literalblock">
<div class="title">Other list types source</div>
<div class="content">
<pre>.Checklist
* [ ] unchecked
* [x] checked
.Definition list
First term:: the definition
can be inline
Second term::
or on a new line
.Q&A is a def. list with
the `qanda` attribute
[qanda]
Question:: Answer
Another question::
Its answer</pre>
</div>
</div>
<div class="paragraph">
<p></p></div></td><td><p></p>
<div class="exampleblock">
<div class="title">Example 1. Other list types rendered</div>
<div class="content">
<div class="ulist checklist">
<div class="title">Checklist</div>
<ul class="checklist">
<li>
<p>❏ unchecked</p>
</li>
<li>
<p>✓ checked</p>
</li>
</ul>
</div>
<div class="dlist">
<div class="title">Definition list</div>
<dl>
<dt class="hdlist1">First term</dt>
<dd>
<p>the definition
can be inline</p>
</dd>
<dt class="hdlist1">Second term</dt>
<dd>
<p>or on a new line</p>
</dd>
</dl>
</div>
<div class="paragraph">
<div class="title">Q&A is a def. list with</div>
<p>the <code>qanda</code> attribute</p>
</div>
<div class="qlist qanda">
<ol>
<li>
<p><em>Question</em></p>
<p>Answer</p>
</li>
<li>
<p><em>Another question</em></p>
<p>Its answer</p>
</li>
</ol>
</div>
</div>
</div>
<div class="paragraph">
<p></p></div></td></tr></tbody></table><p></p>
</div>
HTMLEND
end
end
category do
id 'Links and anchors'
entry do
name 'Anchors'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p><strong>Block or a section</strong> heading: use a block anchor <code>[[myid]]</code> or the shorthand form <code>[#myid]</code> in the first position of the block attribute list.</p>
</div>
<div class="paragraph">
<p><strong>Inline</strong>, on quoted text using <em>either</em> formatting marks such as <code>*</code> <em>or</em> put <code>#</code> around the text:
<code>[#inline_target]#targeted# txt</code>. Or just insert an empty anchor: <code>[[empty-anchor]]not inside</code>.</p>
</div>
<div class="paragraph">
<p>Anchors can be used anywhere <a href="https://docs.asciidoctor.org/asciidoc/latest/subs/#substitution-groups">where macro substitution applies</a>.</p>
</div>
HTMLEND
end
entry do
name 'Links'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p><strong>Link to an anchor</strong> via <code><<myid>></code>, which will use the target text as the label (only works for headings), or <code><<myid,custom label>></code>. You can also link directly to a section heading using its text: <code><<Links>></code>.</p>
</div>
<table class="tableblock frame-all grid-all fit-content">
<colgroup>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Links to anchors:</strong></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code><<heading-anchor>></code>, <code><<inline_target>></code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#heading-anchor">Links</a>, <a href="#inline_target">[inline_target]</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code><<heading-anchor,my label>></code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#heading-anchor">my label</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code><<Links>></code> - heading text</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#heading-anchor">Links</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>External links:</strong></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>http://xy.z</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://xy.z" class="bare">http://xy.z</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>http://xy.z[label]</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://xy.z">label</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>link:/some/path[path only]</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="/some/path">path only</a></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Beware: Some URLs look like formatting and confuse the parser. To fix, wrap like this <code>link:++the-url++</code> or assign it to an attribute and use that.</p>
</div>
<div class="paragraph">
<p><a href="https://docs.asciidoctor.org/asciidoc/latest/macros/link-macro-ref/">Supported attributes</a>: id, role (= CSS class), title, window (or append <code>^</code> to the label for _blank), opts.</p>
</div>
HTMLEND
end
end
category do
id 'Images'
entry do
name 'Images'
command 'imagesdir'
html_notes <<-'HTMLEND'
<div class="paragraph">
<p>Block image: <code>image::<path|url>[<attributes>]</code> (prepend a <code>.block title</code> line for a caption)</p>
</div>
<div class="paragraph">
<p>Inline image: same as block image, but single <code>:</code></p>
</div>
<div class="paragraph">
<p>Positional attributes: <code>[alt, width, height]</code>. W/h are numbers in px or %: 150 or 50%.</p>
</div>
<div class="paragraph">
<p>Named attributes (<sup>1</sup> applies only to block images):</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://docs.asciidoctor.org/asciidoc/latest/macros/image-position/">Positioning</a>: align<sup>1</sup>=left|center|right, float=left|right (adds CSS style with <code>float</code>), role (built-in classes: left, right, text-left, text-right, text-center; note: <code>.role</code> shorthand not supported)</p>
</li>
<li>
<p>Add a frame: <code>role="thumb"</code> (as thumbnail)</p>
</li>
<li>
<p>link</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Note: The document attribute <a id="imagesdir"></a><code>imagesdir</code> (default: empty) is automatically prepended to all relative paths.</p>
</div>
HTMLEND
end
end
category do
id 'Tables'
entry do
name 'Tables'
command 'autowidth'
html_notes <<-'HTMLEND'
<div class="literalblock">
<div class="title">Table source</div>
<div class="content">
<pre>[cols="20,80"]
|===
| Country | City
| Norway | Oslo
| Czechia | Ostrava
| footer | after empty line
|===</pre>
</div>
</div>
<div class="exampleblock">
<div class="title">Example 2. Table rendered</div>
<div class="content">
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 80%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Country</th>
<th class="tableblock halign-left valign-top">City</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Norway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Oslo</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Czechia</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Ostrava</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">footer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">after empty line</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>Make first line header by appending an empty line</p>
</li>
<li>
<p>Options include <a id="autowidth"></a><code>%autowidth</code></p>
</li>
<li>
<p>See <a href="https://docs.asciidoctor.org/asciidoc/latest/tables/add-columns/">sizing, alignment via cols</a>, <a href="https://docs.asciidoctor.org/asciidoc/latest/tables/data-format/">CSV data</a> etc.</p>
</li>
</ul>
</div>
HTMLEND
end
end
category do
id 'Extra'
entry do
name 'Extra'