asciidoctor-pdf 1.5.0.beta.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +277 -2
  3. data/LICENSE.adoc +1 -1
  4. data/NOTICE.adoc +1 -1
  5. data/README.adoc +486 -292
  6. data/asciidoctor-pdf.gemspec +12 -11
  7. data/bin/asciidoctor-pdf +2 -6
  8. data/bin/asciidoctor-pdf-optimize +20 -0
  9. data/data/fonts/ABOUT-mplus1mn-subset +26 -0
  10. data/data/fonts/ABOUT-mplus1p-subset +26 -0
  11. data/data/fonts/ABOUT-notoemoji-subset +3 -0
  12. data/data/fonts/ABOUT-notoserif-subset +26 -0
  13. data/data/fonts/{LICENSE-mplus-testflight-58 → LICENSE-mplus} +2 -2
  14. data/data/fonts/{LICENSE-noto-2015-06-05 → LICENSE-notoserif} +0 -0
  15. data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
  16. data/data/fonts/mplus1mn-bold-subset.ttf +0 -0
  17. data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
  18. data/data/fonts/mplus1mn-bold_italic-subset.ttf +0 -0
  19. data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
  20. data/data/fonts/mplus1mn-italic-subset.ttf +0 -0
  21. data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
  22. data/data/fonts/mplus1mn-regular-subset.ttf +0 -0
  23. data/data/fonts/mplus1p-regular-fallback.ttf +0 -0
  24. data/data/fonts/notoemoji-subset.ttf +0 -0
  25. data/data/fonts/notoserif-bold-subset.ttf +0 -0
  26. data/data/fonts/notoserif-bold_italic-subset.ttf +0 -0
  27. data/data/fonts/notoserif-italic-subset.ttf +0 -0
  28. data/data/fonts/notoserif-regular-subset.ttf +0 -0
  29. data/data/themes/base-theme.yml +22 -4
  30. data/data/themes/default-theme.yml +59 -29
  31. data/data/themes/default-with-fallback-font-theme.yml +4 -17
  32. data/docs/theming-guide.adoc +1647 -167
  33. data/lib/asciidoctor/pdf/converter.rb +4489 -0
  34. data/lib/{asciidoctor-pdf/asciidoctor_ext → asciidoctor/pdf/ext/asciidoctor}/abstract_block.rb +2 -0
  35. data/lib/asciidoctor/pdf/ext/asciidoctor/abstract_node.rb +7 -0
  36. data/lib/{asciidoctor-pdf/asciidoctor_ext → asciidoctor/pdf/ext/asciidoctor}/document.rb +2 -0
  37. data/lib/asciidoctor/pdf/ext/asciidoctor/image.rb +35 -0
  38. data/lib/{asciidoctor-pdf/asciidoctor_ext → asciidoctor/pdf/ext/asciidoctor}/list.rb +4 -2
  39. data/lib/{asciidoctor-pdf/asciidoctor_ext → asciidoctor/pdf/ext/asciidoctor}/list_item.rb +3 -1
  40. data/lib/asciidoctor/pdf/ext/asciidoctor/logging_shim.rb +33 -0
  41. data/lib/{asciidoctor-pdf/asciidoctor_ext → asciidoctor/pdf/ext/asciidoctor}/section.rb +9 -6
  42. data/lib/asciidoctor/pdf/ext/asciidoctor.rb +11 -0
  43. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/array.rb +6 -0
  44. data/lib/asciidoctor/pdf/ext/core/file.rb +9 -0
  45. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/hash.rb +2 -0
  46. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/numeric.rb +5 -3
  47. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/object.rb +3 -1
  48. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/quantifiable_stdout.rb +9 -1
  49. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/regexp.rb +2 -0
  50. data/lib/{asciidoctor-pdf/core_ext → asciidoctor/pdf/ext/core}/string.rb +9 -13
  51. data/lib/asciidoctor/pdf/ext/core.rb +10 -0
  52. data/lib/asciidoctor/pdf/ext/pdf-core/page.rb +54 -0
  53. data/lib/asciidoctor/pdf/ext/pdf-core/pdf_object.rb +8 -0
  54. data/lib/asciidoctor/pdf/ext/pdf-core.rb +4 -0
  55. data/lib/asciidoctor/pdf/ext/prawn/coderay_encoder.rb +117 -0
  56. data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +922 -0
  57. data/lib/{asciidoctor-pdf/prawn_ext → asciidoctor/pdf/ext/prawn}/font/afm.rb +14 -10
  58. data/lib/asciidoctor/pdf/ext/prawn/font_metric_cache.rb +9 -0
  59. data/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb +66 -0
  60. data/lib/{asciidoctor-pdf/prawn_ext → asciidoctor/pdf/ext/prawn}/formatted_text/fragment.rb +16 -12
  61. data/lib/asciidoctor/pdf/ext/prawn/images.rb +54 -0
  62. data/lib/asciidoctor/pdf/ext/prawn-svg/interface.rb +14 -0
  63. data/lib/{asciidoctor-pdf/prawn-svg_ext.rb → asciidoctor/pdf/ext/prawn-svg.rb} +3 -1
  64. data/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb +76 -0
  65. data/lib/{asciidoctor-pdf/prawn-table_ext → asciidoctor/pdf/ext/prawn-table}/cell/text.rb +6 -3
  66. data/lib/{asciidoctor-pdf/prawn-table_ext → asciidoctor/pdf/ext/prawn-table}/cell.rb +10 -10
  67. data/lib/asciidoctor/pdf/ext/prawn-table.rb +6 -0
  68. data/lib/{asciidoctor-pdf/prawn-templates_ext.rb → asciidoctor/pdf/ext/prawn-templates.rb} +2 -0
  69. data/lib/asciidoctor/pdf/ext/prawn.rb +9 -0
  70. data/lib/asciidoctor/pdf/ext/pygments.rb +34 -0
  71. data/lib/asciidoctor/pdf/ext/rouge/formatters/prawn.rb +208 -0
  72. data/lib/{asciidoctor-pdf/rouge_ext → asciidoctor/pdf/ext/rouge}/themes/asciidoctor_pdf_default.rb +2 -0
  73. data/lib/asciidoctor/pdf/ext/rouge.rb +5 -0
  74. data/lib/asciidoctor/pdf/ext.rb +9 -0
  75. data/lib/asciidoctor/pdf/formatted_text/formatter.rb +43 -0
  76. data/lib/asciidoctor/pdf/formatted_text/fragment_position_renderer.rb +14 -0
  77. data/lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb +21 -0
  78. data/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb +134 -0
  79. data/lib/asciidoctor/pdf/formatted_text/inline_image_renderer.rb +51 -0
  80. data/lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb +22 -0
  81. data/lib/{asciidoctor-pdf → asciidoctor/pdf}/formatted_text/parser.rb +31 -7
  82. data/lib/{asciidoctor-pdf → asciidoctor/pdf}/formatted_text/parser.treetop +3 -4
  83. data/lib/asciidoctor/pdf/formatted_text/source_wrap.rb +43 -0
  84. data/lib/asciidoctor/pdf/formatted_text/text_background_and_border_renderer.rb +55 -0
  85. data/lib/asciidoctor/pdf/formatted_text/transform.rb +394 -0
  86. data/lib/{asciidoctor-pdf → asciidoctor/pdf}/formatted_text.rb +4 -0
  87. data/lib/asciidoctor/pdf/index_catalog.rb +133 -0
  88. data/lib/asciidoctor/pdf/measurements.rb +62 -0
  89. data/lib/asciidoctor/pdf/optimizer.rb +44 -0
  90. data/lib/asciidoctor/pdf/pdfmark.rb +41 -0
  91. data/lib/asciidoctor/pdf/roman_numeral.rb +128 -0
  92. data/lib/asciidoctor/pdf/sanitizer.rb +45 -0
  93. data/lib/asciidoctor/pdf/text_transformer.rb +116 -0
  94. data/lib/asciidoctor/pdf/theme_loader.rb +305 -0
  95. data/lib/asciidoctor/pdf/version.rb +8 -1
  96. data/lib/asciidoctor/pdf.rb +15 -1
  97. data/lib/asciidoctor-pdf/converter.rb +2 -3824
  98. data/lib/asciidoctor-pdf/version.rb +3 -6
  99. data/lib/asciidoctor-pdf.rb +3 -4
  100. metadata +130 -85
  101. data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +0 -24
  102. data/lib/asciidoctor-pdf/asciidoctor_ext/logging_shim.rb +0 -25
  103. data/lib/asciidoctor-pdf/asciidoctor_ext.rb +0 -8
  104. data/lib/asciidoctor-pdf/core_ext/ostruct.rb +0 -8
  105. data/lib/asciidoctor-pdf/core_ext.rb +0 -6
  106. data/lib/asciidoctor-pdf/formatted_text/formatter.rb +0 -40
  107. data/lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb +0 -21
  108. data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +0 -160
  109. data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +0 -46
  110. data/lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb +0 -20
  111. data/lib/asciidoctor-pdf/formatted_text/text_background_and_border_renderer.rb +0 -45
  112. data/lib/asciidoctor-pdf/formatted_text/transform.rb +0 -294
  113. data/lib/asciidoctor-pdf/implicit_header_processor.rb +0 -63
  114. data/lib/asciidoctor-pdf/index_catalog.rb +0 -127
  115. data/lib/asciidoctor-pdf/measurements.rb +0 -58
  116. data/lib/asciidoctor-pdf/pdf-core_ext/page.rb +0 -25
  117. data/lib/asciidoctor-pdf/pdf-core_ext/pdf_object.rb +0 -6
  118. data/lib/asciidoctor-pdf/pdf-core_ext.rb +0 -2
  119. data/lib/asciidoctor-pdf/pdfmark.rb +0 -33
  120. data/lib/asciidoctor-pdf/prawn-svg_ext/interface.rb +0 -10
  121. data/lib/asciidoctor-pdf/prawn-table_ext/cell/asciidoc.rb +0 -69
  122. data/lib/asciidoctor-pdf/prawn-table_ext.rb +0 -4
  123. data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +0 -115
  124. data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +0 -904
  125. data/lib/asciidoctor-pdf/prawn_ext/images.rb +0 -51
  126. data/lib/asciidoctor-pdf/prawn_ext.rb +0 -5
  127. data/lib/asciidoctor-pdf/roman_numeral.rb +0 -126
  128. data/lib/asciidoctor-pdf/rouge_ext/formatters/prawn.rb +0 -175
  129. data/lib/asciidoctor-pdf/rouge_ext/themes/bw.rb +0 -38
  130. data/lib/asciidoctor-pdf/rouge_ext.rb +0 -4
  131. data/lib/asciidoctor-pdf/sanitizer.rb +0 -101
  132. data/lib/asciidoctor-pdf/temporary_path.rb +0 -13
  133. data/lib/asciidoctor-pdf/theme_loader.rb +0 -280
  134. data/lib/asciidoctor-pdf/ttfunk_ext.rb +0 -8
@@ -3,7 +3,8 @@ Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
3
3
  // Settings:
4
4
  :idprefix:
5
5
  :idseparator: -
6
- :toc: preamble
6
+ :toc: macro
7
+ :experimental:
7
8
  ifndef::env-github[:icons: font]
8
9
  ifdef::env-github[]
9
10
  :outfilesuffix: .adoc
@@ -19,6 +20,9 @@ endif::[]
19
20
  :conum-guard-yaml: #
20
21
  ifndef::icons[:conum-guard-yaml: # #]
21
22
  ifdef::backend-pdf[:conum-guard-yaml: # #]
23
+ :url-fontforge: https://fontforge.github.io/en-US/
24
+ :url-fontforge-scripting: https://fontforge.github.io/en-US/documentation/scripting/
25
+ :url-prawn: http://prawnpdf.org
22
26
 
23
27
  ////
24
28
  Topics remaining to document:
@@ -31,12 +35,12 @@ Topics remaining to document:
31
35
  The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file Asciidoctor PDF generates from AsciiDoc.
32
36
  This document describes how the theming system works, how to define a custom theme in YAML and how to activate the theme when running Asciidoctor PDF.
33
37
 
34
- IMPORTANT: If you're creating a custom theme, you're expected to supply your own fonts.
35
- We recognize this can be a major obstacle when you're starting out.
36
- Therefore, your other option is to simply redeclare the fonts from the https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/default-theme.yml[default theme] in the <<Custom Fonts,font catalog>>.
37
- Asciidoctor PDF will then resolve the fonts that are bundled with the gem.
38
+ TIP: The quickest way to create your own theme is to <<Extends,extend the default theme>>.
39
+ This not only gives you a set of foundation styles to build on, it also provides a collection of <<Bundled Fonts,bundled fonts>>.
40
+ If you want to replace the bundled fonts with your own, you must declare the name and location of each font in the <<Custom Fonts,font catalog>>.
41
+ To reuse the bundled fonts, you can either extend the default theme and/or redeclare the bundled fonts in the font catalog.
38
42
 
39
- WARNING: If you don't declare your own fonts, the built-in (AFM) fonts declared in https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/base-theme.yml[base theme] will be used instead.
43
+ WARNING: If you don't declare your own fonts (or extend the default theme), only the built-in (AFM) fonts provided by the PDF reader will be available.
40
44
  Using AFM fonts can result in missing functionality and warnings.
41
45
  See the <<Built-In (AFM) Fonts>> section to learn more about these limitations.
42
46
 
@@ -48,6 +52,11 @@ The Asciidoctor PDF theme language is described using the http://en.wikipedia.or
48
52
  Therefore, if you have a background in web design, the terminology should be immediately familiar to you.
49
53
  *Note, however, that the theming system isn't actually CSS.*
50
54
 
55
+ The theme file must be named _<name>-theme.yml_, where `<name>` is the name of the theme.
56
+ _We recommend *not* using the names *base* or *default* so you don't confuse it with one of the built-in themes._
57
+
58
+ === Selectors and Properties
59
+
51
60
  Like CSS, themes have both selectors and properties.
52
61
  Selectors are the component you want to style.
53
62
  The properties are the style elements of that component that can be styled.
@@ -70,9 +79,9 @@ YAML is a human-friendly data format that resembles CSS and helps to describe th
70
79
  The theme language adds some extra features to YAML, such as variables, basic math, measurements and color values.
71
80
  These enhancements will be explained in detail in later sections.
72
81
 
73
- The theme file must be named _<name>-theme.yml_, where `<name>` is the name of the theme.
82
+ === Basic Theme
74
83
 
75
- Here's an example of a basic theme file:
84
+ Here's an example of a basic theme file that extends the base theme:
76
85
 
77
86
  .basic-theme.yml
78
87
  [source,yaml]
@@ -113,7 +122,9 @@ When creating a new theme, you only have to define the keys you want to override
113
122
  All the available keys are documented in <<Keys>>.
114
123
  The converter uses the information from the theme map to help construct the PDF.
115
124
 
116
- Instead of writing a theme from scratch, you can extend the default theme using the `extends` key as follows:
125
+ === Basic Extended Theme
126
+
127
+ Instead of designing a theme from scratch, you can extend the default theme using the `extends` key as follows:
117
128
 
118
129
  [source,yaml]
119
130
  ----
@@ -123,7 +134,7 @@ base:
123
134
  ----
124
135
 
125
136
  You can also point the extends key at another custom theme to extend from it.
126
- Currently, the base theme is always loaded first.
137
+ If you don't want to extend any theme, including the base theme, assign the value `~` to the `extends` key (i.e., `extends: ~`).
127
138
 
128
139
  WARNING: If you start a new theme from scratch, we strongly recommend defining TrueType fonts and specifying them in the `base` and `literal` categories.
129
140
  Otherwise, Asciidoctor PDF will use built-in AFM fonts, which can result in missing functionality and warnings.
@@ -139,6 +150,8 @@ Alternatively, you can snag the file from your local installation using the foll
139
150
  cp "$ASCIIDOCTOR_PDF_DIR/data/themes/default-theme.yml" custom-theme.yml
140
151
  ====
141
152
 
153
+ === Key Nesting
154
+
142
155
  Keys may be nested to an arbitrary depth to eliminate redundant prefixes (an approach inspired by SASS).
143
156
  Once the theme is loaded, all keys are flattened into a single map of qualified keys.
144
157
  Nesting is simply a shorthand way of organizing the keys.
@@ -186,23 +199,23 @@ Also note the presence of the colon (`:`) after each key name.
186
199
  The value of a key may be one of the following types:
187
200
 
188
201
  * String
189
- - Font family name (e.g., Roboto)
190
- - Font style (normal, bold, italic, bold_italic)
191
- - Alignment (left, center, right, justify)
192
- - Color as hex string (e.g., 'ff0000', #ff0000, or '#ff0000')
193
- - Image path
194
- - Enumerated type (where specified)
195
- - Text content (where specified)
202
+ ** Font family name (e.g., Roboto)
203
+ ** Font style (normal, bold, italic, bold_italic)
204
+ ** Alignment (left, center, right, justify)
205
+ ** Color as hex string (e.g., 'ff0000', #ff0000, or '#ff0000')
206
+ ** Image path
207
+ ** Enumerated type (where specified)
208
+ ** Text content (where specified)
196
209
  * Null (clears any previously assigned value)
197
- - _empty_ (i.e., no value specified)
198
- - null
199
- - ~
210
+ ** _empty_ (i.e., no value specified)
211
+ ** null
212
+ ** ~
200
213
  * Number (integer or float) with optional units (default unit is points)
201
214
  * Array
202
- - Color as RGB array (e.g., [51, 51, 51])
203
- - Color CMYK array (e.g., [50, 100, 0, 0])
204
- - Margin (e.g., [1in, 1in, 1in, 1in])
205
- - Padding (e.g., [1in, 1in, 1in, 1in])
215
+ ** Color as RGB array (e.g., [51, 51, 51])
216
+ ** Color CMYK array (e.g., [50, 100, 0, 0])
217
+ ** Margin (e.g., [1in, 1in, 1in, 1in])
218
+ ** Padding (e.g., [1in, 1in, 1in, 1in])
206
219
  * Variable reference (e.g., $base_font_color or $base-font-color)
207
220
  * Math expression
208
221
 
@@ -309,7 +322,7 @@ base:
309
322
  === Math Expressions & Functions
310
323
 
311
324
  The theme language supports basic math operations to support calculated values.
312
- Like programming languages, multiple and divide take precedence over add and subtract.
325
+ Like programming languages, multiply and divide take precedence over add and subtract.
313
326
 
314
327
  The following table lists the supported operations and the corresponding operator for each.
315
328
 
@@ -433,6 +446,14 @@ Text can be aligned as follows:
433
446
  * right
434
447
  * justify (stretched to each edge)
435
448
 
449
+ ==== Text Decorations
450
+
451
+ The following decorations can be applied to text:
452
+
453
+ * none (no decoration)
454
+ * underline
455
+ * line-through
456
+
436
457
  ==== Image Alignments
437
458
 
438
459
  Images can be aligned as follows:
@@ -443,7 +464,7 @@ Images can be aligned as follows:
443
464
 
444
465
  === Font Styles
445
466
 
446
- In most cases, whereever you can specify a custom font family, you can also specify a font style.
467
+ In most cases, wherever you can specify a custom font family, you can also specify a font style.
447
468
  These two settings are combined to locate the font to use.
448
469
 
449
470
  The following font styles are recognized:
@@ -460,6 +481,7 @@ The following transforms are recognized:
460
481
 
461
482
  * uppercase
462
483
  * lowercase
484
+ * capitalize (each word, like CSS)
463
485
  * none (clears an inherited value)
464
486
 
465
487
  [CAUTION#transform-unicode-letters]
@@ -475,8 +497,6 @@ or
475
497
  $ gem install unicode
476
498
  ====
477
499
 
478
- // Additional transforms, such as capitalize, may be added in the future.
479
-
480
500
  === Colors
481
501
 
482
502
  The theme language supports color values in three formats:
@@ -569,10 +589,12 @@ It's possible to specify no color by assigning the special value `transparent`,
569
589
 
570
590
  [source,yaml]
571
591
  ----
572
- base:
592
+ table:
573
593
  background-color: transparent
574
594
  ----
575
595
 
596
+ The `transparent` keyword can be used for the background or border color, but not the font color.
597
+
576
598
  === Images
577
599
 
578
600
  An image is specified either as a bare image path or as an inline image macro as found in the AsciiDoc syntax.
@@ -649,8 +671,9 @@ IMPORTANT: Asciidoctor has no challenge working with Unicode.
649
671
  In fact, it prefers Unicode and considers the entire range.
650
672
  However, once you convert to PDF, you have to meet the font requirements of PDF in order to preserve Unicode characters.
651
673
  That means you need to provide a font (at least a fallback font) that contains glyphs for all the characters you want to use.
652
- If you don't, you may notice that characters are missing.
674
+ If you don't, you may notice that characters are missing (usually replaced with a box).
653
675
  There's nothing Asciidoctor can do to convince PDF to work with extended characters without the right fonts in play.
676
+ To see which characters are missing from the font, enable verbose mode (`-v`) when running Asciidoctor PDF.
654
677
 
655
678
  === Built-In (AFM) Fonts
656
679
 
@@ -687,8 +710,8 @@ For anything outside of that, PDF is BYOF (Bring Your Own Font).
687
710
  Even though the built-in fonts require the content to be encoded in WINANSI, _you still type your AsciiDoc document in UTF-8_.
688
711
  Asciidoctor PDF encodes the content into WINANSI when building the PDF.
689
712
 
690
- CAUTION: Built-in fonts do not use the <<fallback-fonts,fallback fonts>>.
691
- In order for the fallback font to kick in, you must be using a TrueType font.
713
+ WARNING: Built-in (AFM) fonts do not use the <<fallback-fonts,fallback fonts>>.
714
+ In order for the fallback font to kick in, you must use a TrueType font as the primary font.
692
715
 
693
716
  .WINANSI Encoding Behavior
694
717
  ****
@@ -704,6 +727,7 @@ To prevent this warning, you need to specify a TrueType font.
704
727
 
705
728
  When using a TrueType font, you will get no warning for a missing glyph.
706
729
  That's a consequence of how Prawn works and is outside of Asciidoctor PDF's control.
730
+ However, you'll likely see it substituted with a box (guaranteed if you're using one of the bundled fonts).
707
731
 
708
732
  For more information about how Prawn handles character encodings for built-in fonts, see https://github.com/prawnpdf/prawn/blob/master/CHANGELOG.md#vastly-improved-handling-of-encodings-for-pdf-built-in-afm-fonts[this note in the Prawn CHANGELOG].
709
733
  ****
@@ -726,32 +750,37 @@ Also provides the circuled numbers used in callouts.
726
750
  http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1p[M+ 1p Fallback]::
727
751
  A sans-serif font that provides a very complete set of Unicode glyphs.
728
752
  Cannot be styled as italic, bold or bold_italic.
729
- Used as the fallback font.
753
+ Used as the fallback font in the `default-with-fallback-font` theme.
730
754
 
731
- CAUTION: At the time of this writing, you cannot use the bundled fonts if you change the value of the `pdf-fontsdir` attribute (and thus define your own custom fonts).
732
- This limitation may be lifted in the future.
755
+ TIP: If you want to specify the location of custom fonts using the `pdf-fontsdir` attribute, yet still be able to use the bundled fonts, you need to refer to the bundled fonts using the `GEM_FONTS_DIR` token.
756
+ To do so, you can either a) prefix the path of the bundled font in the theme file with the segment `GEM_FONTS_DIR` (e.g., `GEM_FONTS_DIR/mplus1p-regular-fallback.ttf`, or b) use relative paths in the theme file and include `GEM_FONT_DIR` in the value of the `pdf-fontsdir` attribute separated by the location of your custom fonts using a semi-colon (e.g., `"path/to/your/fonts;GEM_FONTS_DIR"`).
733
757
 
734
758
  === Custom Fonts
735
759
 
736
760
  The limited character set of WINANSI, or the bland look of the built-in fonts, may motivate you to load your own font.
737
761
  Custom fonts can enhance the look of your PDF theme substantially.
738
762
 
739
- To start, you need to find a TTF file collection for the font you want to use.
740
- A collection typically consists of all four styles of a font:
763
+ To start, find the TTF file collection for the font you want to use.
764
+ A collection typically consists of all four font styles:
741
765
 
742
766
  * normal
743
767
  * italic
744
768
  * bold
745
769
  * bold_italic
746
770
 
747
- You'll need all four styles to support AsciiDoc content properly.
748
- _Asciidoctor PDF cannot italicize a font dynamically like a browser can, so you need the italic style._
771
+ You'll need all four variants to support AsciiDoc content properly.
772
+ Otherwise, the converter will likely crash.
773
+ If you don't have one of the variants, you can simply reuse the normal variant in its place.
774
+ _Asciidoctor PDF cannot italicize a font dynamically like a browser can, so the italic styles are required._
775
+
776
+ In order for a third-party font to work properly with Prawn (and hence Asciidoctor PDF), several modifications are required.
777
+ See <<Preparing a Custom Font>> to learn how to prepare your font for use with Asciidoctor PDF.
749
778
 
750
- Once you've obtained the TTF files, put them into a directory in your project where you want to store the fonts.
779
+ Once you've obtained the TTF files, put them in the directory inside your project where you want to store the fonts.
751
780
  It's recommended that you name them consistently so it's easier to type the names in the theme file.
752
781
 
753
782
  Let's assume the name of the font is https://github.com/google/roboto/tree/master/out/RobotoTTF[Roboto].
754
- Name the files as follows:
783
+ Rename the files as follows:
755
784
 
756
785
  * roboto-normal.ttf (_originally Roboto-Regular.ttf_)
757
786
  * roboto-italic.ttf (_originally Roboto-Italic.ttf_)
@@ -771,8 +800,11 @@ font:
771
800
  bold_italic: roboto-bold_italic.ttf
772
801
  ----
773
802
 
803
+ CAUTION: You must declare all four variants.
804
+ If you're missing the font file for one of the variants, configure it to use the same font file as the normal variant.
805
+
774
806
  You can use the key that you assign to the font in the font catalog anywhere the `font-family` property is accepted in the theme file.
775
- For instance, to use the Roboto font for all headings, you'd use:
807
+ For example, to use the Roboto font for all headings (section titles and discrete headings), use:
776
808
 
777
809
  [source,yaml]
778
810
  ----
@@ -780,16 +812,28 @@ heading:
780
812
  font-family: Roboto
781
813
  ----
782
814
 
783
- When you execute Asciidoctor PDF, you need to specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
815
+ When you execute Asciidoctor PDF, specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
784
816
 
785
817
  $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
786
818
 
787
- WARNING: Currently, all fonts referenced by the theme need to be present in the directory specified by the `pdf-fontsdir` attribute.
819
+ You can specify multiple directories by separating the entries with a semi-colon and enclosing the value in double quotes:
820
+
821
+ $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir="path/to/fonts;path/to/more-fonts" document.adoc
788
822
 
789
- When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
790
- In other words, Asciidoctor PDF automatically subsets the font.
791
- However, if you're storing the fonts in a repository, you may want to subset the font (for instance, by using FontForge) to reduce the space the font occupies in that storage.
792
- This is simply a personal preference.
823
+ To include the bundled fonts in the search, use the `GEM_FONTS_DIR` token:
824
+
825
+ $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir="path/to/fonts;GEM_FONTS_DIR" document.adoc
826
+
827
+ When running Asciidoctor PDF on the JVM (perhaps using AsciidoctorJ PDF), you can refer a directory inside of any JAR file on the classpath by prefixing the path with `uri:classloader:`:
828
+
829
+ $ asciidoctorj -b pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir="uri:classloader:/path/to/fonts;GEM_FONTS_DIR" document.adoc
830
+
831
+ TIP: When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
832
+ Effectively, it subsets the font.
833
+ While that saves space taken up by the generated PDF, you may still be storing the full font in your source repository.
834
+ To minimize the size of the source font, you can use {url-fontforge}[FontForge] to subset the font ahead of time.
835
+ Subsetting a font means remove glyphs you don't plan to use.
836
+ Doing so is not a requirement, simply a personal preference.
793
837
 
794
838
  You can add any number of fonts to the catalog.
795
839
  Each font must be assigned a unique key, as shown here:
@@ -810,22 +854,29 @@ font:
810
854
  bold_italic: roboto-light-bold_italic.ttf
811
855
  ----
812
856
 
813
- TIP: Text in SVGs will use the font catalog from your theme.
814
- We recommend that you match the font key to the name of the font seen by the operating system.
815
- This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF.
857
+ Text in SVGs will use the font catalog from your theme.
858
+ We recommend that you match the font key in your theme file to the name of the font seen by the operating system.
859
+ This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF, thus making them portable.
816
860
 
817
861
  === Fallback Fonts
818
862
 
819
- If a TrueType font is missing a character needed to render the document, such as a special symbol, you can have Asciidoctor PDF look for the character in a fallback font.
863
+ If a TrueType font is missing a character needed to render the document, such as a special symbol or emoji, you can have Asciidoctor PDF look for the character in a fallback font.
864
+
820
865
  You only need to specify a single fallback font, typically one that provides a full set of symbols.
866
+ If the character isn't found in the fallback font, it will mostly likely be replaced by a box (i.e., the notdef glyph), which is guaranteed if you're using the bundled fallback font.
867
+
868
+ IMPORTANT: When defining the fallback font, you *must specify all four variants* (normal, bold, italic, bold_italic), even if you use the same font file for each.
821
869
 
822
- IMPORTANT: The fallback font is only used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
870
+ IMPORTANT: The fallback font only gets used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
823
871
  Any glyph missing from an AFM font is simply replaced with the "`not`" glyph (`&#172;`).
824
872
 
825
- CAUTION: Using the fallback font slows down PDF generation slightly because it has to analyze every single character.
873
+ CAUTION: The `default` theme does not use a fallback font.
874
+ However, the built-in `default-with-fallback-font` theme does.
875
+ In fact, it provides two.
876
+ One for general writing in non-Latin languages (M+ 1p) and another for emoji (Noto Emoji).
877
+ Using the fallback font slows down PDF generation slightly because it has to analyze every single character.
826
878
  It's use is not recommended for large documents.
827
879
  Instead, it's best to select primary fonts that have all the characters you need.
828
- Keep in mind that the default theme currently uses a fallback font, though this may change in the future.
829
880
 
830
881
  Like with other custom fonts, you first need to declare the fallback font.
831
882
  Let's choose https://github.com/android/platform_frameworks_base/blob/master/data/fonts/DroidSansFallback.ttf[Droid Sans Fallback].
@@ -847,6 +898,9 @@ font:
847
898
  bold_italic: droid-sans-fallback.ttf
848
899
  ----
849
900
 
901
+ Notice that we define all four variants for the fallback font, even though we're use the same font file for each variant.
902
+ This ensures the fallback font will be used regardless of which font style is active when it gets called on.
903
+
850
904
  Next, add the key name to the `fallbacks` key under the `font-catalog` key.
851
905
  The `fallbacks` key accepts an array of values, meaning you can specify more than one fallback font.
852
906
  However, we recommend using a single fallback font, if possible, as shown here:
@@ -866,7 +920,7 @@ font:
866
920
  bold: droid-sans-fallback.ttf
867
921
  bold_italic: droid-sans-fallback.ttf
868
922
  fallbacks:
869
- - DroidSansFallback
923
+ - DroidSansFallback
870
924
  ----
871
925
 
872
926
  TIP: If you are using more than one fallback font, add additional lines to the `fallbacks` key.
@@ -881,9 +935,23 @@ base:
881
935
 
882
936
  That's it!
883
937
  Now you're covered.
884
- If your custom font is missing a glyph, Asciidoctor PDF will look in your fallback font.
938
+ If your custom TTF font is missing a glyph, Asciidoctor PDF will look in your fallback font.
885
939
  You don't need to reference the fallback font anywhere else in your theme file.
886
940
 
941
+ Here's another example that shows how to use an alternative emoji font (Symbola):
942
+
943
+ [source,yaml]
944
+ ----
945
+ extends: default-with-fallback-font
946
+ font:
947
+ catalog:
948
+ merge: true
949
+ Symbola: /path/to/symbola.ttf
950
+ fallbacks: [ M+ 1p, Symbola ]
951
+ ----
952
+
953
+ Now Asciidoctor PDF will look for the emoji in the Symbola font instead of the Noto Emoji font.
954
+
887
955
  == Keys
888
956
 
889
957
  This section lists all the keys that are available when creating a custom theme.
@@ -907,6 +975,15 @@ Therefore, you only have to declare keys that you want to override.
907
975
  === Extends
908
976
 
909
977
  A theme can extend another theme using the `extends` key.
978
+ For example:
979
+
980
+ [source,yaml]
981
+ ----
982
+ extends: default
983
+ base:
984
+ font-color: #ff0000
985
+ ----
986
+
910
987
  The extends key accepts either a single value or an array of values.
911
988
  Each value is interpreted as a filename.
912
989
  If the filename equals `default`, it resolves to the location of the default (built-in) theme.
@@ -914,6 +991,11 @@ If the filename is absolute, it's used as is.
914
991
  If the filename begins with `./`, it's resolved as a theme file relative to the current theme file.
915
992
  Otherwise, the filename is resolved as a theme file in the normal way (relative to the value of the `pdf-themesdir` attribute).
916
993
 
994
+ CAUTION: If you define the <<Custom fonts,font catalog>> in a theme that extends from `default`, you either have to redeclare any built-in font that on which the combined theme depends, or you need to set `merge: true` above your font definitions.
995
+ You can find the built-in definitions in default theme.
996
+ You'll then need to include `GEM_FONTS_DIR` in the value of the `pdf-fontsdir` attribute so that the converter can find and register them.
997
+ To avoid having to do this, make sure you set the font family for any element that declares a font family in the default theme.
998
+
917
999
  Currently, the base theme is always loaded first.
918
1000
  Then, the files referenced by the extends key are loaded in order.
919
1001
  Finally, the keys in the current file are loaded.
@@ -931,13 +1013,153 @@ Each time a theme is loaded, the keys are overlaid onto the keys from the previo
931
1013
  - ./brand-theme.yml
932
1014
  |===
933
1015
 
1016
+ [#keys-role]
1017
+ === Role
1018
+
1019
+ The keys in the `role` category define custom roles for formatting.
1020
+ The name of the role is the first subkey level.
1021
+ The role name may contain a hyphen, but *a role name cannot contain an underscore*.
1022
+ The keys under the role are the theming properties.
1023
+
1024
+ IMPORTANT: Custom roles only apply to inline phrases.
1025
+
1026
+ Here's an example of a role for making text red:
1027
+
1028
+ [source,yaml]
1029
+ ----
1030
+ role:
1031
+ red:
1032
+ font-color: #ff0000
1033
+ ----
1034
+
1035
+ This role can be used as follows:
1036
+
1037
+ [source,asciidoc]
1038
+ ----
1039
+ Error text is shown in [.red]#red#.
1040
+ ----
1041
+
1042
+ You can also use a role to unset a font color (to make it inherit):
1043
+
1044
+ [source,yaml]
1045
+ ----
1046
+ role:
1047
+ heading-code:
1048
+ font-color: ~
1049
+ ----
1050
+
1051
+ This role can be used as follows:
1052
+
1053
+ [source,asciidoc]
1054
+ ----
1055
+ == [.heading-code]`SELECT` clause
1056
+ ----
1057
+
1058
+ The converter provides several predefined roles, which can can all be redefined.
1059
+ The `big` and `small` roles map the font size to the $base-font-size-large and $base-font-size-small values, respectively.
1060
+ The `underline` and `line-through` roles add the underline and strikethrough decorations, respectively.
1061
+ The `subtitle` role is used to configure the font properties of the subtitle of a section title.
1062
+ The color roles (e.g., `blue`), which you may be familiar with from the HTML converter, are not mapped by default.
1063
+ You'll need to define these color roles in your theme if you'd like to make use of them when converting to PDF.
1064
+
1065
+ [cols="3,4,5l"]
1066
+ |===
1067
+ |Key |Value Type |Example
1068
+
1069
+ 3+|[#key-prefix-role]*Key Prefix:* <<key-prefix-role,role-<name>{zwsp}>>
1070
+
1071
+ |background-color
1072
+ |<<colors,Color>> +
1073
+ (default: _not set_)
1074
+ |role:
1075
+ highlight:
1076
+ background-color: #ffff00
1077
+
1078
+ |border-color
1079
+ |<<colors,Color>> +
1080
+ (default: _not set_)
1081
+ |role:
1082
+ found:
1083
+ border-color: #cccccc
1084
+
1085
+ |border-offset
1086
+ |<<values,Number>> +
1087
+ (default: 0)
1088
+ |role:
1089
+ found:
1090
+ border-offset: 2
1091
+
1092
+ |border-radius
1093
+ |<<values,Number>> +
1094
+ (default: _not set_)
1095
+ |role:
1096
+ found:
1097
+ border-radius: 3
1098
+
1099
+ |border-width
1100
+ |<<values,Number>> +
1101
+ (default: _not set_)
1102
+ |role:
1103
+ found:
1104
+ border-width: 0.5
1105
+
1106
+ |font-color
1107
+ |<<colors,Color>> +
1108
+ (default: _inherit_)
1109
+ |role:
1110
+ red:
1111
+ font-color: #ff0000
1112
+
1113
+ |font-family
1114
+ |<<fonts,Font family name>> +
1115
+ (default: Courier)
1116
+ |role:
1117
+ label:
1118
+ font-family: M+ 1mn
1119
+
1120
+ |font-size
1121
+ |<<values,Number>> +
1122
+ (default: _inherit_)
1123
+ |role:
1124
+ large:
1125
+ font-size: 12
1126
+
1127
+ |font-style
1128
+ |<<font-styles,Font style>> +
1129
+ (default: _inherit_)
1130
+ |role:
1131
+ heavy:
1132
+ font-style: bold
1133
+
1134
+ |text-decoration
1135
+ |<<text-decorations,Text decoration>> +
1136
+ (default: none)
1137
+ |role:
1138
+ deleted:
1139
+ text-decoration: line-through
1140
+
1141
+ |text-decoration-color
1142
+ |<<colors,Color>> +
1143
+ (default: $role-<name>-font-color)
1144
+ |role:
1145
+ deleted:
1146
+ text-decoration-color: #ff0000
1147
+
1148
+ |text-decoration-width
1149
+ |<<values,Number>> +
1150
+ (default: 1)
1151
+ |role:
1152
+ underline:
1153
+ text-decoration-width: 0.5
1154
+ |===
1155
+
934
1156
  [#keys-page]
935
1157
  === Page
936
1158
 
937
1159
  The keys in this category control the size, margins and background of each page (i.e., canvas).
938
1160
  We recommended that you define this category before all other categories.
939
1161
 
940
- NOTE: The background of the title page can be styled independently.
1162
+ NOTE: The background of the title page can be styled independently of other pages.
941
1163
  See <<Title Page>> for details.
942
1164
 
943
1165
  [cols="3,4,5l"]
@@ -952,20 +1174,32 @@ See <<Title Page>> for details.
952
1174
  |page:
953
1175
  background-color: #fefefe
954
1176
 
955
- |background-image^[1]^
956
- |image macro^[2]^ +
1177
+ |background-image^[2]^
1178
+ |image macro^[3]^ +
957
1179
  (default: _not set_)
958
1180
  |page:
959
1181
  background-image: image:page-bg.png[]
960
1182
 
961
- |background-image-(recto{vbar}verso)^[1]^
962
- |image macro^[2]^ +
1183
+ |background-image-(recto{vbar}verso)^[2]^
1184
+ |image macro^[3]^ +
963
1185
  (default: _not set_)
964
1186
  |page:
965
1187
  background-image:
966
1188
  recto: image:page-bg-recto.png[]
967
1189
  verso: image:page-bg-verso.png[]
968
1190
 
1191
+ |foreground-image^[2]^
1192
+ |image macro^[3]^ +
1193
+ (default: _not set_)
1194
+ |page
1195
+ foreground-image: image:watermark.svg[]
1196
+
1197
+ |initial-zoom
1198
+ |Fit {vbar} FitH {vbar} FitV +
1199
+ (default: FitH)
1200
+ |page:
1201
+ initial-zoom: Fit
1202
+
969
1203
  |layout
970
1204
  |portrait {vbar} landscape +
971
1205
  (default: portrait)
@@ -978,39 +1212,53 @@ See <<Title Page>> for details.
978
1212
  |page:
979
1213
  margin: [0.5in, 0.67in, 1in, 0.67in]
980
1214
 
981
- |margin-inner^[3]^
1215
+ |margin-inner^[4]^
982
1216
  |<<measurement-units,Measurement>> +
983
1217
  (default: 48)
984
1218
  |page:
985
1219
  margin-inner: 0.75in
986
1220
 
987
- |margin-outer^[3]^
1221
+ |margin-outer^[4]^
988
1222
  |<<measurement-units,Measurement>> +
989
1223
  (default: 24)
990
1224
  |page:
991
1225
  margin-outer: 0.59in
992
1226
 
1227
+ |mode
1228
+ |outline {vbar} none {vbar} thumbs {vbar} fullscreen {vbar} fullscreen outline {vbar} fullscreen none {vbar} fullscreen thumbs +
1229
+ (default: outline)
1230
+ |page:
1231
+ mode: fullscreen none
1232
+
993
1233
  |size
994
1234
  |https://github.com/prawnpdf/pdf-core/blob/0.6.0/lib/pdf/core/page_geometry.rb#L16-L68[Named size^] {vbar} <<measurement-units,Measurement[width,height]>> +
995
1235
  (default: A4)
996
1236
  |page:
997
1237
  size: Letter
998
1238
 
999
- |numbering-start-at
1000
- |title {vbar} toc {vbar} body +
1239
+ |numbering-start-at^[5]^
1240
+ |title {vbar} toc {vbar} body {vbar} Integer +
1001
1241
  (default: body)
1002
1242
  |page:
1003
1243
  numbering-start-at: toc
1004
1244
  |===
1005
1245
 
1006
- . By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`).
1007
- The size of the background can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
1008
- If the recto (right-hand, odd-numbered pages) or verso (left-hand, even-numbered pages) background is specified, it will be used only for that side.
1009
- If you flatten out the keys (e.g., `page-background-recto`), you can also set the default page background image (`page-background`), which will then be used as a fallback if a background image isn't specified for a side.
1010
- To disable the background for a side, use the value `none`.
1246
+ . To disable the background color for the page, set the value to white (i.e., FFFFFF).
1247
+ The color keyword `transparent` is not recognized in this context.
1248
+ . By default, page background and foreground images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
1249
+ The size of the image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width) when `fit=none`.
1250
+ The position of the image can be controlled using the `position` attribute.
1251
+ If the recto (right-hand, odd-numbered pages) or verso (left-hand, even-numbered pages) background image is specified, it will be used only for that side (not available for the foreground image).
1252
+ If you define the keys using the flatten structure (e.g., `page-background-image-recto`), you can also set the default page background image (`page-background-image`), which will then be used as a fallback if a background image isn't specified for a given side.
1253
+ To disable the image, use the value `none`.
1011
1254
  . Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
1012
1255
  . The margins for `recto` (right-hand, odd-numbered) and `verso` (left-hand, even-numbered) pages are calculated automatically from the margin-inner and margin-outer values.
1013
1256
  These margins and used when the value `prepress` is assigned to the `media` document attribute.
1257
+ If no cover is specified, the recto margin is not applied to the title page.
1258
+ To apply the recto margin to the title page, but not include a cover, assign the value `~` to the `front-cover-image` attribute.
1259
+ . The `toc` value only applies if the toc is in the default location (before the first page of the body).
1260
+ If the toc macro is used to position the toc, the start-at behavior is the same as if the toc is not enabled.
1261
+ If value is an integer, page numbering will start at the specified page of the body (i.e., 1 is first page, 2 is second page, etc.)
1014
1262
 
1015
1263
  [#keys-base]
1016
1264
  === Base
@@ -1062,6 +1310,12 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
1062
1310
  |base:
1063
1311
  font-family: Noto Serif
1064
1312
 
1313
+ |font-kerning
1314
+ |normal {vbar} none +
1315
+ (default: normal)
1316
+ |base:
1317
+ font-kerning: none
1318
+
1065
1319
  |font-size
1066
1320
  |<<values,Number>> +
1067
1321
  (default: 12)
@@ -1076,9 +1330,9 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
1076
1330
 
1077
1331
  |font-size-min
1078
1332
  |<<values,Number>> +
1079
- (default: 9)
1333
+ (default: 6)
1080
1334
  |base:
1081
- font-size-min: 6
1335
+ font-size-min: $base-font-size * 0.75
1082
1336
 
1083
1337
  // font-size-small is a variable, not an official key
1084
1338
  //|font-size-small
@@ -1100,7 +1354,7 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
1100
1354
 
1101
1355
  |line-height-length^[2]^
1102
1356
  |<<values,Number>> +
1103
- (default: 13.8)
1357
+ (default: _not set_)
1104
1358
  |base:
1105
1359
  line-height-length: 12
1106
1360
 
@@ -1111,13 +1365,21 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
1111
1365
  line-height: >
1112
1366
  $base-line-height-length /
1113
1367
  $base-font-size
1368
+
1369
+ |text-decoration-width
1370
+ |<<values,Number>> +
1371
+ (default: 1)
1372
+ |base:
1373
+ text-decoration-width: 0.5
1114
1374
  |===
1115
1375
 
1116
1376
  . The `text-transform` key cannot be set globally.
1117
1377
  Therefore, this key should not be used.
1118
1378
  The value of `none` is implicit and is documented here for completeness.
1119
- . You should set one of `line-height` or `line-height-length`, then derive the value of the other using a calculation as these are correlated values.
1120
- For instance, if you set `line-height-length`, then use `$base-line-height-length / $base-font-size` as the value of `line-height`.
1379
+ . `line-height-length` is a utility property that's internal to the theme.
1380
+ It's used as an intermediate property for computing the `base-line-height` from the base font size and the desired line height size.
1381
+ For instance, if you set `base-line-height-length`, you can use `$base-line-height-length / $base-font-size` to set the value of `base-line-height`.
1382
+ You don't have to go about it this way in your own theme.
1121
1383
 
1122
1384
  [#keys-vertical-spacing]
1123
1385
  === Vertical Spacing
@@ -1170,10 +1432,22 @@ The keys in this category are used to style hyperlink text.
1170
1432
  font-style: italic
1171
1433
 
1172
1434
  |text-decoration
1173
- |none {vbar} underline {vbar} line-through +
1435
+ |<<text-decorations,Text decoration>> +
1174
1436
  (default: none)
1175
1437
  |link:
1176
1438
  text-decoration: underline
1439
+
1440
+ |text-decoration-color
1441
+ |<<colors,Color>> +
1442
+ (default: $link-font-color)
1443
+ |link:
1444
+ text-decoration-color: #0000ff
1445
+
1446
+ |text-decoration-width
1447
+ |<<values,Number>> +
1448
+ (default: 1)
1449
+ |link:
1450
+ text-decoration-width: 0.5
1177
1451
  |===
1178
1452
 
1179
1453
  [#keys-literal]
@@ -1187,6 +1461,36 @@ The keys in this category are used for inline monospaced text in prose and table
1187
1461
 
1188
1462
  3+|[#key-prefix-literal]*Key Prefix:* <<key-prefix-literal,literal>>
1189
1463
 
1464
+ |background-color
1465
+ |<<colors,Color>> +
1466
+ (default: _not set_)
1467
+ |literal:
1468
+ background-color: #f5f5f5
1469
+
1470
+ |border-color^[1]^
1471
+ |<<colors,Color>> +
1472
+ (default: _not set_)
1473
+ |literal:
1474
+ border-color: #cccccc
1475
+
1476
+ |border-offset^[2]^
1477
+ |<<values,Number>> +
1478
+ (default: 0)
1479
+ |literal:
1480
+ border-offset: 2
1481
+
1482
+ |border-radius
1483
+ |<<values,Number>> +
1484
+ (default: _not set_)
1485
+ |literal:
1486
+ border-radius: 3
1487
+
1488
+ |border-width
1489
+ |<<values,Number>> +
1490
+ (default: $base-border-width)
1491
+ |literal:
1492
+ border-width: 0.5
1493
+
1190
1494
  |font-color
1191
1495
  |<<colors,Color>> +
1192
1496
  (default: _inherit_)
@@ -1212,6 +1516,12 @@ The keys in this category are used for inline monospaced text in prose and table
1212
1516
  font-style: bold
1213
1517
  |===
1214
1518
 
1519
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
1520
+ The border only works properly if the literal phrase does not have nested formatting.
1521
+ Otherwise, the border will be inherited, producing a less than desirable result.
1522
+ . The border offset is the amount that the background and border swells around the text.
1523
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
1524
+
1215
1525
  [#keys-heading]
1216
1526
  === Heading
1217
1527
 
@@ -1237,10 +1547,16 @@ The keys in this category control the style of most headings, including part tit
1237
1547
 
1238
1548
  |font-family
1239
1549
  |<<fonts,Font family name>> +
1240
- (default: $base-font-family)
1550
+ (default: _inherit_)
1241
1551
  |heading:
1242
1552
  font-family: Noto Serif
1243
1553
 
1554
+ |font-kerning
1555
+ |normal {vbar} none +
1556
+ (default: _inherit_)
1557
+ |heading:
1558
+ font-kerning: none
1559
+
1244
1560
  // NOTE: heading-font-size is overridden by h<n>-font-size in base theme
1245
1561
  //|font-size
1246
1562
  //|<<values,Number>> +
@@ -1254,11 +1570,29 @@ The keys in this category control the style of most headings, including part tit
1254
1570
  |heading:
1255
1571
  font-style: bold
1256
1572
 
1573
+ |text-decoration
1574
+ |<<text-decorations,Text decoration>> +
1575
+ (default: none)
1576
+ |heading:
1577
+ text-decoration: underline
1578
+
1579
+ |text-decoration-color
1580
+ |<<colors,Color>> +
1581
+ (default: $heading-font-color)
1582
+ |heading:
1583
+ text-decoration-color: #cccccc
1584
+
1585
+ |text-decoration-width
1586
+ |<<values,Number>> +
1587
+ (default: 1)
1588
+ |heading:
1589
+ text-decoration-width: 0.5
1590
+
1257
1591
  |text-transform
1258
1592
  |<<text-transforms,Text transform>> +
1259
1593
  (default: _inherit_)
1260
1594
  |heading:
1261
- text-transform: uppercase
1595
+ text-transform: capitalize
1262
1596
 
1263
1597
  |line-height
1264
1598
  |<<values,Number>> +
@@ -1272,13 +1606,46 @@ The keys in this category control the style of most headings, including part tit
1272
1606
  |heading:
1273
1607
  margin-top: $vertical-spacing * 0.2
1274
1608
 
1609
+ |margin-page-top
1610
+ |<<measurement-units,Measurement>> +
1611
+ (default: 0)
1612
+ |heading:
1613
+ margin-page-top: $vertical-spacing
1614
+
1275
1615
  |margin-bottom
1276
1616
  |<<measurement-units,Measurement>> +
1277
1617
  (default: 12)
1278
1618
  |heading:
1279
1619
  margin-bottom: 9.6
1280
1620
 
1281
- 3+|[#key-prefix-heading-level]*Key Prefix:* <<key-prefix-heading-level,heading-h<n> >>^[1]^
1621
+ |min-height-after
1622
+ |<<measurement-units,Measurement>> +
1623
+ (default: $base-font-size * $base-line-height * 1.5)
1624
+ |heading:
1625
+ min-height-after: 0.5in
1626
+
1627
+ |chapter-break-before
1628
+ |always {vbar} auto +
1629
+ (default: always)
1630
+ |heading:
1631
+ chapter:
1632
+ break-before: auto
1633
+
1634
+ |part-break-before
1635
+ |always {vbar} auto +
1636
+ (default: always)
1637
+ |heading:
1638
+ part:
1639
+ break-before: auto
1640
+
1641
+ |part-break-after
1642
+ |always {vbar} auto +
1643
+ (default: auto)
1644
+ |heading:
1645
+ part:
1646
+ break-after: always
1647
+
1648
+ 3+|[#key-prefix-heading-level]*Key Prefix:* <<key-prefix-heading-level,heading-h<n>{zwsp}>>^[1]^
1282
1649
 
1283
1650
  |align
1284
1651
  |<<text-alignments,Text alignment>> +
@@ -1298,6 +1665,12 @@ The keys in this category control the style of most headings, including part tit
1298
1665
  |heading:
1299
1666
  h4-font-family: Roboto
1300
1667
 
1668
+ |font-kerning
1669
+ |normal {vbar} none +
1670
+ (default: $heading-font-kerning)
1671
+ |heading:
1672
+ h3-font-kerning: none
1673
+
1301
1674
  |font-size^[1]^
1302
1675
  |<<values,Number>> +
1303
1676
  (default: <1>=24; <2>=18; <3>=16; <4>=14; <5>=12; <6>=10)
@@ -1314,19 +1687,63 @@ The keys in this category control the style of most headings, including part tit
1314
1687
  |<<text-transforms,Text transform>> +
1315
1688
  (default: $heading-text-transform)
1316
1689
  |heading:
1317
- text-transform: lowercase
1690
+ h3-text-transform: uppercase
1691
+
1692
+ |margin-top
1693
+ |<<measurement-units,Measurement>> +
1694
+ (default: $heading-margin-top)
1695
+ |heading:
1696
+ h2-margin-top: $vertical-spacing * 0.5
1697
+
1698
+ |margin-page-top
1699
+ |<<measurement-units,Measurement>> +
1700
+ (default: $heading-margin-page-top)
1701
+ |heading:
1702
+ h2-margin-page-top: $vertical-spacing
1703
+
1704
+ |margin-bottom
1705
+ |<<measurement-units,Measurement>> +
1706
+ (default: $heading-margin-bottom)
1707
+ |heading:
1708
+ h2-margin-bottom: 10
1318
1709
  |===
1319
1710
 
1320
1711
  . `<n>` is a number ranging from 1 to 6, representing each of the six heading levels.
1321
1712
  . A font size is assigned to each heading level by the base theme.
1322
1713
  If you want the font size of a specific level to be inherited, you must assign the value `null` (or `~` for short).
1323
1714
 
1715
+ [#keys-section]
1716
+ === Section
1717
+
1718
+ The keys in this category control the style of a section body.
1719
+
1720
+ [cols="3,4,5l"]
1721
+ |===
1722
+ |Key |Value Type |Example
1723
+
1724
+ 3+|[#key-prefix-section]*Key Prefix:* <<key-prefix-section,section>>
1725
+
1726
+ |indent
1727
+ |<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[left,right]>>^[1]^ +
1728
+ (default: 0)
1729
+ |section:
1730
+ indent: [0.5in, 0]
1731
+ |===
1732
+ . A single value gets applied to both the left and right side (e.g., `0.5in`).
1733
+ A two-value array configures the left and right side independently (e.g., `[0.5in, 0]`).
1734
+
1324
1735
  [#keys-title-page]
1325
1736
  === Title Page
1326
1737
 
1327
1738
  The keys in this category control the style of the title page as well as the arrangement and style of the elements on it.
1328
1739
 
1329
- TIP: The title page can be disabled from the document by setting the `notitle` attribute in the AsciiDoc document header.
1740
+ IMPORTANT: The title page is only enabled by default for the book doctype (e.g., `:doctype: book`).
1741
+ If you want to enable the title page when using a different doctype (such as the article doctype), you must define the `title-page` attribute in the document header (i.e., `:title-page:`).
1742
+
1743
+ NOTE: Subtitle partitioning of the doctitle is only enabled when the title page is also enabled.
1744
+
1745
+ TIP: The title page can be disabled for the book doctype by setting the `notitle` attribute in the AsciiDoc document header (i.e., `:notitle:`).
1746
+ (For other doctypes, just don't set the `title-page` attribute).
1330
1747
 
1331
1748
  [cols="3,4,5l"]
1332
1749
  |===
@@ -1346,8 +1763,8 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1346
1763
  |title-page:
1347
1764
  background-color: #eaeaea
1348
1765
 
1349
- |background-image^[1]^
1350
- |image macro^[2]^ +
1766
+ |background-image^[2]^
1767
+ |image macro^[3]^ +
1351
1768
  (default: _not set_)
1352
1769
  |title-page:
1353
1770
  background-image: image:title.png[]
@@ -1364,6 +1781,12 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1364
1781
  |title-page:
1365
1782
  font-family: Noto Serif
1366
1783
 
1784
+ |font-kerning
1785
+ |normal {vbar} none +
1786
+ (default: _inherit_)
1787
+ |title-page:
1788
+ font-kerning: none
1789
+
1367
1790
  |font-size
1368
1791
  |<<values,Number>> +
1369
1792
  (default: _inherit_)
@@ -1398,14 +1821,14 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1398
1821
  align: right
1399
1822
 
1400
1823
  |image
1401
- |image macro^[2]^ +
1824
+ |image macro^[3]^ +
1402
1825
  (default: _not set_)
1403
1826
  |title-page:
1404
1827
  logo:
1405
1828
  image: image:logo.png[pdfwidth=25%]
1406
1829
 
1407
1830
  |top
1408
- |Percentage^[3]^ +
1831
+ |<<measurement-units,Measurement>>^[4]^ +
1409
1832
  (default: 10%)
1410
1833
  |title-page:
1411
1834
  logo:
@@ -1413,6 +1836,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1413
1836
 
1414
1837
  3+|[#key-prefix-title-page-title]*Key Prefix:* <<key-prefix-title-page-title,title-page-title>>
1415
1838
 
1839
+ |display
1840
+ |none +
1841
+ (default: _not set_)
1842
+ |title-page:
1843
+ title:
1844
+ display: none
1845
+
1416
1846
  |font-color
1417
1847
  |<<colors,Color>> +
1418
1848
  (default: _inherit_)
@@ -1427,6 +1857,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1427
1857
  title:
1428
1858
  font-family: Noto Serif
1429
1859
 
1860
+ |font-kerning
1861
+ |normal {vbar} none +
1862
+ (default: _inherit_)
1863
+ |title-page:
1864
+ title:
1865
+ font-kerning: none
1866
+
1430
1867
  |font-size
1431
1868
  |<<values,Number>> +
1432
1869
  (default: 18)
@@ -1456,7 +1893,7 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1456
1893
  line-height: 0.9
1457
1894
 
1458
1895
  |top
1459
- |Percentage^[3]^ +
1896
+ |<<measurement-units,Measurement>>^[4]^ +
1460
1897
  (default: 40%)
1461
1898
  |title-page:
1462
1899
  title:
@@ -1478,6 +1915,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1478
1915
 
1479
1916
  3+|[#key-prefix-title-page-subtitle]*Key Prefix:* <<key-prefix-title-page-subtitle,title-page-subtitle>>
1480
1917
 
1918
+ |display
1919
+ |none +
1920
+ (default: _not set_)
1921
+ |title-page:
1922
+ subtitle:
1923
+ display: none
1924
+
1481
1925
  |font-color
1482
1926
  |<<colors,Color>> +
1483
1927
  (default: _inherit_)
@@ -1492,6 +1936,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1492
1936
  subtitle:
1493
1937
  font-family: Noto Serif
1494
1938
 
1939
+ |font-kerning
1940
+ |normal {vbar} none +
1941
+ (default: _inherit_)
1942
+ |title-page:
1943
+ subtitle:
1944
+ font-kerning: none
1945
+
1495
1946
  |font-size
1496
1947
  |<<values,Number>> +
1497
1948
  (default: 14)
@@ -1536,6 +1987,24 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1536
1987
 
1537
1988
  3+|[#key-prefix-authors]*Key Prefix:* <<key-prefix-authors,title-page-authors>>
1538
1989
 
1990
+ |content
1991
+ |<<quoted-string,Quoted AsciiDoc string>> +
1992
+ (optional subkeys: name_only, with_email, with_url) +
1993
+ (default: "\{author}")
1994
+ |title-page:
1995
+ authors:
1996
+ content:
1997
+ name_only: "{author}"
1998
+ with_email: "{author} <{email}>"
1999
+ with_url: "{url}[{author}]"
2000
+
2001
+ |display
2002
+ |none +
2003
+ (default: _not set_)
2004
+ |title-page:
2005
+ authors:
2006
+ display: none
2007
+
1539
2008
  |delimiter
1540
2009
  |<<quoted-string,Quoted string>> +
1541
2010
  (default: ', ')
@@ -1557,8 +2026,15 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1557
2026
  authors:
1558
2027
  font-family: Noto Serif
1559
2028
 
1560
- |font-size
1561
- |<<values,Number>> +
2029
+ |font-kerning
2030
+ |normal {vbar} none +
2031
+ (default: _inherit_)
2032
+ |title-page:
2033
+ authors:
2034
+ font-kerning: none
2035
+
2036
+ |font-size
2037
+ |<<values,Number>> +
1562
2038
  (default: _inherit_)
1563
2039
  |title-page:
1564
2040
  authors:
@@ -1594,6 +2070,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1594
2070
 
1595
2071
  3+|[#key-prefix-revision]*Key Prefix:* <<key-prefix-revision,title-page-revision>>
1596
2072
 
2073
+ |display
2074
+ |none +
2075
+ (default: _not set_)
2076
+ |title-page:
2077
+ revision:
2078
+ display: none
2079
+
1597
2080
  |delimiter
1598
2081
  |<<quoted-string,Quoted string>> +
1599
2082
  (default: ', ')
@@ -1615,6 +2098,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1615
2098
  revision:
1616
2099
  font-family: Noto Serif
1617
2100
 
2101
+ |font-kerning
2102
+ |normal {vbar} none +
2103
+ (default: _inherit_)
2104
+ |title-page:
2105
+ revision:
2106
+ font-kerning: none
2107
+
1618
2108
  |font-size
1619
2109
  |<<values,Number>> +
1620
2110
  (default: _inherit_)
@@ -1651,10 +2141,13 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
1651
2141
  margin-bottom: 5
1652
2142
  |===
1653
2143
 
1654
- . By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`).
1655
- The size of the background can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
2144
+ . To disable the background color for the title page, set the value to white (i.e., FFFFFF).
2145
+ The color keyword `transparent` is not recognized in this context.
2146
+ . By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
2147
+ The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width) when `fit=none`.
2148
+ The position of the background image can be controlled using the `position` attribute.
1656
2149
  . Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
1657
- . Percentage unit can be % (relative to content height) or vh (relative to page height).
2150
+ . % unit is relative to content height; vh unit is relative to page height.
1658
2151
 
1659
2152
  [#keys-prose]
1660
2153
  === Prose
@@ -1747,6 +2240,7 @@ Block styles are applied to the following block types:
1747
2240
  === Caption
1748
2241
 
1749
2242
  The keys in this category control the arrangement and style of block captions.
2243
+ In addition to the generic caption category, each of these keys can be set on the caption key nested inside the following block categories: blockquote, code, example, footnotes, image, listing, table, and verse.
1750
2244
 
1751
2245
  [cols="3,4,5l"]
1752
2246
  |===
@@ -1754,7 +2248,7 @@ The keys in this category control the arrangement and style of block captions.
1754
2248
 
1755
2249
  3+|[#key-prefix-caption]*Key Prefix:* <<key-prefix-caption,caption>>
1756
2250
 
1757
- |align
2251
+ |align^[1]^
1758
2252
  |<<text-alignments,Text alignment>> +
1759
2253
  (default: left)
1760
2254
  |caption:
@@ -1772,6 +2266,12 @@ The keys in this category control the arrangement and style of block captions.
1772
2266
  |caption:
1773
2267
  font-family: M+ 1mn
1774
2268
 
2269
+ |font-kerning
2270
+ |normal {vbar} none +
2271
+ (default: _inherit_)
2272
+ |caption:
2273
+ font-kerning: none
2274
+
1775
2275
  |font-size
1776
2276
  |<<values,Number>> +
1777
2277
  (default: _inherit_)
@@ -1803,6 +2303,9 @@ The keys in this category control the arrangement and style of block captions.
1803
2303
  margin-outside: 0
1804
2304
  |===
1805
2305
 
2306
+ . When nested inside the `image` key (i.e., `image-caption-align`), the value `inherit` is also accepted.
2307
+ The value `inherit` resolves to the alignment of the block image.
2308
+
1806
2309
  [#keys-code]
1807
2310
  === Code
1808
2311
 
@@ -1852,7 +2355,7 @@ The keys in this category are used to control the style of literal, listing and
1852
2355
 
1853
2356
  |font-size
1854
2357
  |<<values,Number>> +
1855
- (default: 10.5)
2358
+ (default: 10.8)
1856
2359
  |code:
1857
2360
  font-size: 11
1858
2361
 
@@ -1880,7 +2383,15 @@ The keys in this category are used to control the style of literal, listing and
1880
2383
  |code:
1881
2384
  padding: 11
1882
2385
 
1883
- 3+|[#key-prefix-table-cell]*Key Prefix:* <<key-prefix-code-linenum,code-linenum>>^[2]^
2386
+ 3+|[#key-prefix-code-highlight]*Key Prefix:* <<key-prefix-code-highlight,code-highlight>>^[2]^
2387
+
2388
+ |background-color
2389
+ |<<colors,Color>> +
2390
+ (default: #FFFFCC)
2391
+ |code:
2392
+ highlight-background-color: #ffff00
2393
+
2394
+ 3+|[#key-prefix-code-linenum]*Key Prefix:* <<key-prefix-code-linenum,code-linenum>>^[3]^
1884
2395
 
1885
2396
  |font-color
1886
2397
  |<<colors,Color>> +
@@ -1888,14 +2399,17 @@ The keys in this category are used to control the style of literal, listing and
1888
2399
  |code:
1889
2400
  linenum-font-color: #ccc
1890
2401
  |===
2402
+
1891
2403
  . The line-gap property is used to tune the height of the background color applied to a span of block text highlighted using Rouge.
2404
+ . The code-highlight category only applies when using Rouge as the source highlighter.
2405
+ Otherwise, the styles are controlled by the source highlighter theme.
1892
2406
  . The code-linenum category only applies when using Pygments as the source highlighter.
1893
- Otherwise, the style is controlled by the source highlighter theme.
2407
+ Otherwise, the styles are controlled by the source highlighter theme.
1894
2408
 
1895
2409
  [#keys-callout-numbers]
1896
2410
  === Callout Numbers
1897
2411
 
1898
- The keys in this category are used to control the style of callout numbers (conums) inside verbatim blocks and in callout lists (colists).
2412
+ The keys in this category are used to control the style of callout numbers (i.e., conums) inside verbatim blocks and in callout lists (colists).
1899
2413
 
1900
2414
  [cols="3,4,5l"]
1901
2415
  |===
@@ -1915,6 +2429,12 @@ The keys in this category are used to control the style of callout numbers (conu
1915
2429
  |conum:
1916
2430
  font-family: M+ 1mn
1917
2431
 
2432
+ |font-kerning^[2]^
2433
+ |normal {vbar} none +
2434
+ (default: _inherit_)
2435
+ |conum:
2436
+ font-kerning: none
2437
+
1918
2438
  |font-size^[2]^
1919
2439
  |<<values,Number>> +
1920
2440
  (default: _inherit_)
@@ -1932,11 +2452,173 @@ The keys in this category are used to control the style of callout numbers (conu
1932
2452
  (default: 1.15)
1933
2453
  |conum:
1934
2454
  line-height: 4 / 3
2455
+
2456
+ |glyphs^[2]^
2457
+ |circled {vbar} filled {vbar} Unicode String ranges +
2458
+ (default: circled)
2459
+ |conum:
2460
+ glyphs: \u0031-\u0039
1935
2461
  |===
1936
2462
 
1937
2463
  . Currently, the font must contain the circle numbers starting at glyph U+2460.
1938
- . font-family, font-size, font-style, and line-height are only used for markers in a colist.
2464
+ . font-family, font-kerning, font-size, font-style, and line-height are only used for markers in a colist.
1939
2465
  These properties are inherited for conums inside a verbatim block.
2466
+ . The font must provide the required glyphs.
2467
+ The glyphs can be specified as a comma-separated list of ranges, where the range values are Unicode numbers (e.g., \u2460).
2468
+
2469
+ [#keys-button]
2470
+ === Button
2471
+
2472
+ The keys in this category apply to a button reference (generated from the inline button macro).
2473
+
2474
+ [cols="3,4,5l"]
2475
+ |===
2476
+ |Key |Value Type |Example
2477
+
2478
+ 3+|[#key-prefix-button]*Key Prefix:* <<key-prefix-button,button>>
2479
+
2480
+ |background-color
2481
+ |<<colors,Color>> +
2482
+ (default: _not set_)
2483
+ |button:
2484
+ background-color: #0000ff
2485
+
2486
+ |border-color^[1]^
2487
+ |<<colors,Color>> +
2488
+ (default: _not set_)
2489
+ |button:
2490
+ border-color: #cccccc
2491
+
2492
+ |border-offset^[2]^
2493
+ |<<values,Number>> +
2494
+ (default: 0)
2495
+ |button:
2496
+ border-offset: 1.5
2497
+
2498
+ |border-radius
2499
+ |<<values,Number>> +
2500
+ (default: 0)
2501
+ |button:
2502
+ border-radius: 2
2503
+
2504
+ |border-width
2505
+ |<<values,Number>> +
2506
+ (default: $base-border-width)
2507
+ |button:
2508
+ border-width: 0.5
2509
+
2510
+ |content^[3]^
2511
+ |<<quoted-string,Quoted string>> +
2512
+ (default: "%s")
2513
+ |button:
2514
+ content: "[\u2009%s\u2009]"
2515
+
2516
+ |font-color
2517
+ |<<colors,Color>> +
2518
+ (default: _inherit_)
2519
+ |button:
2520
+ font-color: #ffffff
2521
+
2522
+ |font-family
2523
+ |<<fonts,Font family name>> +
2524
+ (default: Courier)
2525
+ |button:
2526
+ font-family: M+ 1mn
2527
+
2528
+ |font-size
2529
+ |<<values,Number>> +
2530
+ (default: _inherit_)
2531
+ |button:
2532
+ font-size: 12
2533
+
2534
+ |font-style
2535
+ |<<font-styles,Font style>> +
2536
+ (default: bold)
2537
+ |button:
2538
+ font-style: normal
2539
+ |===
2540
+
2541
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
2542
+ . The border offset is the amount that the background and border swells around the text.
2543
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
2544
+ . The character sequence `%s` in the content key gets replaced with the button label.
2545
+
2546
+ [#keys-key]
2547
+ === Key
2548
+
2549
+ The keys in this category apply to a key reference (generated from the inline kbd macro).
2550
+
2551
+ [cols="3,4,5l"]
2552
+ |===
2553
+ |Key |Value Type |Example
2554
+
2555
+ 3+|[#key-prefix-key]*Key Prefix:* <<key-prefix-key,key>>
2556
+
2557
+ |background-color
2558
+ |<<colors,Color>> +
2559
+ (default: _not set_)
2560
+ |key:
2561
+ background-color: #fafafa
2562
+
2563
+ |border-color^[1]^
2564
+ |<<colors,Color>> +
2565
+ (default: _not set_)
2566
+ |key:
2567
+ border-color: #cccccc
2568
+
2569
+ |border-offset^[2]^
2570
+ |<<values,Number>> +
2571
+ (default: 0)
2572
+ |key:
2573
+ border-offset: 1.5
2574
+
2575
+ |border-radius
2576
+ |<<values,Number>> +
2577
+ (default: 0)
2578
+ |key:
2579
+ border-radius: 2
2580
+
2581
+ |border-width
2582
+ |<<values,Number>> +
2583
+ (default: $base-border-width)
2584
+ |key:
2585
+ border-width: 0.375
2586
+
2587
+ |separator^[3]^
2588
+ |<<quoted-string,Quoted string>> +
2589
+ (default: "+")
2590
+ |key:
2591
+ separator: "\u2009+\u2009"
2592
+
2593
+ |font-color
2594
+ |<<colors,Color>> +
2595
+ (default: _inherit_)
2596
+ |key:
2597
+ font-color: #000
2598
+
2599
+ |font-family
2600
+ |<<fonts,Font family name>> +
2601
+ (default: Courier)
2602
+ |key:
2603
+ font-family: $base-font-family
2604
+
2605
+ |font-size
2606
+ |<<values,Number>> +
2607
+ (default: _inherit_)
2608
+ |key:
2609
+ font-size: 10.5
2610
+
2611
+ |font-style
2612
+ |<<font-styles,Font style>> +
2613
+ (default: italic)
2614
+ |key:
2615
+ font-style: normal
2616
+ |===
2617
+
2618
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
2619
+ . The border offset is the amount that the background and border swells around the text.
2620
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
2621
+ . The separator is only used for multi-key sequences.
1940
2622
 
1941
2623
  [#keys-menu]
1942
2624
  === Menu
@@ -1967,17 +2649,29 @@ The keys in this category control the arrangement and style of quote blocks.
1967
2649
 
1968
2650
  3+|[#key-prefix-blockquote]*Key Prefix:* <<key-prefix-blockquote,blockquote>>
1969
2651
 
2652
+ |background-color
2653
+ |<<colors,Color>> +
2654
+ (default: _not set_)
2655
+ |blockquote:
2656
+ background-color: #dddddd
2657
+
1970
2658
  |border-width^[1]^
1971
2659
  |<<values,Number>> +
2660
+ (default: 0)
2661
+ |blockquote:
2662
+ border-width: 0.5
2663
+
2664
+ |border-left-width^[1]^
2665
+ |<<values,Number>> +
1972
2666
  (default: 4)
1973
2667
  |blockquote:
1974
- border-width: 5
2668
+ border-left-width: 5
1975
2669
 
1976
2670
  |border-color^[1]^
1977
2671
  |<<colors,Color>> +
1978
2672
  (default: #eeeeee)
1979
2673
  |blockquote:
1980
- border-color: #eeeeee
2674
+ border-color: #dddddd
1981
2675
 
1982
2676
  |font-color
1983
2677
  |<<colors,Color>> +
@@ -1991,6 +2685,12 @@ The keys in this category control the arrangement and style of quote blocks.
1991
2685
  |blockquote:
1992
2686
  font-family: Noto Serif
1993
2687
 
2688
+ |font-kerning
2689
+ |normal {vbar} none +
2690
+ (default: _inherit_)
2691
+ |blockquote:
2692
+ font-kerning: none
2693
+
1994
2694
  |font-size
1995
2695
  |<<values,Number>> +
1996
2696
  (default: _inherit_)
@@ -2038,6 +2738,13 @@ The keys in this category control the arrangement and style of quote blocks.
2038
2738
  cite:
2039
2739
  font-family: Noto Serif
2040
2740
 
2741
+ |font-kerning
2742
+ |normal {vbar} none +
2743
+ (default: _inherit_)
2744
+ |blockquote:
2745
+ cite:
2746
+ font-kerning: none
2747
+
2041
2748
  |font-style
2042
2749
  |<<font-styles,Font style>> +
2043
2750
  (default: _inherit_)
@@ -2053,7 +2760,133 @@ The keys in this category control the arrangement and style of quote blocks.
2053
2760
  text-transform: uppercase
2054
2761
  |===
2055
2762
 
2056
- . Only applies to the left side.
2763
+ . If border-left-width is non-zero, the border is only applied to the left side.
2764
+ Otherwise, if border-width is non-zero, the border is drawn around the whole block.
2765
+
2766
+ [#keys-verse]
2767
+ === Verse
2768
+
2769
+ The keys in this category control the arrangement and style of verse blocks.
2770
+
2771
+ [cols="3,4,5l"]
2772
+ |===
2773
+ |Key |Value Type |Example
2774
+
2775
+ 3+|[#key-prefix-verse]*Key Prefix:* <<key-prefix-verse,verse>>
2776
+
2777
+ |background-color
2778
+ |<<colors,Color>> +
2779
+ (default: _not set_)
2780
+ |verse:
2781
+ background-color: #dddddd
2782
+
2783
+ |border-width^[1]^
2784
+ |<<values,Number>> +
2785
+ (default: 0)
2786
+ |verse:
2787
+ border-width: 0.5
2788
+
2789
+ |border-left-width^[1]^
2790
+ |<<values,Number>> +
2791
+ (default: 4)
2792
+ |verse:
2793
+ border-left-width: 5
2794
+
2795
+ |border-color^[1]^
2796
+ |<<colors,Color>> +
2797
+ (default: #eeeeee)
2798
+ |verse:
2799
+ border-color: #dddddd
2800
+
2801
+ |font-color
2802
+ |<<colors,Color>> +
2803
+ (default: _inherit_)
2804
+ |verse:
2805
+ font-color: #333333
2806
+
2807
+ |font-family
2808
+ |<<fonts,Font family name>> +
2809
+ (default: _inherit_)
2810
+ |verse:
2811
+ font-family: M+ 1mn
2812
+
2813
+ |font-kerning
2814
+ |normal {vbar} none +
2815
+ (default: _inherit_)
2816
+ |verse:
2817
+ font-kerning: none
2818
+
2819
+ |font-size
2820
+ |<<values,Number>> +
2821
+ (default: _inherit_)
2822
+ |verse:
2823
+ font-size: 10
2824
+
2825
+ |font-style
2826
+ |<<font-styles,Font style>> +
2827
+ (default: _inherit_)
2828
+ |verse:
2829
+ font-style: bold
2830
+
2831
+ |text-transform
2832
+ |<<text-transforms,Text transform>> +
2833
+ (default: _inherit_)
2834
+ |verse:
2835
+ text-transform: uppercase
2836
+
2837
+ |padding
2838
+ |<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
2839
+ (default: [6, 12, -6, 14])
2840
+ |verse:
2841
+ padding: [5, 10, -5, 12]
2842
+
2843
+ 3+|[#key-prefix-verse-cite]*Key Prefix:* <<key-prefix-verse-cite,verse-cite>>
2844
+
2845
+ |font-size
2846
+ |<<values,Number>> +
2847
+ (default: _inherit_)
2848
+ |verse:
2849
+ cite:
2850
+ font-size: 9
2851
+
2852
+ |font-color
2853
+ |<<colors,Color>> +
2854
+ (default: _inherit_)
2855
+ |verse:
2856
+ cite:
2857
+ font-color: #999999
2858
+
2859
+ |font-family
2860
+ |<<fonts,Font family name>> +
2861
+ (default: _inherit_)
2862
+ |verse:
2863
+ cite:
2864
+ font-family: Noto Serif
2865
+
2866
+ |font-kerning
2867
+ |normal {vbar} none +
2868
+ (default: _inherit_)
2869
+ |verse:
2870
+ cite:
2871
+ font-kerning: none
2872
+
2873
+ |font-style
2874
+ |<<font-styles,Font style>> +
2875
+ (default: _inherit_)
2876
+ |verse:
2877
+ cite:
2878
+ font-style: italic
2879
+
2880
+ |text-transform
2881
+ |<<text-transforms,Text transform>> +
2882
+ (default: _inherit_)
2883
+ |verse:
2884
+ cite:
2885
+ text-transform: uppercase
2886
+ |===
2887
+
2888
+ . If border-left-width is non-zero, the border is only applied to the left side.
2889
+ Otherwise, if border-width is non-zero, the border is drawn around the whole block.
2057
2890
 
2058
2891
  [#keys-sidebar]
2059
2892
  === Sidebar
@@ -2102,6 +2935,12 @@ The keys in this category control the arrangement and style of sidebar blocks.
2102
2935
  |sidebar:
2103
2936
  font-family: M+ 1p
2104
2937
 
2938
+ |font-kerning
2939
+ |normal {vbar} none +
2940
+ (default: _inherit_)
2941
+ |sidebar:
2942
+ font-kerning: none
2943
+
2105
2944
  |font-size
2106
2945
  |<<values,Number>> +
2107
2946
  (default: _inherit_)
@@ -2149,6 +2988,13 @@ The keys in this category control the arrangement and style of sidebar blocks.
2149
2988
  title:
2150
2989
  font-family: Noto Serif
2151
2990
 
2991
+ |font-kerning
2992
+ |normal {vbar} none +
2993
+ (default: _inherit_)
2994
+ |sidebar:
2995
+ title:
2996
+ font-kerning: none
2997
+
2152
2998
  |font-size
2153
2999
  |<<values,Number>> +
2154
3000
  (default: _inherit_)
@@ -2218,6 +3064,12 @@ The keys in this category control the arrangement and style of example blocks.
2218
3064
  |example:
2219
3065
  font-family: M+ 1p
2220
3066
 
3067
+ |font-kerning
3068
+ |normal {vbar} none +
3069
+ (default: _inherit_)
3070
+ |example:
3071
+ font-kerning: none
3072
+
2221
3073
  |font-size
2222
3074
  |<<values,Number>> +
2223
3075
  (default: _inherit_)
@@ -2284,6 +3136,12 @@ The keys in this category control the arrangement and style of admonition blocks
2284
3136
  |admonition:
2285
3137
  font-family: Noto Sans
2286
3138
 
3139
+ |font-kerning
3140
+ |normal {vbar} none +
3141
+ (default: _inherit_)
3142
+ |admonition:
3143
+ font-kerning: none
3144
+
2287
3145
  |font-size
2288
3146
  |<<values,Number>> +
2289
3147
  (default: _inherit_)
@@ -2353,6 +3211,13 @@ The keys in this category control the arrangement and style of admonition blocks
2353
3211
  label:
2354
3212
  font-family: M+ 1p
2355
3213
 
3214
+ |font-kerning
3215
+ |normal {vbar} none +
3216
+ (default: _inherit_)
3217
+ |admonition:
3218
+ label:
3219
+ font-kerning: none
3220
+
2356
3221
  |font-size
2357
3222
  |<<values,Number>> +
2358
3223
  (default: _inherit_)
@@ -2374,7 +3239,7 @@ The keys in this category control the arrangement and style of admonition blocks
2374
3239
  label:
2375
3240
  text-transform: lowercase
2376
3241
 
2377
- 3+|[#key-prefix-admonition-icon]*Key Prefix:* <<key-prefix-admonition-icon,admonition-icon-<name> >>^[2]^
3242
+ 3+|[#key-prefix-admonition-icon]*Key Prefix:* <<key-prefix-admonition-icon,admonition-icon-<name>{zwsp}>>^[2]^
2378
3243
 
2379
3244
  |name
2380
3245
  |<icon set>-<icon name>^[3]^ +
@@ -2403,10 +3268,13 @@ The keys in this category control the arrangement and style of admonition blocks
2403
3268
 
2404
3269
  . The top and bottom padding values are ignored on admonition-label-padding.
2405
3270
  . `<name>` can be `note`, `tip`, `warning`, `important`, or `caution`.
3271
+ All icon types must be grouped under a single `icons` category.
3272
+ In other words, _do not_ declare the `icons` category multiple times.
2406
3273
  The subkeys in the icon category cannot be flattened (e.g., `tip-name: far-lightbulb` is not valid syntax).
2407
3274
  . Required.
2408
3275
  See the `.yml` files in the https://github.com/jessedoyle/prawn-icon/tree/master/data/fonts[prawn-icon repository] for a list of valid icon names.
2409
3276
  The prefix (e.g., `fas-`) determines which font set to use.
3277
+ If the prefix is not specified, `fa-` is assumed.
2410
3278
 
2411
3279
  [#keys-image]
2412
3280
  === Image
@@ -2425,15 +3293,122 @@ The keys in this category control the arrangement of block images.
2425
3293
  |image:
2426
3294
  align: left
2427
3295
 
2428
- |width^[1]^
2429
- |<<measurement-units,Measurement>> +
2430
- (default: _not set_)
2431
- |image:
2432
- width: 100%
3296
+ |width^[1]^
3297
+ |<<measurement-units,Measurement>> +
3298
+ (default: _not set_)
3299
+ |image:
3300
+ width: 100%
3301
+
3302
+ |border-color^[2]^
3303
+ |<<colors,Color>> +
3304
+ (default: _not set_)
3305
+ |image:
3306
+ border-color: #cccccc
3307
+
3308
+ |border-radius
3309
+ |<<values,Number>> +
3310
+ (default: _not set_)
3311
+ |image:
3312
+ border-radius: 2
3313
+
3314
+ |border-width^[2]^
3315
+ |<<values,Number>> +
3316
+ (default: _not set_)
3317
+ |image:
3318
+ border-width: 0.5
3319
+
3320
+ |border-fit^[3]^
3321
+ |content {vbar} auto
3322
+ (default: content)
3323
+ |image:
3324
+ border-fit: auto
3325
+
3326
+ 3+|[#key-prefix-image-alt]*Key Prefix:* <<key-prefix-image-alt,image-alt>>
3327
+
3328
+ |content^[4]^
3329
+ |<<quoted-string,Quoted string>> +
3330
+ (default: "%\{link}[%\{alt}]%{/link} {vbar} %\{target}")
3331
+ |image:
3332
+ alt:
3333
+ content: "%{alt} (%{target})"
3334
+
3335
+ |font-color
3336
+ |<<colors,Color>> +
3337
+ (default: _inherit_)
3338
+ |image:
3339
+ alt:
3340
+ font-color: #ff000
3341
+
3342
+ |font-family
3343
+ |<<fonts,Font family name>> +
3344
+ (default: _inherit_)
3345
+ |image
3346
+ alt:
3347
+ font-family: Courier
3348
+
3349
+ |font-kerning
3350
+ |normal {vbar} none +
3351
+ (default: _inherit_)
3352
+ |image:
3353
+ alt:
3354
+ font-kerning: none
3355
+
3356
+ |font-size
3357
+ |<<values,Number>> +
3358
+ (default: _inherit_)
3359
+ |image:
3360
+ alt:
3361
+ font-size: 9
3362
+
3363
+ |font-style
3364
+ |<<font-styles,Font style>> +
3365
+ (default: normal)
3366
+ |iamge:
3367
+ alt:
3368
+ font-style: italic
3369
+
3370
+ |caption-align
3371
+ |<<text-alignments,Text alignment>> {vbar} inherit +
3372
+ (default: $caption-align)
3373
+ |image:
3374
+ caption:
3375
+ align: inherit
3376
+
3377
+ |caption-max-width^[5]^
3378
+ |fit-content {vbar} none {vbar} <<measurement-units,Measurement>> +
3379
+ (default: none)
3380
+ |image:
3381
+ caption:
3382
+ max-width: fit-content
3383
+ |===
3384
+
3385
+ . Only applies to block images.
3386
+ If specified, this value takes precedence over the value of the `width` attribute on the image macro, but not over the value of the `pdfwidth` attribute.
3387
+ . The border is only used if a border color is specified, the border width is specified, the border width is greater than 0, and the `noborder` role is not present.
3388
+ The border is drawn above the image on the inside of the box reserved for the image.
3389
+ . The value `auto` means the border should expand to fit the width of the container (i.e., full width) instead of the image.
3390
+ . Use the placeholders `%\{alt}`, `%\{target}`, `%\{link}`, and `%{/link}` to insert the alt text, image target, and link open/close tags into the content template.
3391
+ . In order for the image to be sized correctly when max-width is fit-content, a width should always be specified on the image.
3392
+
3393
+ [#keys-svg]
3394
+ === SVG
3395
+
3396
+ The keys in this category control the SVG integration.
3397
+
3398
+ [cols="3,4,5l"]
3399
+ |===
3400
+ |Key |Value Type |Example
3401
+
3402
+ 3+|[#key-prefix-image]*Key Prefix:* <<key-prefix-svg,svg>>
3403
+
3404
+ |fallback_font_family^[1]^
3405
+ |<<fonts,Font family name>> +
3406
+ (default: $base-font-family)
3407
+ |svg:
3408
+ fallback_font_family: Times-Roman
2433
3409
  |===
2434
3410
 
2435
- . Only applies to block images.
2436
- If specified, this value takes precedence over the value of the `width` attribute on the image macro, but not over the value of the `pdfwidth` attribute.
3411
+ . The fallback font family is only used when the font family in the SVG does not map to a known font name from the font catalog.
2437
3412
 
2438
3413
  [#keys-lead]
2439
3414
  === Lead
@@ -2458,6 +3433,12 @@ The keys in this category control the styling of lead paragraphs.
2458
3433
  |lead:
2459
3434
  font-family: M+ 1p
2460
3435
 
3436
+ |font-kerning
3437
+ |normal {vbar} none +
3438
+ (default: _inherit_)
3439
+ |lead:
3440
+ font-kerning: none
3441
+
2461
3442
  |font-size
2462
3443
  |<<values,Number>> +
2463
3444
  (default: 13.5)
@@ -2553,6 +3534,13 @@ The keys in this category control the arrangement and style of the abstract.
2553
3534
  title:
2554
3535
  font-family: Noto Serif
2555
3536
 
3537
+ |font-kerning
3538
+ |normal {vbar} none +
3539
+ (default: _inherit_)
3540
+ |abstract:
3541
+ title:
3542
+ font-kerning: none
3543
+
2556
3544
  |font-size
2557
3545
  |<<values,Number>> +
2558
3546
  (default: $base-font-size)
@@ -2622,18 +3610,72 @@ The keys in this category control the style of thematic breaks (aka horizontal r
2622
3610
 
2623
3611
  The keys in this category control the arrangement and style of definition list items (terms and descriptions).
2624
3612
 
3613
+ [TIP]
3614
+ ====
3615
+ Asciidoctor PDF supports unordered and ordered description lists.
3616
+ These are defined as a description list, but get displayed as an unordered or ordered description list with the term as a subject.
3617
+ Only one term is supported.
3618
+ The subject is shown using the term font style (bold by default).
3619
+ The subject is stacked above the description if the "stack" role is present.
3620
+ Otherwise, the subject is arranged as a run-in followed by a subject stop (`:` by default).
3621
+ The subject stop can be customized using the `subject-stop` attribute.
3622
+
3623
+ [source,asciidoc]
3624
+ ----
3625
+ [unordered]
3626
+ * alpha:: partially complete and unstable
3627
+ * beta:: feature complete and undergoing testing
3628
+ ----
3629
+ ====
3630
+
2625
3631
  [cols="3,4,5l"]
2626
3632
  |===
2627
3633
  |Key |Value Type |Example
2628
3634
 
2629
3635
  3+|[#key-prefix-description-list]*Key Prefix:* <<key-prefix-description-list,description-list>>
2630
3636
 
3637
+ |term-font-color
3638
+ |<<colors,Color>> +
3639
+ (default: _inherit_)
3640
+ |description-list:
3641
+ term-font-color: #AA0000
3642
+
3643
+ |term-font-family
3644
+ |<<fonts,Font family name>> +
3645
+ (default: _inherit_)
3646
+ |description-list:
3647
+ term-font-family: Noto Serif
3648
+
3649
+ |term-font-kerning
3650
+ |normal {vbar} none +
3651
+ (default: _inherit_)
3652
+ |description-list:
3653
+ term-font-kerning: none
3654
+
3655
+ |term-font-size
3656
+ |<<values,Number>> +
3657
+ (default: _inherit_)
3658
+ |description-list:
3659
+ term-font-size: 12
3660
+
2631
3661
  |term-font-style
2632
3662
  |<<font-styles,Font style>> +
2633
3663
  (default: bold)
2634
3664
  |description-list:
2635
3665
  term-font-style: italic
2636
3666
 
3667
+ |term-text-transform
3668
+ |<<text-transforms,Text transform>> +
3669
+ (default: none)
3670
+ |description-list:
3671
+ term-text-transform: none
3672
+
3673
+ |term-line-height
3674
+ |<<values,Number>> +
3675
+ (default: $base-line-height)
3676
+ |description-list:
3677
+ term-line-height: 1.2
3678
+
2637
3679
  |term-spacing
2638
3680
  |<<measurement-units,Measurement>> +
2639
3681
  (default: 4)
@@ -2730,7 +3772,7 @@ The keys in this category control the arrangement and style of unordered list it
2730
3772
  |===
2731
3773
  |Key |Value Type |Example
2732
3774
 
2733
- 3+|*Key Prefix:* ulist-marker-<type>^[1]^
3775
+ 3+|[#key-prefix-ulist-marker-type]*Key Prefix:* <<key-prefix-ulist-marker-type,ulist-marker-<type>{zwsp}>>^[1]^
2734
3776
 
2735
3777
  |content
2736
3778
  |<<quoted-string,Quoted string>>
@@ -2809,6 +3851,12 @@ The keys in this category control the arrangement and style of tables and table
2809
3851
  |table:
2810
3852
  border-width: 0.5
2811
3853
 
3854
+ |caption-align
3855
+ |<<text-alignments,Text alignment>> {vbar} inherit +
3856
+ (default: $caption-align)
3857
+ |table:
3858
+ caption-align: inherit
3859
+
2812
3860
  |caption-side
2813
3861
  |top {vbar} bottom +
2814
3862
  (default: top)
@@ -2816,7 +3864,7 @@ The keys in this category control the arrangement and style of tables and table
2816
3864
  caption-side: bottom
2817
3865
 
2818
3866
  |caption-max-width
2819
- |fit-content {vbar} none +
3867
+ |fit-content {vbar} none {vbar} <<measurement-units,Measurement>> +
2820
3868
  (default: fit-content)
2821
3869
  |table:
2822
3870
  caption-max-width: none
@@ -2833,6 +3881,12 @@ The keys in this category control the arrangement and style of tables and table
2833
3881
  |table:
2834
3882
  font-family: Helvetica
2835
3883
 
3884
+ |font-kerning
3885
+ |normal {vbar} none +
3886
+ (default: _inherit_)
3887
+ |table:
3888
+ font-kerning: none
3889
+
2836
3890
  |font-size
2837
3891
  |<<values,Number>> +
2838
3892
  (default: _inherit_)
@@ -2914,6 +3968,13 @@ The keys in this category control the arrangement and style of tables and table
2914
3968
  head:
2915
3969
  font-family: Noto Serif
2916
3970
 
3971
+ |font-kerning
3972
+ |normal {vbar} none +
3973
+ (default: _inherit_)
3974
+ |table:
3975
+ head:
3976
+ font-kerning: none
3977
+
2917
3978
  |font-size
2918
3979
  |<<values,Number>> +
2919
3980
  (default: $table-font-size)
@@ -3048,6 +4109,7 @@ The keys in this category control the arrangement and style of tables and table
3048
4109
  header-cell:
3049
4110
  text-transform: uppercase
3050
4111
  |===
4112
+
3051
4113
  . This key only controls the color that is used for stripes.
3052
4114
  The appearance of stripes is controlled using the `stripes` table attribute, the `table-stripes` document attribute (since Asciidoctor 2), or the `stripes` document attribute (prior to Asciidoctor 2).
3053
4115
  Permitted attribute values are even, odd, all, and none.
@@ -3057,7 +4119,7 @@ Since Asciidoctor 2, table stripes are not enabled by default (e.g., `stripes=no
3057
4119
  [#keys-footnotes]
3058
4120
  === Footnotes
3059
4121
 
3060
- The keys in this catagory control the style the list of footnotes at the end of the chapter (book) or document (otherwise).
4122
+ The keys in this catagory control the style of the footnotes list at the end of the chapter (book) or document (otherwise).
3061
4123
  If the `footnotes-title` attribute is specified, it is styled as a block caption.
3062
4124
  The styling of the links is controlled by the global link styles.
3063
4125
 
@@ -3075,9 +4137,9 @@ The styling of the links is controlled by the global link styles.
3075
4137
 
3076
4138
  |font-size
3077
4139
  |<<values,Number>> +
3078
- (default: 8)
4140
+ (default: 9)
3079
4141
  |footnotes:
3080
- font-size: 6
4142
+ font-size: 8
3081
4143
 
3082
4144
  |font-style
3083
4145
  |<<font-styles,Font style>> +
@@ -3127,6 +4189,12 @@ The keys in this category control the arrangement and style of the table of cont
3127
4189
  |toc:
3128
4190
  font-family: Noto Serif
3129
4191
 
4192
+ |font-kerning
4193
+ |normal {vbar} none +
4194
+ (default: _inherit_)
4195
+ |toc:
4196
+ font-kerning: none
4197
+
3130
4198
  |font-size
3131
4199
  |<<values,Number>> +
3132
4200
  (default: _inherit_)
@@ -3141,11 +4209,23 @@ The keys in this category control the arrangement and style of the table of cont
3141
4209
  font-style: bold
3142
4210
 
3143
4211
  |text-decoration
3144
- |none {vbar} underline +
4212
+ |<<text-decorations,Text decoration>> +
3145
4213
  (default: none)
3146
4214
  |toc:
3147
4215
  text-decoration: underline
3148
4216
 
4217
+ |text-decoration-color
4218
+ |<<colors,Color>> +
4219
+ (default: $toc-font-color)
4220
+ |toc
4221
+ text-decoration-color: #cccccc
4222
+
4223
+ |text-decoration-width
4224
+ |<<values,Number>> +
4225
+ (default: 1)
4226
+ |toc:
4227
+ text-decoration-width: 0.5
4228
+
3149
4229
  |text-transform
3150
4230
  |<<text-transforms,Text transform>> +
3151
4231
  (default: _inherit_)
@@ -3164,13 +4244,19 @@ The keys in this category control the arrangement and style of the table of cont
3164
4244
  |toc:
3165
4245
  indent: 20
3166
4246
 
4247
+ |hanging-indent
4248
+ |<<measurement-units,Measurement>> +
4249
+ (default: _not set_)
4250
+ |toc:
4251
+ hanging-indent: 0.5in
4252
+
3167
4253
  |margin-top
3168
4254
  |<<measurement-units,Measurement>> +
3169
4255
  (default: 0)
3170
4256
  |toc:
3171
4257
  margin-top: 0
3172
4258
 
3173
- 3+|[#key-prefix-toc-level]*Key Prefix:* <<key-prefix-toc-level,toc-h<n> >>^[1]^
4259
+ 3+|[#key-prefix-toc-level]*Key Prefix:* <<key-prefix-toc-level,toc-h<n>{zwsp}>>^[1]^
3174
4260
 
3175
4261
  |font-color
3176
4262
  |<<colors,Color>> +
@@ -3182,31 +4268,31 @@ The keys in this category control the arrangement and style of the table of cont
3182
4268
  |<<fonts,Font family name>> +
3183
4269
  (default: _inherit_)
3184
4270
  |toc:
3185
- font-family: Noto Serif
4271
+ h2-font-family: Noto Serif
4272
+
4273
+ |font-kerning
4274
+ |normal {vbar} none +
4275
+ (default: _inherit_)
4276
+ |toc:
4277
+ h3-font-kerning: none
3186
4278
 
3187
4279
  |font-size
3188
4280
  |<<values,Number>> +
3189
4281
  (default: _inherit_)
3190
4282
  |toc:
3191
- font-size: 9
4283
+ h3-font-size: 9
3192
4284
 
3193
4285
  |font-style
3194
4286
  |<<font-styles,Font style>> +
3195
4287
  (default: _inherit_)
3196
4288
  |toc:
3197
- font-style: italic
3198
-
3199
- |text-decoration
3200
- |none {vbar} underline +
3201
- (default: _inherit_)
3202
- |toc:
3203
- text-decoration: none
4289
+ h2-font-style: italic
3204
4290
 
3205
4291
  |text-transform
3206
4292
  |<<text-transforms,Text transform>> +
3207
4293
  (default: _inherit_)
3208
4294
  |toc:
3209
- text-transform: uppercase
4295
+ h3-text-transform: uppercase
3210
4296
 
3211
4297
  3+|[#key-prefix-toc-title]*Key Prefix:* <<key-prefix-toc-title,toc-title>>
3212
4298
 
@@ -3231,6 +4317,13 @@ The keys in this category control the arrangement and style of the table of cont
3231
4317
  title:
3232
4318
  font-family: Noto Serif
3233
4319
 
4320
+ |font-kerning
4321
+ |normal {vbar} none +
4322
+ (default: _inherit_)
4323
+ |toc:
4324
+ title:
4325
+ font-kerning: none
4326
+
3234
4327
  |font-size
3235
4328
  |<<values,Number>> +
3236
4329
  (default: $heading-h2-font-size)
@@ -3302,14 +4395,6 @@ To avoid this problem, reduce the height of the running content periphery or mak
3302
4395
  |===
3303
4396
  |Key |Value Type |Example
3304
4397
 
3305
- 3+|[#key-prefix-running-content]*Key Prefix:* <<key-prefix-running-content,running-content>>
3306
-
3307
- |start-at
3308
- |title {vbar} toc {vbar} body +
3309
- (default: body)
3310
- |running-content:
3311
- start-at: toc
3312
-
3313
4398
  3+|[#key-prefix-header]*Key Prefix:* <<key-prefix-header,header>>
3314
4399
 
3315
4400
  |background-color^[1]^
@@ -3318,6 +4403,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3318
4403
  |header:
3319
4404
  background-color: #eeeeee
3320
4405
 
4406
+ |background-image
4407
+ |image macro +
4408
+ (default: _not set_)
4409
+ |header:
4410
+ background-image: image:running-content.svg[fit=contain]
4411
+
3321
4412
  |border-color
3322
4413
  |<<colors,Color>> +
3323
4414
  (default: _not set_)
@@ -3348,6 +4439,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3348
4439
  |header:
3349
4440
  font-family: Noto Serif
3350
4441
 
4442
+ |font-kerning
4443
+ |normal {vbar} none +
4444
+ (default: _inherit_)
4445
+ |header:
4446
+ font-kerning: none
4447
+
3351
4448
  |font-size
3352
4449
  |<<values,Number>> +
3353
4450
  (default: _inherit_)
@@ -3384,7 +4481,7 @@ To avoid this problem, reduce the height of the running content periphery or mak
3384
4481
  |header:
3385
4482
  image-vertical-align: 4
3386
4483
 
3387
- |sectlevels
4484
+ |sectlevels^[4]^
3388
4485
  |Integer +
3389
4486
  (default: 2)
3390
4487
  |header:
@@ -3396,20 +4493,26 @@ To avoid this problem, reduce the height of the running content periphery or mak
3396
4493
  |header:
3397
4494
  text-transform: uppercase
3398
4495
 
4496
+ |title-style
4497
+ |document {vbar} toc {vbar} basic +
4498
+ (default: document)
4499
+ |header:
4500
+ title-style: toc
4501
+
3399
4502
  |vertical-align
3400
- |top {vbar} middle {vbar} bottom +
4503
+ |top {vbar} middle {vbar} bottom {vbar} [top {vbar} middle {vbar} bottom, <<measurement-units,Measurement>>] +
3401
4504
  (default: middle)
3402
4505
  |header:
3403
- vertical-align: center
4506
+ vertical-align: middle
3404
4507
 
3405
- |<side>-columns^[4]^
4508
+ |<side>-columns^[5]^
3406
4509
  |Column specs triple +
3407
4510
  (default: _not set_)
3408
4511
  |header:
3409
4512
  recto:
3410
4513
  columns: <25% =50% >25%
3411
4514
 
3412
- |<side>-<position>-content^[4,5]^
4515
+ |<side>-<position>-content^[5,6]^
3413
4516
  |<<quoted-string,Quoted string>> +
3414
4517
  (default: '\{page-number}')
3415
4518
  |header:
@@ -3425,6 +4528,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3425
4528
  |footer:
3426
4529
  background-color: #eeeeee
3427
4530
 
4531
+ |background-image
4532
+ |image macro +
4533
+ (default: _not set_)
4534
+ |footer:
4535
+ background-image: image:running-content.svg[fit=contain]
4536
+
3428
4537
  |border-color
3429
4538
  |<<colors,Color>> +
3430
4539
  (default: _not set_)
@@ -3455,6 +4564,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3455
4564
  |footer:
3456
4565
  font-family: Noto Serif
3457
4566
 
4567
+ |font-kerning
4568
+ |normal {vbar} none +
4569
+ (default: _inherit_)
4570
+ |footer:
4571
+ font-kerning: none
4572
+
3458
4573
  |font-size
3459
4574
  |<<values,Number>> +
3460
4575
  (default: _inherit_)
@@ -3491,7 +4606,7 @@ To avoid this problem, reduce the height of the running content periphery or mak
3491
4606
  |footer:
3492
4607
  image-vertical-align: 4
3493
4608
 
3494
- |sectlevels
4609
+ |sectlevels^[4]^
3495
4610
  |Integer +
3496
4611
  (default: 2)
3497
4612
  |footer:
@@ -3503,43 +4618,114 @@ To avoid this problem, reduce the height of the running content periphery or mak
3503
4618
  |footer:
3504
4619
  text-transform: uppercase
3505
4620
 
4621
+ |title-style
4622
+ |document {vbar} toc {vbar} basic +
4623
+ (default: document)
4624
+ |footer:
4625
+ title-style: toc
4626
+
3506
4627
  |vertical-align
3507
- |top {vbar} middle {vbar} bottom +
4628
+ |top {vbar} middle {vbar} bottom {vbar} [top {vbar} middle {vbar} bottom, <<measurement-units,Measurement>>] +
3508
4629
  (default: middle)
3509
4630
  |footer:
3510
4631
  vertical-align: top
3511
4632
 
3512
- |<side>-columns^[4]^
4633
+ |<side>-columns^[5]^
3513
4634
  |Column specs triple +
3514
4635
  (default: _not set_)
3515
4636
  |footer:
3516
4637
  verso:
3517
4638
  columns: <50% =0% <50%
3518
4639
 
3519
- |<side>-<position>-content^[4,5]^
4640
+ |<side>-<position>-content^[5,6]^
3520
4641
  |<<quoted-string,Quoted string>> +
3521
4642
  (default: '\{page-number}')
3522
4643
  |footer:
3523
4644
  verso:
3524
4645
  center:
3525
4646
  content: '\{page-number}'
4647
+
4648
+ 3+|[#key-prefix-running-content]*Key Prefix:* <<key-prefix-running-content,running-content>>
4649
+
4650
+ |start-at^[7]^
4651
+ |title {vbar} toc {vbar} body {vbar} Integer +
4652
+ (default: body)
4653
+ |running-content:
4654
+ start-at: toc
3526
4655
  |===
4656
+
3527
4657
  . The background color spans the width of the page, as does the border when a background color is specified.
3528
4658
  . *If the height is not set, the running content at this periphery is disabled.*
3529
4659
  . If the side padding is negative, the content will bleed into the margin of the page.
4660
+ . The maximum section level considered when assigning the implicit `section-title` attribute (and related) available to the running content.
3530
4661
  . `<side>` can be `recto` (right-hand, odd-numbered pages) or `verso` (left-hand, even-numbered pages).
4662
+ The `columns` key can also be defined one level up (on `header` or `footer`), in which case the setting will be inherited.
3531
4663
  Where the page sides fall in relation to the physical or printed page number is controlled using the `pdf-folio-placement` attribute (except when `media=prepress`, which implies `physical`).
3532
4664
  . `<position>` can be `left`, `center` or `right`.
4665
+ . The `toc` value only applies if the toc is in the default location (before the first page of the body).
4666
+ If the toc macro is used to position the toc, the start-at behavior is the same as if the toc is not enabled.
4667
+ If value is an integer, the running content will start at the specified page of the body (i.e., 1 is first page, 2 is second page, etc.)
3533
4668
 
3534
4669
  IMPORTANT: If you don't specify a height for either the header or footer key, it effectively disables the content at that periphery.
3535
4670
 
4671
+ TIP: Although not listed in the table above, you can control the font settings (font-family, font-size, font-color, font-style, text-transform) that get applied to the running content in each column position for each page side (e.g., `footer-<side>-<position>-font-color`).
4672
+ For example, you can set the font color used for the right-hand column on recto pages by setting `footer-recto-right-font-color: 6CC644`.
4673
+
4674
+ ==== Disabling
4675
+
3536
4676
  If you define running header and footer content in your theme (including the height), you can still disable this content per document by setting the `noheader` and `nofooter` attributes in the AsciiDoc document header, respectively.
3537
4677
 
3538
- If content is not specified for the running footer, the page number (i.e., `\{page-number}`) is shown on the left on verso pages and the right on recto pages.
3539
- You can disable this behavior by defining the attribute `nofooter` in the AsciiDoc document header or by defining the key `footer-<side>-content: none` in the theme.
4678
+ If you extend either the base or default theme, and don't specify content for the footer, the current page number will be added to the right side on recto pages and the left side on verso pages.
4679
+ To disable this behavior, you can use the following snippet:
3540
4680
 
3541
- TIP: Although not listed in the table above, you can control the font settings (font-family, font-size, font-color, font-style, text-transform) that get applied to the running content in each column position for each page side (e.g., `footer-<side>-<position>-font-color`).
3542
- For example, you can set the font color used for the right-hand column on recto pages by setting `footer-recto-right-font-color: 6CC644`.
4681
+ [source,yaml]
4682
+ ----
4683
+ extends: default
4684
+ footer:
4685
+ recto:
4686
+ right:
4687
+ content: ~
4688
+ verso:
4689
+ left:
4690
+ content: ~
4691
+ ----
4692
+
4693
+ Instead of erasing the content (which is what the `~` does), you can specify content of your choosing.
4694
+
4695
+ ==== Replacing
4696
+
4697
+ If you want to replace the alternating page numbers with a centered page number, then you can restrict the footer to a single column and specify the content for the center position.
4698
+
4699
+ [source,yaml]
4700
+ ----
4701
+ extends: default
4702
+ footer:
4703
+ columns: =100%
4704
+ recto:
4705
+ center:
4706
+ content: '{page-number}'
4707
+ verso:
4708
+ center:
4709
+ content: '{page-number}'
4710
+ ----
4711
+
4712
+ In the last two examples, the recto and verso both have the same content.
4713
+ In this case, you can reduce the amount of configuring using a YAML reference.
4714
+ For example:
4715
+
4716
+ [source,yaml]
4717
+ ----
4718
+ extends: default
4719
+ footer:
4720
+ columns: =100%
4721
+ recto: &shared_footer
4722
+ center:
4723
+ content: '{page-number}'
4724
+ verso: *shared_footer
4725
+ ----
4726
+
4727
+ The `&shared_footer` assigns an ID to the YAML subtree under the `recto` key and the `*shared_footer` outputs a copy of it under the `verso` key.
4728
+ This technique can be used thoughout the theme file as it's a core feature of YAML.
3543
4729
 
3544
4730
  ==== Attribute References
3545
4731
 
@@ -3547,7 +4733,7 @@ You can use _any_ attribute defined in your AsciiDoc document (such as `doctitle
3547
4733
  In addition, the following attributes are also available when defining the content keys in the footer:
3548
4734
 
3549
4735
  * page-count
3550
- * page-number
4736
+ * page-number (only set if the `pagenums` attribute is set on the document, which it is by default)
3551
4737
  * document-title
3552
4738
  * document-subtitle
3553
4739
  * part-title
@@ -3555,7 +4741,12 @@ In addition, the following attributes are also available when defining the conte
3555
4741
  * section-title
3556
4742
  * section-or-chapter-title
3557
4743
 
3558
- You can also built-in AsciiDoc text replacements like `+(C)+`, numeric character references like `+&#169;+` and inline formatting (e.g., bold, italic, monospace).
4744
+ If you reference an attribute which is not defined, all the text on that same line in the running content will be dropped.
4745
+ This feature allows you to have alternate lines that are selected when all the attribute references are satisfied.
4746
+ One case where this is useful is when referencing the `page-number` attribute.
4747
+ If you unset the `pagenums` attribute on the document, any line in the running content that makes reference to `\{page-number}` will be dropped.
4748
+
4749
+ You can also built-in AsciiDoc text replacements like `+(C)+`, numeric character references like `+&#169;+`, hexidecimal character references like `+&#x20ac;+`, and inline formatting (e.g., bold, italic, monospace).
3559
4750
 
3560
4751
  Here's an example that shows how attributes and replacements can be used in the running footer:
3561
4752
 
@@ -3581,6 +4772,8 @@ footer:
3581
4772
  content: '*{page-number}* | {chapter-title}'
3582
4773
  ----
3583
4774
 
4775
+ ==== Multiple Lines
4776
+
3584
4777
  You can split the content value across multiple lines using YAML's multiline string syntax.
3585
4778
  In this case, the single quotes around the string are not necessary.
3586
4779
  To force a hard line break in the output, add `{sp}+` to the end of the line in normal AsciiDoc fashion.
@@ -3609,8 +4802,9 @@ One exception to this rule are inline images, which are described in the next se
3609
4802
  ==== Images
3610
4803
 
3611
4804
  You can add an image to the running header or footer using the AsciiDoc inline image syntax.
3612
- Note that the image must be the whole value for a given position (left, center or right).
3613
- It cannot be combined with text.
4805
+ The image target is resolved relative to the value of the `pdf-themesdir` attribute.
4806
+ If the image macro is the whole value for a column position, you can use the `position` and `fit` attributes to align and scale it relative to the column box.
4807
+ Otherwise, the image is treated like a normal inline image, for which you can only adjust the width.
3614
4808
 
3615
4809
  Here's an example of how to use an image in the running header (which also applies for the footer).
3616
4810
 
@@ -3626,7 +4820,7 @@ header:
3626
4820
  center:
3627
4821
  content: $header-recto-center-content
3628
4822
  ----
3629
- <1> You can use the `footer-vertical-align` attribute to slighly nudge the image up or down.
4823
+ <1> You can use the `image-vertical-align` key to slighly nudge the image up or down.
3630
4824
 
3631
4825
  CAUTION: By default, the image must fit in the allotted space for the running header or footer.
3632
4826
  Otherwise, you will run into layout issues.
@@ -3650,7 +4844,9 @@ _Specifying an absolute path is recommended._
3650
4844
  If you use images in your theme, image paths are resolved relative to this directory.
3651
4845
  If `pdf-theme` ends with `.yml`, and `pdf-themesdir` is not specified, then `pdf-themesdir` defaults to the directory of the path specified by `pdf-theme`.
3652
4846
 
3653
- pdf-fontsdir:: The directory where the fonts used by your theme, if any, are located.
4847
+ pdf-fontsdir:: The directory or directories where the fonts used by your theme, if any, are located.
4848
+ Multiple entries must be separated by a semi-colon.
4849
+ To reference a file inside a JAR file on the classpath, prefix with the path with `uri:classloader:` (AsciidoctorJ only).
3654
4850
  _Specifying an absolute path is recommended._
3655
4851
 
3656
4852
  Let's assume that you've put your theme files inside a directory named `resources` with the following layout:
@@ -3673,7 +4869,7 @@ Here's how you'd load your theme when calling Asciidoctor PDF:
3673
4869
 
3674
4870
  If all goes well, Asciidoctor PDF should run without an error or warning.
3675
4871
 
3676
- NOTE: You only need to specify the `pdf-fontsdir` if you are using custom fonts in your theme.
4872
+ NOTE: You only need to specify the `pdf-fontsdir` if you're using custom fonts in your theme.
3677
4873
 
3678
4874
  You can skip setting the `pdf-themesdir` attribute and just pass the absolute path of your theme file to the `pdf-theme` attribute.
3679
4875
 
@@ -3693,6 +4889,14 @@ The only thing you need to add to an existing build is the attributes mentioned
3693
4889
  * https://github.com/asciidoctor/asciidoctor-maven-examples/tree/master/asciidoctor-pdf-with-theme-example[Maven Example]
3694
4890
  * https://github.com/asciidoctor/asciidoctor-gradle-examples/tree/master/asciidoc-to-pdf-with-theme-example[Gradle Example]
3695
4891
 
4892
+ Speaking of Java, you can bundle and distribute your theme and fonts in a jar file.
4893
+ To reference the theme file and/or directory of fonts from inside the jar, refer to their location on the classpath using the `uri:classloader:` prefix.
4894
+ Here's how you'd load both the theme and fonts from the classpath:
4895
+
4896
+ $ asciidoctorj -b pdf -a pdf-theme="uri:classloader:/path/to/themes/my-theme.yml" -a pdf-fontsdir="uri:classloader:/path/to/fonts" document.adoc
4897
+
4898
+ This only works when running Asciidoctor PDF on the JVM.
4899
+
3696
4900
  == Theme-Related Document Attributes
3697
4901
 
3698
4902
  There are various settings in the theme you control using document attributes.
@@ -3715,12 +4919,24 @@ These settings override equivalent keys defined in the theme file, where applica
3715
4919
  (format can be image or PDF)
3716
4920
  |:front-cover-image: image:front-cover.pdf[]
3717
4921
 
4922
+ |hyphens^[7]^
4923
+ |language code {vbar} _blank_ to default to en_us (default: _not set_)
4924
+ |:hyphens: de
4925
+
3718
4926
  |media
3719
4927
  |screen {vbar} print {vbar} prepress
3720
4928
  |:media: prepress
3721
4929
 
3722
- |outlinelevels
3723
- |number (default: same as _toclevels_)
4930
+ |compress
4931
+ |flag (default: _not set_)
4932
+ |:compress:
4933
+
4934
+ |optimize
4935
+ |screen {vbar} ebook {vbar} printer {vbar} prepress {vbar} default (default: default)
4936
+ |:optimize: prepress
4937
+
4938
+ |outlinelevels^[10]^
4939
+ |Integer {vbar} Integer:Integer (default: same as _toclevels_)
3724
4940
  |:outlinelevels: 2
3725
4941
 
3726
4942
  |page-background-image^[4]^
@@ -3731,6 +4947,10 @@ These settings override equivalent keys defined in the theme file, where applica
3731
4947
  |path^[2]^ {vbar} image macro^[3]^
3732
4948
  |:page-background-image-recto: image:bg-recto.jpg[]
3733
4949
 
4950
+ |page-foreground-image
4951
+ |path^[2]^ {vbar} image macro^[3]^
4952
+ |:page-foreground-image: image:watermark.svg[]
4953
+
3734
4954
  |pagenums^[5]^
3735
4955
  |flag (default: _set_)
3736
4956
  |:pagenums:
@@ -3743,9 +4963,13 @@ These settings override equivalent keys defined in the theme file, where applica
3743
4963
  |<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>>
3744
4964
  |:pdf-page-margin: [1in, 0.5in]
3745
4965
 
4966
+ |pdf-page-mode
4967
+ |outline {vbar} none {vbar} thumbs {vbar} fullscreen {vbar} fullscreen outline {vbar} fullscreen none {vbar} fullscreen thumbs (default: outline)
4968
+ |:pdf-page-mode: fullscreen none
4969
+
3746
4970
  |pdf-page-size
3747
4971
  |https://github.com/prawnpdf/pdf-core/blob/0.6.0/lib/pdf/core/page_geometry.rb#L16-L68[Named size^] {vbar} <<measurement-units,Measurement[width, height]>>
3748
- |:pdf-page-size: 6in x 9in
4972
+ |:pdf-page-size: [6in, 9in]
3749
4973
 
3750
4974
  |pdf-folio-placement
3751
4975
  |virtual {vbar} virtual-inverted {vbar} physical {vbar} physical-inverted
@@ -3759,7 +4983,11 @@ These settings override equivalent keys defined in the theme file, where applica
3759
4983
  |flag (default: _not set_)
3760
4984
  |:pdfmark:
3761
4985
 
3762
- |text-align^[7]^
4986
+ |scripts^[7]^
4987
+ |cjk (default: _not set_)
4988
+ |:scripts: cjk
4989
+
4990
+ |text-align^[8]^
3763
4991
  |<<text-alignments,Text alignment>>
3764
4992
  |:text-align: left
3765
4993
 
@@ -3767,31 +4995,44 @@ These settings override equivalent keys defined in the theme file, where applica
3767
4995
  |path^[2]^ {vbar} image macro^[3]^
3768
4996
  |:title-logo-image: image:logo.png[top=25%, align=center, pdfwidth=0.5in]
3769
4997
 
3770
- |title-page^[8]^
4998
+ |title-page^[9]^
3771
4999
  |flag (default: _not set_)
3772
5000
  |:title-page:
3773
5001
 
3774
5002
  |title-page-background-image
3775
5003
  |path^[2]^ {vbar} image macro^[3]^
3776
5004
  |:title-page-background-image: image:title-bg.jpg[]
5005
+
5006
+ |toc-max-pagenum-digits^[10]^
5007
+ |Integer (default: 3)
5008
+ |:toc-max-pagenum-digits: 4
3777
5009
  |===
3778
5010
 
3779
5011
  . `<face>` can be `front` or `back`.
3780
5012
  . The path is resolved relative to base_dir.
3781
5013
  . The target of the image macro is resolved relative to `imagesdir`.
3782
5014
  If the image macro syntax is not used, the value is resolved relative to the base directory, which defaults to the document directory.
3783
- . By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`).
3784
- The size of the background can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
5015
+ . By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
5016
+ The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width) when `fit=none`.
5017
+ The position of the background image can be controlled using the `position` attribute.
3785
5018
  If the recto (right-hand, odd-numbered pages) or verso (left-hand, even-numbered pages) background is specified, it will be used only for that side.
3786
5019
  If a background image isn't specified for a side, the converter will use the default page background image (`page-background-image`), if specified.
3787
- To disable the background for a side, use the value `none`.
3788
- . Controls whether the `page-number` attribute is accessible to the running header and footer content specified in the theme file.
3789
- Use the `noheader` and `nofooter` attributes to disable the running header and footer, respectively, from the document.
5020
+ To disable the background image for a side, use the value `none`.
5021
+ . Controls whether the implicit `page-number` attribute is to the running header and footer content specified in the theme file.
5022
+ Instead of disabling page numbers, you can use the `noheader` and `nofooter` attributes to disable the running header and footer, respectively.
3790
5023
  . Enables generation of the http://milan.kupcevic.net/ghostscript-ps-pdf/#marks[pdfmark] file, which contains metadata that is fed to Ghostscript when optimizing the PDF file.
5024
+ . Activates line break rules for CJK languages (specifically Chinese and Japanese).
5025
+ Chinese and Japanese are written without spaces (and may not use spaces when mixing with English words either).
5026
+ This setting allows a line break to be placed between any two CJK characters to accommodate wrapping.
5027
+ These languages also use different punctuation for pause, full stop, and dash, which are taken into account when breaking lines.
3791
5028
  . _(Experimental)_ The `text-align` document attribute is intended as a simple way to toggle text justification.
3792
5029
  The value of this attribute overrides the `base-align` key set by the theme.
3793
5030
  For more fine-grained control, you should customize using the theme.
3794
- . Force a title page to be added even when the doctype is not book.
5031
+ . The title page is only enabled by default for the book doctype.
5032
+ To force the title page to be used for other doctypes, set the `title-page` attribute in the document header.
5033
+ . If the TOC overlaps the first page of content, increase this number.
5034
+ . The second number in the value of `outlinelevels` is the number of levels of the outline to expand (e.g., `3:1`).
5035
+ If the second number is not present, all levels are expanded.
3795
5036
 
3796
5037
  == Publishing Mode
3797
5038
 
@@ -3823,7 +5064,10 @@ recto page margin:: [0.5in, *0.59in*, 0.67in, *0.75in*]
3823
5064
  verso page margin:: [0.5in, *0.75in*, 0.67in, *0.59in*]
3824
5065
 
3825
5066
  The page margins alternate between recto and verso.
3826
- The first page in the document is a recto page.
5067
+ The first page in the document (after the cover) is a recto page.
5068
+
5069
+ If no cover is specified, the recto margin is not applied to the title page.
5070
+ To apply the recto margin to the title page, but not include a cover, assign the value `~` to the `front-cover-image` attribute.
3827
5071
 
3828
5072
  === Automatic Facing Pages
3829
5073
 
@@ -3838,7 +5082,7 @@ Other "`facing`" pages may be added in the future.
3838
5082
 
3839
5083
  It's possible to disable the automatic facing feature for a given part or chapter.
3840
5084
  This can be done by adding the nonfacing option to the section node.
3841
- When the nonfacing option is present, the part or chapter title will be placed on the following page.
5085
+ When the nonfacing option is present, the part or chapter title will be placed on the next adjacent page rather than the next facing page.
3842
5086
 
3843
5087
  [source,asciidoc]
3844
5088
  ----
@@ -3926,3 +5170,239 @@ For more information about source highlighting with Rouge, refer to the http://r
3926
5170
 
3927
5171
  * http://www.sitepoint.com/hackable-pdf-typesetting-in-ruby-with-prawn[Hackable PDF typesetting in Ruby with Prawn]
3928
5172
  ////
5173
+
5174
+ == Extending the Converter
5175
+
5176
+ This converter uses {url-prawn}[Prawn] under the covers to generate the PDF.
5177
+ Prawn is a low-level PDF writer that can load fonts, ink text, embed images, add graphics, and draw lines.
5178
+ With those operations alone, this converter manages to produce a PDF from an AsciiDoc document.
5179
+ This section explains the role of theming in this process and how to extend the converter to take it further.
5180
+
5181
+ === Going Beyond Theming
5182
+
5183
+ While creating the PDF document, there are thousands of small decisions the converter must make about how to instruct Prawn to layout the content elements on the page (so-called "`hackable typesetting`").
5184
+ But once these elements are written, they can't be moved or styled (as is the case with HTML and CSS).
5185
+ To help influence those decisions--and thus prevent the converter from becoming too opinionated, a theming system was introduced.
5186
+ That theming system is described in this document.
5187
+
5188
+ The theme support is there to provide basic customizations (fonts, colors, borders, spacing, etc.).
5189
+ But it can only go so far.
5190
+ At some point, it becomes necessary to extend the converter to meet advanced design requirements.
5191
+
5192
+ Before you dive into extending this converter, you'll need to understand how to use Prawn.
5193
+ The article https://www.sitepoint.com/hackable-pdf-typesetting-in-ruby-with-prawn/[Hackable PDF Typesetting in Ruby with Prawn] gives a crash course in how to create your first PDF document containing text, graphics, and images with Prawn.
5194
+ That article is essential reading for working with Asciidoctor PDF, which uses many of the same operations (as well as many helpful add-ons).
5195
+ Once you feel comfortable with Prawn, you're ready to extend the converter.
5196
+
5197
+ === Tailoring Conversion
5198
+
5199
+ The methods on a converter class that handle conversion follow the pattern `convert_<name>` for block elements (e.g., `convert_example`) and `convert_inline_<name>` for inline elements (e.g., `convert_inline_anchor`), where `<name>` is the name of the element.
5200
+
5201
+ When you override a block element, you write PDF objects directly to the Prawn Document (the current context).
5202
+ When you override an inline element, you return pseudo-HTML, which is then parsed and converted into PDF objects.
5203
+
5204
+ The pseudo-HTML in Asciidoctor PDF evolved from the inline formatting in Prawn, now supporting the following elements: a, br, button, code, color, del, em, font, img, key, mark, span, strong, sub, sup.
5205
+ All decimal and hexadecimal character references are supported, as well as the named entities amp, apos, gt, lt, nbsp, and quot (e.g., `\&apos;`).
5206
+ You can change the font color using `rgb` attribue on the `color` element (e.g., `<color rgb="#ff0000">`) and the font family and size using `name` and `size` attributes on the `font` element, respectively (e.g., `<font name="sans" size="12">`).
5207
+ You can also use the `style` attribute on `span` to control the font color, weight, and style using the relevant CSS property names.
5208
+ The pseudo-HTML in Asciidoctor PDF also supports the `class` attribute on any element for applying roles from the theme.
5209
+ (Though not recommended, you can pass this pseudo-HTML straight through to Prawn using an inline passthrough in AsciiDoc).
5210
+
5211
+ === Defining the Extended Converter
5212
+
5213
+ Starting with Asciidoctor 2, defining an extending converter and registering it in place of the original is very straightforward.
5214
+
5215
+ .custom-pdf-converter.rb
5216
+ [source,ruby]
5217
+ ----
5218
+ class CustomPDFConverter < (Asciidoctor::Converter.for 'pdf')
5219
+ register_for 'pdf'
5220
+
5221
+ # overrides go here
5222
+ end
5223
+ ----
5224
+
5225
+ As it stands, the converter doesn't do anything differently than the primary converter because we haven't yet overridden any of its methods.
5226
+ Let's do that now, starting by overriding the thematic break (aka horizonal rule) to make it render like a ribbon:
5227
+
5228
+ [source,ruby]
5229
+ ----
5230
+ def convert_thematic_break node
5231
+ theme_margin :thematic_break, :top
5232
+ stroke_horizontal_rule 'FF0000', line_width: 0.5, line_style: :solid
5233
+ move_down 1
5234
+ stroke_horizontal_rule 'FF0000', line_width: 1, line_style: :solid
5235
+ move_down 1
5236
+ stroke_horizontal_rule 'FF0000', line_width: 0.5, line_style: :solid
5237
+ theme_margin :thematic_break, :bottom
5238
+ end
5239
+ ----
5240
+
5241
+ This converter will replace the thematic break with a red ribbon.
5242
+
5243
+ Another way to override the converter is to modify the node, then delegate back to the primary converter.
5244
+ Let's put a page break before all paragraphs unless the cursor is at the top of the page.
5245
+ We'll call `super` to let the primary converter handle the work of rendering the paragraph.
5246
+
5247
+ [source,ruby]
5248
+ ----
5249
+ def convert_paragraph node
5250
+ bounds.move_past_bottom unless at_page_top?
5251
+ super
5252
+ end
5253
+ ----
5254
+
5255
+ Now let's look at how to modify an inline element.
5256
+ Let's say we want to override the kbd element.
5257
+
5258
+ [source,ruby]
5259
+ ----
5260
+ def convert_inline_kbd node
5261
+ %(<strong><color rgb="AA0000">#{(node.attr 'keys').join ' + '}</color></strong>)
5262
+ end
5263
+ ----
5264
+
5265
+ Refer to the primary converter to discover the pseudo-HTML you can use for inline elements.
5266
+
5267
+ So far we've just been biting around the edges.
5268
+ A more realistic use case is to customize the part title page in a multi-part book.
5269
+ Since this is a specialized section element, there's a dedicated method named `layout_part_title` that you'll need to override.
5270
+
5271
+ Let's customize the part title page by making the background orange, making the font white, centering the title on the page, and disabling the running content.
5272
+ (You don't need to start a new page before and after the part title since that's already done for you).
5273
+
5274
+ [source,ruby]
5275
+ ----
5276
+ def layout_part_title node, title, opts = {}
5277
+ fill_absolute_bounds 'E64C3D'
5278
+ move_down 20
5279
+ typeset_text title, (calc_line_metrics 1.5), color: 'FFFFFF', inline_format: true, align: :center, size: 42
5280
+ page.instance_variable_set :@imported_page, true
5281
+ end
5282
+ ----
5283
+
5284
+ The method `typeset_text` and `calc_line_metrics` are provided by Asciidoctor PDF to make writing text easier.
5285
+ If you wanted, you could just use the low-level `text` method provided by Prawn.
5286
+
5287
+ To find all the available methods to override, consult the https://www.rubydoc.info/github/asciidoctor/asciidoctor-pdf/Asciidoctor/Pdf/Converter[API docs].
5288
+ For deeper examples of how to override the behavior of the converter, refer to the extended converter in the https://github.com/mraible/infoq-mini-book/blob/master/src/main/ruby/asciidoctor-pdf-extensions.rb[InfoQ Mini-Book template].
5289
+
5290
+ Now that you've seen some examples of how to extend the converter, let's look at how to use it.
5291
+
5292
+ === Using the Extended Converter
5293
+
5294
+ To use this converter, register it by passing the path to the `-r` flag when calling the `asciidoctor-pdf` command:
5295
+
5296
+ $ asciidoctor-pdf -r ./custom-pdf-converter.rb document.adoc
5297
+
5298
+ That's all there is too it.
5299
+ Now you're hacking the typesetting!
5300
+
5301
+ [appendix]
5302
+ == Preparing a Custom Font
5303
+
5304
+ Any TTF font can be used with Prawn--and hence Asciidoctor PDF--without modifications (unless, of course, it's corrupt or contains errors).
5305
+ However, you may discover that kerning is disabled and certain required glyphs are missing (or replaced with boxes).
5306
+ To address these problems, you need to prepare the font using a font program such as {url-fontforge}[FontForge].
5307
+
5308
+ === Validate the Font
5309
+
5310
+ Before using the font, you may want to check that the font is valid.
5311
+ To do so, create the following script, which will verify that the TTF font is free from errors.
5312
+
5313
+ .validate-font.rb
5314
+ [source,ruby]
5315
+ ----
5316
+ require 'ttfunk'
5317
+ require 'ttfunk/subset_collection'
5318
+
5319
+ ttf_subsets = TTFunk::SubsetCollection.new TTFunk::File.open ARGV[0]
5320
+ (0...(ttf_subsets.instance_variable_get :@subsets).size).each {|idx| ttf_subsets[idx].encode }
5321
+ ----
5322
+
5323
+ Run the script on your font as follows:
5324
+
5325
+ $ ruby validate-font.rb path/to/font.ttf
5326
+
5327
+ If this script fails, the font will not work with Asciidoctor PDF.
5328
+ To repair it, open the font in FontForge and resave it using menu:File[Generate Fonts...,Generate].
5329
+ Dismiss any warning dialogs.
5330
+
5331
+ Resaving the font in FontForge will usually resolve any errors in the font.
5332
+ (If not, you may need to find another font, or at least another copy of it).
5333
+
5334
+ === Modifying the Font
5335
+
5336
+ To ready your font for use with Asciidoctor PDF, you'll need to modify it using a font program.
5337
+ We recommend using {url-fontforge}[FontForge].
5338
+ But don't let this scare you off.
5339
+ FontForge essentially works like a vector-drawing tool, in which each character is a separate canvas.
5340
+ You can find a crash course in how to use the program on the FontForge project site.
5341
+
5342
+ Here are the modifications you need to apply to a custom font for it to work best with Asciidoctor PDF:
5343
+
5344
+ * Convert the font to TTF (only required if the font is not already a TTF, such as an OTF or TTC).
5345
+ * Add the glyphs for the required characters if missing from the font (optional if using a fallback font).
5346
+ * Subset the font to exclude unused characters to reduce the file size (optional).
5347
+ * Save the file using the old-style kern table to activate kerning.
5348
+
5349
+ NOTE: Technically, subsetting the font (i.e., removing glyphs) is not required since Prawn only embeds the characters from the font used in the document (i.e., it automatically subsets the font).
5350
+ However, if you plan to commit the font to a repository, subsetting helps keep the file size down.
5351
+
5352
+ Most fonts do not provide glyphs for all the Unicode character ranges (i.e., scripts).
5353
+ (A glyph is the corresponding vector image for a Unicode character).
5354
+ In fact, many fonts only include glyphs for Latin (Basic, Supplement, and Extended) and a few other scripts (e.g., Cyrillic, Greek).
5355
+ That means certain glyphs Asciidoctor PDF relies on may be missing from the font.
5356
+
5357
+ Below are the non-Latin characters (identified by Unicode code point) on which Asciidoctor PDF relies that are often missing from fonts.
5358
+ Unless you're using a fallback font that fills in the missing glyphs, you need to ensure these glyphs are present in your font (and add them if not).
5359
+
5360
+ * \u00a0 - no-break space
5361
+ * \ufeff - zero width no-break space
5362
+ * \u200b - zero width space (used for line break hints)
5363
+ * \u000a - line feed character (zero width)
5364
+ * \u2009 - thin spaced (used in the button UI element)
5365
+ * \u202f - narrow no-break space (used in the keybinding UI element)
5366
+ * \u2011 - non-breaking hyphen
5367
+ * \u2022 - disc (used for first-level unordered list level)
5368
+ * \u25e6 - circle (used for second-level unordered list level)
5369
+ * \u25aa - square (used for third-level unordered list level)
5370
+ * \u2611 - ballot box checked (used for checked list item)
5371
+ * \u2610 - ballot box unchecked (used for unchecked list item)
5372
+ * \u2014 - em-dash (used in quote attribute)
5373
+ * \u203a - single right-pointing quotation mark (used in the menu UI element)
5374
+ * \u25ba - right pointer (used for media play icon when icon fonts are disabled)
5375
+ * .notdef - used as the default glyph when a requested character is missing from the font (usually a box)
5376
+
5377
+ NOTE: If the .notdef glyph is non-empty (i.e., contains splines), it will be used as the default glyph when the document requests a character that is missing from the font.
5378
+ Unlike other glyphs, the .notdef glyph is referenced by name only.
5379
+ It does not have a designated Unicode code point.
5380
+
5381
+ If you're preparing a font for use in verbatim blocks (e.g., a listing block), you'll also need this range of characters:
5382
+
5383
+ * \u2460 to \u2468 - circled numbers
5384
+
5385
+ One way to get these glyphs is to steal them from another font (or from another character in the same font).
5386
+ To do so, open the other font in FontForge, select the character, press kbd:[Ctrl,c], switch back to your font, select the character again, and press kbd:[Ctrl,v].
5387
+ You may need to scale the glyph so it fits properly in the art box.
5388
+
5389
+ IMPORTANT: If you're copying a non-visible character, be sure to set the width to 0 using menu:Metrics[Set Width...], enter 0 into *Set Width To*, then click btn:[OK].
5390
+
5391
+ When you're done, save the font with the old-style kern table enabled.
5392
+ To do so, select menu:File[Generate Fonts...], click btn:[Options], and make sure only the following options are selected (equivalent to the flags 0x90 + 0x08):
5393
+
5394
+ * [x] OpenType
5395
+ ** [x] Old style 'kern'
5396
+
5397
+ Then click btn:[Generate] to generate and save the font.
5398
+
5399
+ Your font file is now ready to be used with Asciidoctor PDF.
5400
+
5401
+ === Scripting the Font Modifications
5402
+
5403
+ Performing all this font modification manually can be tedious (not to mention hard to reproduce).
5404
+ Fortunately, FontForge provides a {url-fontforge-scripting}[scripting interface], which you can use to automate the process.
5405
+
5406
+ In fact, that's what we use to prepare the fonts that are bundled with Asciidoctor PDF.
5407
+ You can find that FontForge script, the Bash script that calls it, and the Docker image in which it is run in the https://github.com/asciidoctor/asciidoctor-pdf/tree/master/scripts[scripts directory] of this project.
5408
+ You can use that script as a starting point or reference for your own font preparation / modification script.