asciidoctor-pdf 1.5.0.alpha.7 → 1.5.0.alpha.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/NOTICE.adoc +2 -2
  3. data/README.adoc +127 -128
  4. data/Rakefile +5 -4
  5. data/bin/asciidoctor-pdf +15 -2
  6. data/data/fonts/notoserif-regular-latin.ttf +0 -0
  7. data/data/themes/default-theme.yml +15 -13
  8. data/docs/theme-schema.json +114 -0
  9. data/docs/theming-guide.adoc +386 -132
  10. data/lib/asciidoctor-pdf/asciidoctor_ext.rb +2 -0
  11. data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +18 -0
  12. data/lib/asciidoctor-pdf/converter.rb +377 -221
  13. data/lib/asciidoctor-pdf/core_ext.rb +2 -0
  14. data/lib/asciidoctor-pdf/core_ext/array.rb +10 -4
  15. data/lib/asciidoctor-pdf/core_ext/numeric.rb +11 -0
  16. data/lib/asciidoctor-pdf/core_ext/ostruct.rb +1 -1
  17. data/lib/asciidoctor-pdf/formatted_text.rb +8 -0
  18. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/formatter.rb +6 -9
  19. data/lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb +16 -0
  20. data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +125 -0
  21. data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +45 -0
  22. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/parser.rb +252 -218
  23. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/parser.treetop +18 -9
  24. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/transform.rb +80 -69
  25. data/lib/asciidoctor-pdf/prawn_ext.rb +2 -2
  26. data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +164 -35
  27. data/lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb +37 -0
  28. data/lib/asciidoctor-pdf/prawn_ext/images.rb +11 -9
  29. data/lib/asciidoctor-pdf/temporary_path.rb +9 -0
  30. data/lib/asciidoctor-pdf/theme_loader.rb +40 -33
  31. data/lib/asciidoctor-pdf/version.rb +1 -1
  32. metadata +30 -14
@@ -1,16 +1,16 @@
1
1
  font:
2
2
  catalog:
3
- NotoSerif:
3
+ Noto Serif:
4
4
  normal: notoserif-regular-latin.ttf
5
5
  bold: notoserif-bold-latin.ttf
6
6
  italic: notoserif-italic-latin.ttf
7
7
  bold_italic: notoserif-bolditalic-latin.ttf
8
- Mplus1mn:
8
+ M+ 1mn:
9
9
  normal: mplus1mn-regular-ascii-conums.ttf
10
10
  bold: mplus1mn-bold-ascii.ttf
11
11
  italic: mplus1mn-italic-ascii.ttf
12
12
  bold_italic: mplus1mn-bolditalic-ascii.ttf
13
- Mplus1pMultilingual:
13
+ M+ 1p Fallback:
14
14
  normal: mplus1p-regular-multilingual.ttf
15
15
  bold: mplus1p-regular-multilingual.ttf
16
16
  italic: mplus1p-regular-multilingual.ttf
@@ -18,7 +18,7 @@ font:
18
18
  fallbacks:
19
19
  # NOTE M+ 1p doesn't support all CJK characters, but it at least has some coverage
20
20
  # NOTE M+ 1p provides the arrows for ->, <-, => and <=
21
- - Mplus1pMultilingual
21
+ - M+ 1p Fallback
22
22
  page:
23
23
  background_color: ffffff
24
24
  layout: portrait
@@ -35,7 +35,7 @@ base:
35
35
  # color as CMYK array (approximated)
36
36
  #font_color: [0, 0, 0, 0.92]
37
37
  #font_color: [0, 0, 0, 92%]
38
- font_family: NotoSerif
38
+ font_family: Noto Serif
39
39
  # choose one of these font_size/line_height_length combinations
40
40
  #font_size: 14
41
41
  #line_height_length: 20
@@ -45,13 +45,14 @@ base:
45
45
  #line_height_length: 16
46
46
  font_size: 10.5
47
47
  #line_height_length: 15
48
- # correct line height for NotoSerif metrics
48
+ # correct line height for Noto Serif metrics
49
49
  line_height_length: 12
50
50
  #font_size: 11.25
51
51
  #line_height_length: 18
52
52
  line_height: $base_line_height_length / $base_font_size
53
53
  font_size_large: round($base_font_size * 1.25)
54
54
  font_size_small: round($base_font_size * 0.85)
55
+ font_size_min: $base_font_size * 0.75
55
56
  font_style: normal
56
57
  align: justify
57
58
  border_radius: 4
@@ -59,7 +60,7 @@ base:
59
60
  border_color: eeeeee
60
61
  # FIXME vertical_rhythm is weird; we should think in terms of ems
61
62
  #vertical_rhythm: $base_line_height_length * 2 / 3
62
- # correct line height for NotoSerif metrics
63
+ # correct line height for Noto Serif metrics
63
64
  vertical_rhythm: $base_line_height_length
64
65
  horizontal_rhythm: $base_line_height_length
65
66
  link:
@@ -67,7 +68,7 @@ link:
67
68
  # literal is currently used for inline monospaced in prose and table cells
68
69
  literal:
69
70
  font_color: b12146
70
- font_family: Mplus1mn
71
+ font_family: M+ 1mn
71
72
  heading:
72
73
  #font_color: 181818
73
74
  font_color: $base_font_color
@@ -82,7 +83,7 @@ heading:
82
83
  h6_font_size: $base_font_size_small
83
84
  font_style: bold
84
85
  #line_height: 1.4
85
- # correct line height for NotoSerif metrics
86
+ # correct line height for Noto Serif metrics
86
87
  line_height: 1.2
87
88
  margin_top: $vertical_rhythm * 0.2
88
89
  margin_bottom: $vertical_rhythm * 0.8
@@ -115,7 +116,7 @@ caption:
115
116
  margin_outside: 0
116
117
  code:
117
118
  font_color: $base_font_color
118
- #font_family: LiberationMono
119
+ #font_family: Liberation Mono
119
120
  #font_size: floor($base_font_size * 0.9)
120
121
  #font_size: 10
121
122
  #padding: [9.5, 9.5, 9.5, 9.5]
@@ -139,7 +140,7 @@ blockquote:
139
140
  cite_font_size: $base_font_size_small
140
141
  cite_font_color: 999999
141
142
  sidebar:
142
- border_color: ffffff
143
+ border_color: $page_background_color
143
144
  border_radius: $base_border_radius
144
145
  border_width: $base_border_width
145
146
  background_color: eeeeee
@@ -157,7 +158,7 @@ admonition:
157
158
  border_color: $base_border_color
158
159
  border_width: $base_border_width
159
160
  conum:
160
- font_family: Mplus1mn
161
+ font_family: M+ 1mn
161
162
  font_color: $literal_font_color
162
163
  font_size: $base_font_size
163
164
  line_height: 4 / 3
@@ -188,8 +189,9 @@ outline_list:
188
189
  indent: $horizontal_rhythm * 1.5
189
190
  # NOTE item_spacing applies to list items that do not have complex content
190
191
  item_spacing: $vertical_rhythm / 2
192
+ #marker_font_color: 404040
191
193
  table:
192
- background_color: ffffff
194
+ background_color: $page_background_color
193
195
  #head_background_color: <hex value>
194
196
  #head_font_color: $base_font_color
195
197
  even_row_background_color: f9f9f9
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "title": "Theme Definition",
4
+ "description": "A JSON schema for describing the available keys and value types for an Asciidoctor PDF theme. Status: Incomplete; early draft.",
5
+ "definitions": {
6
+ // FIXME add RGB and CMYK arrays
7
+ "color": {
8
+ "type": "string",
9
+ "pattern": "^#?[a-fA-F0-9]{3,6}$"
10
+ },
11
+ "font_style": {
12
+ "type": "string",
13
+ "enum": ["normal", "bold", "italic", "bold_italic"]
14
+ },
15
+ "measurement": {
16
+ "oneOf": [
17
+ {
18
+ "type": "string",
19
+ "pattern": "^[0-9]+(?:\\.[0-9]+)?(?:in|mm|cm|pt)?$"
20
+ },
21
+ {
22
+ // FIXME technically, numbers < 0 must have a leading 0 (e.g., 0.8)
23
+ "type": "number"
24
+ }
25
+ ]
26
+ },
27
+ "text_alignment": {
28
+ "type": "string",
29
+ "enum": ["left", "center", "right", "justify"]
30
+ }
31
+ },
32
+ "type": "object",
33
+ "properties": {
34
+ "page_background_color": {
35
+ "$ref": "#/definitions/color",
36
+ "default": "#FFFFFF"
37
+ },
38
+ "page_background_image": {
39
+ "type": "string"
40
+ },
41
+ "page_layout": {
42
+ "type": "string",
43
+ "enum": ["portrait", "landscape"],
44
+ "default": "portrait"
45
+ },
46
+ "page_margin": {
47
+ "type": "array",
48
+ "minItems": 4,
49
+ "maxItems": 4,
50
+ "items": {
51
+ "$ref": "#/definitions/measurement"
52
+ },
53
+ "additionalItems": false
54
+ },
55
+ "page_size": {
56
+ "oneOf": [
57
+ {
58
+ "type": "string",
59
+ "enum": ["A4", "Executive", "Folio", "Legal", "Letter", "Tabloid"]
60
+ },
61
+ {
62
+ "type": "array",
63
+ "minItems": 2,
64
+ "maxItems": 2,
65
+ "items": {
66
+ "$ref": "#/definitions/measurement"
67
+ }
68
+ }
69
+ ],
70
+ "default": "Letter"
71
+ },
72
+ "base_align": {
73
+ "$ref": "#/definitions/text_alignment",
74
+ "default": "left"
75
+ },
76
+ "base_border_color": {
77
+ "$ref": "#/definitions/color"
78
+ },
79
+ "base_border_radius": {
80
+ "type": "number"
81
+ },
82
+ "base_border_width": {
83
+ "type": "number"
84
+ },
85
+ "base_font_color": {
86
+ "$ref": "#/definitions/color",
87
+ "default": "#000000"
88
+ },
89
+ "base_font_family": {
90
+ "type": "string",
91
+ "default": "Helvetica"
92
+ },
93
+ "base_font_size": {
94
+ "type": "number",
95
+ "default": 12
96
+ },
97
+ "base_font_style": {
98
+ "$ref": "#/definitions/font_style",
99
+ "default": "normal"
100
+ },
101
+ "base_line_height": {
102
+ "type": "number"
103
+ },
104
+ "base_line_height_length": {
105
+ "$ref": "#/definitions/measurement"
106
+ },
107
+ "base_font_size_large": {
108
+ "type": "number"
109
+ },
110
+ "base_font_size_small": {
111
+ "type": "number"
112
+ }
113
+ }
114
+ }
@@ -8,14 +8,10 @@ Dan Allen <https://github.com/mojavelinux>
8
8
 
9
9
  ////
10
10
  Topics remaining to document:
11
- * transparent color
12
- * additional fonts provided by Asciidoctor PDF
13
- * images
14
- * title page layout
15
- * title image
16
- * title page background image
17
- * keys
18
- * how to apply the theme
11
+ * document which attributes can be set in document (pdf-page-size, front-cover-image, back-cover-image, etc)
12
+ * line height and line height length (and what that all means)
13
+ * title page layout / title page images (logo & background)
14
+ * document that unicode escape sequences can be used inside double-quoted strings
19
15
  ////
20
16
 
21
17
  The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file that Asciidoctor PDF generates from AsciiDoc.
@@ -24,13 +20,26 @@ This document explains how the theming system works, how to define a custom them
24
20
 
25
21
  toc::[]
26
22
 
27
- == Language Overview
23
+ == Language overview
28
24
 
29
25
  The theme language in Asciidoctor PDF is based on the http://en.wikipedia.org/wiki/YAML[YAML] data format and incorporates many concepts from CSS and SASS.
30
26
  Therefore, if you have a background in web design, the theme language should be immediately familiar to you.
31
27
 
32
- Like CSS, themes have both selectors and properties, but only a fraction of what CSS supports.
33
- Unlike CSS, all selectors are implicit (e.g., `heading`), so you customize the theme primarily by manipulating pre-defined property values (e.g., `font_color`).
28
+ Like CSS, themes have both selectors and properties.
29
+ Selectors are the component you want to style.
30
+ The properties are the style elements of that component that can be styled.
31
+ All selector names are implicit (e.g., `heading`), so you customize the theme primarily by manipulating pre-defined property values (e.g., `font_size`).
32
+
33
+ [NOTE]
34
+ ====
35
+ The theme language in Asciidoctor PDF supports a limited subset of the properties from CSS.
36
+ Some of these properties have different names from those found in CSS.
37
+
38
+ * Underscores (`_`) can be used in place of hyphens (`-`) for all property names in the theme language.
39
+ * Instead of separate properties for font weight and font style, the theme language combines these settings in the `font_style` property (allowed values: `normal`, `bold`, `italic` and `bold_italic`).
40
+ * The `text_align` property from CSS is the `align` property in the theme language.
41
+ * The `color` property from CSS is the `font_color` property in the theme language.
42
+ ====
34
43
 
35
44
  A theme (or style) is described in a YAML-based data format and stored in a dedicated theme file.
36
45
  YAML is a human-friendly data format that resembles CSS and helps to describe the theme.
@@ -67,8 +76,8 @@ outline_list:
67
76
  indent: $base_font_size * 1.5
68
77
  ----
69
78
 
70
- When creating a new theme, you only have to define the keys you want to override from the base theme.
71
- The converter uses the information from this map to help construct the PDF.
79
+ When creating a new theme, you only have to define the keys you want to override from the base theme (PENDING, see https://github.com/asciidoctor/asciidoctor-pdf/issues/132[#132]).
80
+ The converter uses the information from the theme map to help construct the PDF.
72
81
  All the available keys are documented in <<keys>>.
73
82
 
74
83
  Keys may be nested to an arbitrary depth to eliminate redundant prefixes (an approach inspired by SASS).
@@ -123,7 +132,7 @@ The value of a key may be one of the following types:
123
132
  - Alignment (left, center, right, justify)
124
133
  - Color as hex string (e.g., #ffffff)
125
134
  - Image path
126
- * Number (integer or float) with optional units
135
+ * Number (integer or float) with optional units (default unit is points)
127
136
  * Array
128
137
  - Color as RGB array (e.g., [51, 51, 51])
129
138
  - Color CMYK array (e.g., [50, 100, 0, 0])
@@ -138,7 +147,7 @@ Note that keys almost always require a value of a specific type, as documented i
138
147
 
139
148
  Like CSS, inheritance is a key feature in the Asciidoctor PDF theme language.
140
149
  For many of the properties, if a key is not specified, the key inherits the value applied to the parent content in the content hierarchy.
141
- This behavior saves you from having to explicitly specify properties unless you want to override the inherited value.
150
+ This behavior saves you from having to specify properties unless you want to override the inherited value.
142
151
 
143
152
  The following keys are inherited:
144
153
 
@@ -160,7 +169,7 @@ Headings are special in that they inherit starting from a specific heading level
160
169
  To save you from having to type the same value in your theme over and over, or to allow you to base one value on another, the theme language supports variables.
161
170
  Variables consist of the key name preceded by a dollar (`$`) (e.g., `$base_font_size`).
162
171
  Any qualified key that has already been defined can be referenced in the value of another key.
163
- (As soon as the key is assigned, it's available to be used as a variable).
172
+ (In order words, as soon as the key is assigned, it's available to be used as a variable).
164
173
 
165
174
  For example, once the following line is processed,
166
175
 
@@ -196,9 +205,33 @@ base:
196
205
  font_size_small: $base_font_size * 0.85
197
206
  ----
198
207
 
199
- We'll cover more about math expressions in the next section.
208
+ We'll cover more about math expressions later.
209
+
210
+ ==== Custom variables
211
+
212
+ You can define arbitrary key names to make custom variables.
213
+ This is one way to group reusable values at the top of your theme file.
214
+ If you are going to do this, it's recommended that you organize the keys under a custom namespace, such as `brand`.
215
+
216
+ For instance, here's how you can define your (very patriotic) brand colors:
217
+
218
+ [source,yaml]
219
+ ----
220
+ brand:
221
+ red: #E0162B
222
+ white: #FFFFFF
223
+ blue: #0052A5
224
+ ----
225
+
226
+ You can now use these custom variables later in the theme file:
227
+
228
+ [source,yaml]
229
+ ----
230
+ base:
231
+ font_color: $brand_blue
232
+ ----
200
233
 
201
- === Math Expressions & Functions
234
+ === Math expressions & functions
202
235
 
203
236
  The theme language supports basic math operations to support calculated values.
204
237
  The following table lists the supported operations and the corresponding operator for each.
@@ -261,7 +294,7 @@ base:
261
294
  font_size_large: ceil($base_font_size * 1.25)
262
295
  ----
263
296
 
264
- === Measurement Units
297
+ === Measurement units
265
298
 
266
299
  Several of the keys require a value in points (pt), the unit of measure for the PDF canvas.
267
300
  A point is defined as 1/72 of an inch.
@@ -295,11 +328,20 @@ page:
295
328
  margin: [0.75in, 1in, 0.75in, 1in]
296
329
  ----
297
330
 
331
+ The order of elements in a measurement array is the same as it is in CSS:
332
+
333
+ . top
334
+ . right
335
+ . bottom
336
+ . left
337
+
298
338
  === Colors
299
339
 
300
340
  The theme language supports color values in three formats:
301
341
 
302
342
  Hex:: A string of 3 or 6 characters with an optional leading `#`.
343
+ +
344
+ The special value `transparent` indicates that a color should not be used.
303
345
  RGB:: An array of numeric values ranging from 0 to 255.
304
346
  CMYK:: An array of numeric values ranging from 0 to 1 or from 0% to 100%.
305
347
 
@@ -330,6 +372,14 @@ base:
330
372
  font_color: #ff0000
331
373
  ----
332
374
 
375
+ It's also possible to specify no color by assigning the special value `transparent` as shown here:
376
+
377
+ [source,yaml]
378
+ ----
379
+ base:
380
+ background_color: transparent
381
+ ----
382
+
333
383
  ==== RGB
334
384
 
335
385
  An RGB array value must be three numbers ranging from 0 to 255.
@@ -372,14 +422,47 @@ base:
372
422
 
373
423
  === Images
374
424
 
375
- PENDING
425
+ An image is specified either as a bare image path or as an inline image macro as found in the AsciiDoc syntax.
426
+ Images are currently resolved relative to the value of the `pdf-stylesdir` attribute.
427
+
428
+ The following image types (and corresponding file extensions) are supported:
429
+
430
+ * PNG (.png)
431
+ * JPEG (.jpg)
432
+ * SVG (.svg)
433
+
434
+ CAUTION: The GIF format (.gif) is not supported.
435
+
436
+ Here's how an image is specified in the theme file as a bare image path:
437
+
438
+ [source,yaml]
439
+ ----
440
+ title_page:
441
+ background_image: title-cover.png
442
+ ----
443
+
444
+ Here's how the image is specified using the inline image macro:
445
+
446
+ [source,yaml]
447
+ ----
448
+ title_page:
449
+ background_image: image:title-cover.png[]
450
+ ----
451
+
452
+ Like in the AsciiDoc syntax, the inline image macro allows you to supply set the width of the image and the alignment:
453
+
454
+ [source,yaml]
455
+ ----
456
+ title_page:
457
+ logo_image: image:logo.png[width=250,align=center]
458
+ ----
376
459
 
377
460
  == Fonts
378
461
 
379
- You can select from built-in PDF fonts or custom fonts loaded from TrueType font (TTF) files.
462
+ You can select from <<built-in-fonts,built-in PDF fonts>>, <<bundled-fonts,fonts bundled with Asciidoctor PDF>> or <<custom-fonts,custom fonts>> loaded from TrueType font (TTF) files.
380
463
  If you want to use custom fonts, you must first declare them in your theme file.
381
464
 
382
- === Built-in Fonts
465
+ === Built-in (AFM) fonts
383
466
 
384
467
  The names of the built-in fonts (for general-purpose text) are as follows:
385
468
 
@@ -407,15 +490,45 @@ base:
407
490
  font_family: Times-Roman
408
491
  ----
409
492
 
410
- However, when you use a built-in font, the characters that you use in your document are limited to the WINANSI (http://en.wikipedia.org/wiki/Windows-1252[Windows-1252]) code set.
493
+ However, when you use a built-in font, the characters that you use in your document are limited to the characters in the WINANSI (http://en.wikipedia.org/wiki/Windows-1252[Windows-1252]) code set.
411
494
  WINANSI includes most of the characters needed for writing in Western languages (English, French, Spanish, etc).
412
495
  For anything outside of that, PDF is BYOF (Bring Your Own Font).
413
496
 
414
497
  Even though the built-in fonts require the content to be encoded in WINANSI, _you still type your AsciiDoc document in UTF-8_.
415
498
  Asciidoctor PDF encodes the content into WINANSI when building the PDF.
416
- Any characters in your AsciiDoc document that cannot be encoded will be replaced with an underscore (`_`).
417
499
 
418
- === Custom Fonts
500
+ .WINANSI encoding behavior
501
+ ****
502
+ If you're using Prawn 1.3.0 with one of the built-in fonts, any characters in your AsciiDoc document that cannot be encoded to WINANSI will be replaced with an underscore glyph (`_`).
503
+ If you're using Prawn 2.0.0 or above with one of the built-in fonts, if your AsciiDoc document contains a character that cannot be encoded to WINANSI, a warning will be issued and conversion will halt.
504
+
505
+ 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].
506
+ ****
507
+
508
+ === Bundled fonts
509
+
510
+ Asciidoctor PDF bundles several fonts that are used in the default theme.
511
+ You can also use these fonts in your custom theme.
512
+ These fonts provide more characters than the built-in PDF fonts, but still only a subset of UTF-8.
513
+
514
+ The family name of the fonts bundled with Asciidoctor PDF are as follows:
515
+
516
+ http://www.google.com/get/noto/#/family/noto-serif[Noto Serif]::
517
+ A serif font that can be styled as normal, italic, bold or bold_italic.
518
+
519
+ http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1mn[M+ 1mn]::
520
+ A monospaced font that maps different thicknesses to the styles normal, italic, bold and bold_italic.
521
+ Also provides the circuled numbers used in callouts.
522
+
523
+ http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1p[M+ 1p Fallback]::
524
+ A sans-serif font that provides a very complete set of Unicode glyphs.
525
+ Cannot be styled as italic, bold or bold_italic.
526
+ Useful as a fallback font.
527
+
528
+ CAUTION: At the time of this writing, you cannot use the bundled fonts if you define your own custom fonts.
529
+ This limitation may be lifted in the future.
530
+
531
+ === Custom fonts
419
532
 
420
533
  The limited character set of WINANSI, or the bland look of the built-in fonts, may motivate you to load your own font.
421
534
  Custom fonts can enhance the look of your PDF theme substantially.
@@ -482,13 +595,17 @@ font:
482
595
  italic: roboto-italic.ttf
483
596
  bold: roboto-bold.ttf
484
597
  bold_italic: roboto-bold_italic.ttf
485
- RobotoLight:
598
+ Roboto Light:
486
599
  normal: roboto-light-normal.ttf
487
600
  italic: roboto-light-italic.ttf
488
601
  bold: roboto-light-bold.ttf
489
602
  bold_italic: roboto-light-bold_italic.ttf
490
603
  ----
491
604
 
605
+ TIP: Text in SVGs will use the font catalog from your theme.
606
+ We recommend that you match the font key to the name of the font seen by the operating system.
607
+ This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF.
608
+
492
609
  === Fallback fonts
493
610
 
494
611
  If one of your fonts is missing a character that is used in a document, such as special symbols, you can tell Asciidoctor PDF to retrieve the character from a fallback font.
@@ -549,16 +666,21 @@ TBW
549
666
 
550
667
  === Page
551
668
 
552
- [cols="1d,1d,2m"]
669
+ [cols="3,3,5m"]
553
670
  |===
554
671
  |Key |Value Type |Example
555
672
 
556
673
  |page_background_color
557
674
  |<<colors,color>>
558
- |background_color: ffffff
675
+ |background_color: #ffffff
676
+
677
+ |page_background_image
678
+ |path (relative to pdf-stylesdir)
679
+ |background_image: watermark.jpg
559
680
 
560
681
  |page_layout
561
- |portrait, landscape
682
+ |portrait, landscape +
683
+ (default: portrait)
562
684
  |layout: portrait
563
685
 
564
686
  |page_margin
@@ -566,13 +688,13 @@ TBW
566
688
  |margin: [0.5in, 0.67in, 0.67in, 0.67in]
567
689
 
568
690
  |page_size
569
- |named size, <<measurement-units,measurement array [2]>>
691
+ |named size, <<measurement-units,measurement array [width, height]>>
570
692
  |size: Letter
571
693
  |===
572
694
 
573
695
  === Base
574
696
 
575
- [cols="1d,1d,2m"]
697
+ [cols="3,3,5m"]
576
698
  |===
577
699
  |Key |Value Type |Example
578
700
 
@@ -582,17 +704,17 @@ TBW
582
704
 
583
705
  |base_font_family
584
706
  |<<fonts,font family name>>
585
- |font_family: NotoSerif
707
+ |font_family: Noto Serif
586
708
 
587
709
  |base_font_size
588
710
  |<<values,number>>
589
711
  |font_size: 10.5
590
712
 
591
- |base_line_height_length
713
+ |base_line_height_length^[1]^
592
714
  |<<values,number>>
593
715
  |line_height_length: 12
594
716
 
595
- |base_line_height
717
+ |base_line_height^[1]^
596
718
  |<<values,number>>
597
719
  |line_height: 1.14
598
720
 
@@ -622,12 +744,15 @@ TBW
622
744
 
623
745
  |base_border_color
624
746
  |<<colors,color>>
625
- |border_color: eee
747
+ |border_color: #eeeeee
626
748
  |===
627
749
 
628
- === Vertical and Horizontal Rhythm
750
+ ^[1]^ You should set either `line_height` or `line_height_length` and derive the value of the other using a calculation since these are correlated values.
751
+ For instance, if you set `line_height_length`, then use `line_height: $base_line_height_length / $base_font_size` to define the line height.
629
752
 
630
- [cols="1d,1d,2m"]
753
+ === Vertical and horizontal rhythm
754
+
755
+ [cols="3,3,5m"]
631
756
  |===
632
757
  |Key |Value Type |Example
633
758
 
@@ -640,15 +765,18 @@ TBW
640
765
  |horizontal_rhythm: 12
641
766
  |===
642
767
 
768
+ NOTE: Vertical and horizontal rhythm are used for vertical and horizontal spacing, respectively, when there a specific theme key is not defined for a certain purpose.
769
+ These keys predated the CSS-style theme system and are planned to be phased out.
770
+
643
771
  === Link
644
772
 
645
- [cols="1d,1d,2m"]
773
+ [cols="3,3,5m"]
646
774
  |===
647
775
  |Key |Value Type |Example
648
776
 
649
777
  |link_font_color
650
778
  |<<colors,color>>
651
- |font_color: 428BCA
779
+ |font_color: #428bca
652
780
 
653
781
  |link_font_family
654
782
  |<<fonts,font family name>>
@@ -663,21 +791,21 @@ TBW
663
791
  |font_style: normal
664
792
  |===
665
793
 
666
- === Literal Inline
794
+ === Literal inline
667
795
 
668
796
  The literal key is used for inline monospaced text in prose and table cells.
669
797
 
670
- [cols="1d,1d,2m"]
798
+ [cols="3,3,5m"]
671
799
  |===
672
800
  |Key |Value Type |Example
673
801
 
674
802
  |literal_font_color
675
803
  |<<colors,color>>
676
- |font_color: B12146
804
+ |font_color: #b12146
677
805
 
678
806
  |literal_font_family
679
807
  |<<fonts,font family name>>
680
- |font_family: Mplus1mn
808
+ |font_family: M+ 1mn
681
809
 
682
810
  |literal_font_size
683
811
  |<<values,number>>
@@ -690,39 +818,39 @@ The literal key is used for inline monospaced text in prose and table cells.
690
818
 
691
819
  === Heading
692
820
 
693
- [cols="1d,1d,2m"]
821
+ [cols="3,3,5m"]
694
822
  |===
695
823
  |Key |Value Type |Example
696
824
 
697
825
  |heading_font_color
698
826
  |<<colors,color>>
699
- |font_color: 333333
700
-
701
- |heading_h<n>_font_color
702
- |<<colors,color>>
703
- |h2_font_color: [0, 99%, 100%, 0]
827
+ |font_color: #333333
704
828
 
705
829
  |heading_font_family
706
830
  |<<fonts,font family name>>
707
- |font_family: NotoSerif
708
-
709
- |heading_h<n>_font_family
710
- |<<fonts,font family name>>
711
- |h4_font_family: Roboto
831
+ |font_family: Noto Serif
712
832
 
713
833
  |heading_font_size
714
834
  |<<values,number>>
715
835
  |font_size: 9
716
836
 
717
- |heading_h<n>_font_size
718
- |<<values,number>>
719
- |h6_font_size: round($base_font_size * 1.7)
720
-
721
837
  |heading_font_style
722
838
  |normal, italic, bold, bold_italic
723
839
  |font_style: bold
724
840
 
725
- |heading_h<n>_font_style
841
+ |heading_h<n>_font_color^[1]^
842
+ |<<colors,color>>
843
+ |h2_font_color: [0, 99%, 100%, 0]
844
+
845
+ |heading_h<n>_font_family^[1]^
846
+ |<<fonts,font family name>>
847
+ |h4_font_family: Roboto
848
+
849
+ |heading_h<n>_font_size^[1]^
850
+ |<<values,number>>
851
+ |h6_font_size: round($base_font_size * 1.7)
852
+
853
+ |heading_h<n>_font_style^[1]^
726
854
  |normal, italic, bold, bold_italic
727
855
  |h3_font_style: bold_italic
728
856
 
@@ -739,9 +867,11 @@ The literal key is used for inline monospaced text in prose and table cells.
739
867
  |margin_bottom: 9.600
740
868
  |===
741
869
 
742
- === Title Page
870
+ ^[1]^ `<n>` may be a number ranging from 1 to 6, representing each of the six heading levels.
743
871
 
744
- [cols="1d,1d,2m"]
872
+ === Title page
873
+
874
+ [cols="3,3,5m"]
745
875
  |===
746
876
  |Key |Value Type |Example
747
877
 
@@ -749,6 +879,18 @@ The literal key is used for inline monospaced text in prose and table cells.
749
879
  |left, center, right, justify
750
880
  |align: right
751
881
 
882
+ |title_page_logo_align
883
+ |left, center, right
884
+ |logo_align: right
885
+
886
+ |title_page_logo_image
887
+ |inline image macro
888
+ |+logo_image: image:logo.png[scaledwidth=25%]+
889
+
890
+ |title_page_logo_top
891
+ |percentage
892
+ |logo_top: 25%
893
+
752
894
  |title_page_title_top
753
895
  |percentage
754
896
  |title_top: 55%
@@ -759,7 +901,7 @@ The literal key is used for inline monospaced text in prose and table cells.
759
901
 
760
902
  |title_page_title_font_color
761
903
  |<<colors,color>>
762
- |title_font_color: 999999
904
+ |title_font_color: #999999
763
905
 
764
906
  |title_page_title_line_height
765
907
  |<<values,number>>
@@ -787,7 +929,7 @@ The literal key is used for inline monospaced text in prose and table cells.
787
929
 
788
930
  |title_page_authors_font_color
789
931
  |<<colors,color>>
790
- |authors_font_color: 181818
932
+ |authors_font_color: #181818
791
933
 
792
934
  |title_page_revision_margin_top
793
935
  |<<measurement-units,measurement>>
@@ -796,9 +938,7 @@ The literal key is used for inline monospaced text in prose and table cells.
796
938
 
797
939
  === Block
798
940
 
799
- // Blocks include admonition, example, quote, verse, sidebar, image, listing, literal, and table.
800
-
801
- [cols="1d,1d,2m"]
941
+ [cols="3,3,5m"]
802
942
  |===
803
943
  |Key |Value Type |Example
804
944
 
@@ -815,19 +955,37 @@ The literal key is used for inline monospaced text in prose and table cells.
815
955
  |margin_bottom: 1
816
956
  |===
817
957
 
958
+ Block styles are applied to the following block types:
959
+
960
+ [cols="1a,1a,1a", grid=none, frame=none]
961
+ |===
962
+ |
963
+ * admonition
964
+ * example
965
+ * quote
966
+ |
967
+ * verse
968
+ * sidebar
969
+ * image
970
+ |
971
+ * listing
972
+ * literal
973
+ * table
974
+ |===
975
+
818
976
  === Caption
819
977
 
820
- [cols="1d,1d,2m"]
978
+ [cols="3,3,5m"]
821
979
  |===
822
980
  |Key |Value Type |Example
823
981
 
824
982
  |caption_font_color
825
983
  |<<colors,color>>
826
- |font_color: 333333
984
+ |font_color: #333333
827
985
 
828
986
  |caption_font_family
829
987
  |<<fonts,font family name>>
830
- |font_family: Mplus1mn
988
+ |font_family: M+ 1mn
831
989
 
832
990
  |caption_font_size
833
991
  |<<values,number>>
@@ -852,17 +1010,17 @@ The literal key is used for inline monospaced text in prose and table cells.
852
1010
 
853
1011
  === Code
854
1012
 
855
- [cols="1d,1d,2m"]
1013
+ [cols="3,3,5m"]
856
1014
  |===
857
1015
  |Key |Value Type |Example
858
1016
 
859
1017
  |code_font_color
860
1018
  |<<colors,color>>
861
- |font_color: 333333
1019
+ |font_color: #333333
862
1020
 
863
1021
  |code_font_family
864
1022
  |<<fonts,font family name>>
865
- |font_family: Mplus1mn
1023
+ |font_family: M+ 1mn
866
1024
 
867
1025
  |code_font_size
868
1026
  |<<values,number>>
@@ -882,11 +1040,11 @@ The literal key is used for inline monospaced text in prose and table cells.
882
1040
 
883
1041
  |code_background_color
884
1042
  |<<colors,color>>
885
- |background_color: F5F5F5
1043
+ |background_color: #f5f5f5
886
1044
 
887
1045
  |code_border_color
888
1046
  |<<colors,color>>
889
- |border_color: CCCCCC
1047
+ |border_color: #cccccc
890
1048
 
891
1049
  |code_border_radius
892
1050
  |<<values,number>>
@@ -899,17 +1057,17 @@ The literal key is used for inline monospaced text in prose and table cells.
899
1057
 
900
1058
  === Blockquote
901
1059
 
902
- [cols="1d,1d,2m"]
1060
+ [cols="3,3,5m"]
903
1061
  |===
904
1062
  |Key |Value Type |Example
905
1063
 
906
1064
  |blockquote_font_color
907
1065
  |<<colors,color>>
908
- |font_color: 333333
1066
+ |font_color: #333333
909
1067
 
910
1068
  |blockquote_font_family
911
1069
  |<<fonts,font family name>>
912
- |font_family: Notoserif
1070
+ |font_family: Noto Serif
913
1071
 
914
1072
  |blockquote_font_size
915
1073
  |<<values,number>>
@@ -925,7 +1083,7 @@ The literal key is used for inline monospaced text in prose and table cells.
925
1083
 
926
1084
  |blockquote_border_color
927
1085
  |<<colors,color>>
928
- |border_color: EEEEEE
1086
+ |border_color: #eeeeee
929
1087
 
930
1088
  |blockquote_cite_font_size
931
1089
  |<<values,number>>
@@ -933,11 +1091,11 @@ The literal key is used for inline monospaced text in prose and table cells.
933
1091
 
934
1092
  |blockquote_cite_font_color
935
1093
  |<<colors,color>>
936
- |cite_font_color: 999999
1094
+ |cite_font_color: #999999
937
1095
 
938
1096
  |blockquote_cite_font_family
939
1097
  |<<fonts,font family name>>
940
- |cite_font_family: Notoserif
1098
+ |cite_font_family: Noto Serif
941
1099
 
942
1100
  |blockquote_cite_font_style
943
1101
  |normal, italic, bold, bold_italic
@@ -947,13 +1105,13 @@ The literal key is used for inline monospaced text in prose and table cells.
947
1105
 
948
1106
  === Sidebar
949
1107
 
950
- [cols="1d,1d,2m"]
1108
+ [cols="3,3,5m"]
951
1109
  |===
952
1110
  |Key |Value Type |Example
953
1111
 
954
1112
  |sidebar_border_color
955
1113
  |<<colors,color>>
956
- |border_color: FFFFFF
1114
+ |border_color: #ffffff
957
1115
 
958
1116
  |sidebar_border_radius
959
1117
  |<<values,number>>
@@ -965,15 +1123,15 @@ The literal key is used for inline monospaced text in prose and table cells.
965
1123
 
966
1124
  |sidebar_background_color
967
1125
  |<<colors,color>>
968
- |background_color: EEEEEE
1126
+ |background_color: #eeeeee
969
1127
 
970
1128
  |sidebar_title_font_color
971
1129
  |<<colors,color>>
972
- |title_font_color: 333333
1130
+ |title_font_color: #333333
973
1131
 
974
1132
  |sidebar_title_font_family
975
1133
  |<<fonts,font family name>>
976
- |title_font_family: NotoSerif
1134
+ |title_font_family: Noto Serif
977
1135
 
978
1136
  |sidebar_title_font_size
979
1137
  |<<values,number>>
@@ -990,13 +1148,13 @@ The literal key is used for inline monospaced text in prose and table cells.
990
1148
 
991
1149
  === Example
992
1150
 
993
- [cols="1d,1d,2m"]
1151
+ [cols="3,3,5m"]
994
1152
  |===
995
1153
  |Key |Value Type |Example
996
1154
 
997
1155
  |example_border_color
998
1156
  |<<colors,color>>
999
- |border_color: EEEEEE
1157
+ |border_color: #eeeeee
1000
1158
 
1001
1159
  |example_border_radius
1002
1160
  |<<values,number>>
@@ -1008,18 +1166,18 @@ The literal key is used for inline monospaced text in prose and table cells.
1008
1166
 
1009
1167
  |example_background_color
1010
1168
  |<<colors,color>>
1011
- |background_color: transparent
1169
+ |background_color: #fffef7
1012
1170
  |===
1013
1171
 
1014
1172
  === Admonition
1015
1173
 
1016
- [cols="1d,1d,2m"]
1174
+ [cols="3,3,5m"]
1017
1175
  |===
1018
1176
  |Key |Value Type |Example
1019
1177
 
1020
1178
  |admonition_border_color
1021
1179
  |<<colors,color>>
1022
- |border_color: EEEEEE
1180
+ |border_color: #eeeeee
1023
1181
 
1024
1182
  |admonition_border_width
1025
1183
  |<<values,number>>
@@ -1028,7 +1186,7 @@ The literal key is used for inline monospaced text in prose and table cells.
1028
1186
 
1029
1187
  === Image
1030
1188
 
1031
- [cols="1d,1d,2m"]
1189
+ [cols="3,3,5m"]
1032
1190
  |===
1033
1191
  |Key |Value Type |Example
1034
1192
 
@@ -1039,7 +1197,7 @@ The literal key is used for inline monospaced text in prose and table cells.
1039
1197
 
1040
1198
  === Lead
1041
1199
 
1042
- [cols="1d,1d,2m"]
1200
+ [cols="3,3,5m"]
1043
1201
  |===
1044
1202
  |Key |Value Type |Example
1045
1203
 
@@ -1054,13 +1212,13 @@ The literal key is used for inline monospaced text in prose and table cells.
1054
1212
 
1055
1213
  === Abstract
1056
1214
 
1057
- [cols="1d,1d,2m"]
1215
+ [cols="3,3,5m"]
1058
1216
  |===
1059
1217
  |Key |Value Type |Example
1060
1218
 
1061
1219
  |abstract_font_color
1062
1220
  |<<colors,color>>
1063
- |font_color: 5C6266
1221
+ |font_color: #5c6266
1064
1222
 
1065
1223
  |abstract_font_size
1066
1224
  |<<values,number>>
@@ -1075,15 +1233,24 @@ The literal key is used for inline monospaced text in prose and table cells.
1075
1233
  |font_style: italic
1076
1234
  |===
1077
1235
 
1078
- === Thematic Break
1236
+ === Thematic break
1079
1237
 
1080
- [cols="1d,1d,2m"]
1238
+ [cols="3,3,5m"]
1081
1239
  |===
1082
1240
  |Key |Value Type |Example
1083
1241
 
1084
1242
  |thematic_break_border_color
1085
1243
  |<<colors,color>>
1086
- |border_colorL EEEEEE
1244
+ |border_color: #eeeeee
1245
+
1246
+ |thematic_break_border_style
1247
+ |solid, double, dashed, dotted +
1248
+ (default: solid)
1249
+ |border_style: dashed
1250
+
1251
+ |thematic_break_border_width
1252
+ |<<measurement-units,measurement>>
1253
+ |border_width: 0.5
1087
1254
 
1088
1255
  |thematic_break_margin_top
1089
1256
  |<<measurement-units,measurement>>
@@ -1096,7 +1263,7 @@ The literal key is used for inline monospaced text in prose and table cells.
1096
1263
 
1097
1264
  === Description list
1098
1265
 
1099
- [cols="1d,1d,2m"]
1266
+ [cols="3,3,5m"]
1100
1267
  |===
1101
1268
  |Key |Value Type |Example
1102
1269
 
@@ -1112,7 +1279,7 @@ The literal key is used for inline monospaced text in prose and table cells.
1112
1279
 
1113
1280
  === Outline list
1114
1281
 
1115
- [cols="1d,1d,2m"]
1282
+ [cols="3,3,5m"]
1116
1283
  |===
1117
1284
  |Key |Value Type |Example
1118
1285
 
@@ -1127,25 +1294,25 @@ The literal key is used for inline monospaced text in prose and table cells.
1127
1294
 
1128
1295
  === Table
1129
1296
 
1130
- [cols="1d,1d,2m"]
1297
+ [cols="3,3,5m"]
1131
1298
  |===
1132
1299
  |Key |Value Type |Example
1133
1300
 
1134
1301
  |table_background_color
1135
1302
  |<<colors,color>>
1136
- |background_color: FFFFFF
1303
+ |background_color: #ffffff
1137
1304
 
1138
1305
  |table_even_row_background_color
1139
1306
  |<<colors,color>>
1140
- |even_row_background_color: F9F9F9
1307
+ |even_row_background_color: #f9f9f9
1141
1308
 
1142
1309
  |table_foot_background_color
1143
1310
  |<<colors,color>>
1144
- |foot_background_color: F0F0F0
1311
+ |foot_background_color: #f0f0f0
1145
1312
 
1146
1313
  |table_border_color
1147
1314
  |<<colors,color>>
1148
- |border_color: DDDDDD
1315
+ |border_color: #dddddd
1149
1316
 
1150
1317
  |table_border_width
1151
1318
  |<<values,number>>
@@ -1157,9 +1324,9 @@ The literal key is used for inline monospaced text in prose and table cells.
1157
1324
  |===
1158
1325
 
1159
1326
  [[key-toc]]
1160
- === Table of Contents
1327
+ === Table of contents
1161
1328
 
1162
- [cols="1d,1d,2m"]
1329
+ [cols="3,3,5m"]
1163
1330
  |===
1164
1331
  |Key |Value Type |Example
1165
1332
 
@@ -1169,19 +1336,19 @@ The literal key is used for inline monospaced text in prose and table cells.
1169
1336
 
1170
1337
  |toc_dot_leader_color
1171
1338
  |<<colors,color>>
1172
- |dot_leader_color: 999999
1339
+ |dot_leader_color: #999999
1173
1340
 
1174
1341
  |toc_font_color
1175
1342
  |<<colors,color>>
1176
- |font_color: 333333
1343
+ |font_color: #333333
1177
1344
 
1178
1345
  |toc_h<n>_font_color
1179
1346
  |<<colors,color>>
1180
- |h3_font_color: 999999
1347
+ |h3_font_color: #999999
1181
1348
 
1182
1349
  |toc_font_family
1183
1350
  |<<fonts,font family name>>
1184
- |font_family: NotoSerif
1351
+ |font_family: Noto Serif
1185
1352
 
1186
1353
  |toc_font_size
1187
1354
  |<<values,number>>
@@ -1204,19 +1371,24 @@ The literal key is used for inline monospaced text in prose and table cells.
1204
1371
  |indent: 20
1205
1372
  |===
1206
1373
 
1207
- === Running Header & Footer
1374
+ === Running header & footer
1208
1375
 
1209
- [cols="3,5,5m"]
1376
+ [cols="3,3,5m"]
1210
1377
  |===
1211
1378
  |Key |Value Type |Example
1212
1379
 
1213
1380
  |header_background_color
1214
1381
  |<<colors,color>>
1215
- |background_color: EEEEEE
1382
+ |background_color: #eeeeee
1216
1383
 
1217
1384
  |header_border_color
1218
1385
  |<<colors,color>>
1219
- |border_color: DDDDDD
1386
+ |border_color: #dddddd
1387
+
1388
+ |header_border_style
1389
+ |solid, double, dashed, dotted +
1390
+ (default: solid)
1391
+ |border_style: dashed
1220
1392
 
1221
1393
  |header_border_width
1222
1394
  |<<measurement-units,measurement>>
@@ -1224,11 +1396,11 @@ The literal key is used for inline monospaced text in prose and table cells.
1224
1396
 
1225
1397
  |header_font_color
1226
1398
  |<<colors,color>>
1227
- |font_color: 333333
1399
+ |font_color: #333333
1228
1400
 
1229
1401
  |header_font_family
1230
1402
  |<<fonts,font family name>>
1231
- |font_family: NotoSerif
1403
+ |font_family: Noto Serif
1232
1404
 
1233
1405
  |header_font_size
1234
1406
  |<<values,number>>
@@ -1254,18 +1426,22 @@ The literal key is used for inline monospaced text in prose and table cells.
1254
1426
  |top, center, bottom
1255
1427
  |valign: center
1256
1428
 
1257
- |header_<side>_content_<align>*
1429
+ |header_<side>_content_<align>^[1]^
1258
1430
  |quoted string
1259
- v|`recto_content:
1260
- right: '\{page-number}'`
1431
+ |right: '\{page-number}'
1261
1432
 
1262
1433
  |footer_background_color
1263
1434
  |<<colors,color>>
1264
- |background_color: EEEEEE
1435
+ |background_color: #eeeeee
1265
1436
 
1266
1437
  |footer_border_color
1267
1438
  |<<colors,color>>
1268
- |border_color: DDDDDD
1439
+ |border_color: #dddddd
1440
+
1441
+ |footer_border_style
1442
+ |solid, double, dashed, dotted +
1443
+ (default: solid)
1444
+ |border_style: dashed
1269
1445
 
1270
1446
  |footer_border_width
1271
1447
  |<<measurement-units,measurement>>
@@ -1273,11 +1449,11 @@ v|`recto_content:
1273
1449
 
1274
1450
  |footer_font_color
1275
1451
  |<<colors,color>>
1276
- |font_color: 333333
1452
+ |font_color: #333333
1277
1453
 
1278
1454
  |footer_font_family
1279
1455
  |<<fonts,font family name>>
1280
- |font_family: NotoSerif
1456
+ |font_family: Noto Serif
1281
1457
 
1282
1458
  |footer_font_size
1283
1459
  |<<values,number>>
@@ -1303,13 +1479,12 @@ v|`recto_content:
1303
1479
  |top, center, bottom
1304
1480
  |valign: top
1305
1481
 
1306
- |footer_<side>_content_<align>*
1482
+ |footer_<side>_content_<align>^[1]^
1307
1483
  |quoted string
1308
- v|`recto_content:
1309
- center: '\{page-number}'`
1484
+ |center: '\{page-number}'
1310
1485
  |===
1311
1486
 
1312
- {asterisk} `<side>` can be `recto` (odd pages) or `verso` (even pages).
1487
+ ^[1]^ `<side>` can be `recto` (odd pages) or `verso` (even pages).
1313
1488
  `<align>` can be `left`, `center` or `right`.
1314
1489
 
1315
1490
  IMPORTANT: You must define a height for the running header or footer, respectively, or it will not be shown.
@@ -1317,6 +1492,8 @@ IMPORTANT: You must define a height for the running header or footer, respective
1317
1492
  NOTE: The background color spans the width of the page.
1318
1493
  When a background color is specified, the border also spans the width of the page.
1319
1494
 
1495
+ ==== Implicit attributes
1496
+
1320
1497
  In addition to the document-level attributes defined in the AsciiDoc document, the following attributes are available when defining the content keys in the footer:
1321
1498
 
1322
1499
  * page-count
@@ -1327,18 +1504,95 @@ In addition to the document-level attributes defined in the AsciiDoc document, t
1327
1504
  * section-title
1328
1505
  * section-or-chapter-title
1329
1506
 
1330
- For example:
1507
+ Here's an example that shows how these attributes can be used in the running footer:
1331
1508
 
1332
1509
  [source,yaml]
1333
1510
  ----
1334
1511
  footer:
1335
1512
  height: 0.75in
1336
1513
  recto_content:
1337
- right: '{section-or-chapter-title} | {page-number}'
1514
+ right: '{section-or-chapter-title} | *{page-number}*'
1515
+ verso_content:
1516
+ left: '*{page-number}* | {chapter-title}'
1517
+ ----
1518
+
1519
+ TIP: You can use most AsciiDoc inline formatting in the values of these keys.
1520
+ For instance, to make the text bold, surround it in asterisks (as shown above).
1521
+ One exception to this rule are inline images, which are described in the next section.
1522
+
1523
+ ==== Images
1524
+
1525
+ You can add an image to the running header or footer using the AsciiDoc inline image syntax.
1526
+ Note that the image must be the whole value for a given position (left, center or right).
1527
+ It cannot be combined with text.
1528
+
1529
+ Here's an example of how to use an image in the running header (which also applies for the footer).
1530
+
1531
+ [source,yaml]
1532
+ ----
1533
+ header:
1534
+ height: 0.75in
1535
+ image_valign: 2 # <1>
1536
+ recto_content:
1537
+ center: image:footer-logo.png[width=80]
1338
1538
  verso_content:
1339
- left: '{page-number} | {chapter-title}'
1539
+ center: $header_recto_content_center
1340
1540
  ----
1541
+ <1> You can use the `footer_valign` attribute to slighly nudge the image up or down.
1542
+
1543
+ CAUTION: The image must fit in the allotted space for the running header or footer.
1544
+ Otherwise, you will run into layout issues.
1545
+ Adjust the width attribute accordingly.
1546
+
1547
+ == Applying your theme
1548
+
1549
+ After creating a theme, you'll need to tell Asciidoctor PDF where to find it.
1550
+ This is done using AsciiDoc attributes.
1551
+
1552
+ There are three AsciiDoc attributes that tell Asciidoctor PDF how to locate and apply your theme.
1553
+
1554
+ pdf-stylesdir:: The directory where the theme file is located.
1555
+ _Specifying an absolute path is recommended._
1556
+ +
1557
+ If you use images in your theme, image paths are resolved relative to this directory.
1558
+
1559
+ pdf-style:: The name of the YAML theme file to load.
1560
+ If the name ends with `.yml`, it's assumed to be the complete name of a file.
1561
+ Otherwise, `-theme.yml` is appended to the name to make the file name (i.e., `<name>-theme.yml`).
1562
+
1563
+ pdf-fontsdir:: The directory where the fonts used by your theme, if any, are located.
1564
+ _Specifying an absolute path is recommended._
1565
+
1566
+ Let's assume that you've put your theme files inside a directory named `resources` with the following layout:
1567
+
1568
+ ....
1569
+ document.adoc
1570
+ resources/
1571
+ themes/
1572
+ basic-theme.yml
1573
+ fonts/
1574
+ roboto-normal.ttf
1575
+ roboto-italic.ttf
1576
+ roboto-bold.ttf
1577
+ roboto-bold_italic.ttf
1578
+ ....
1579
+
1580
+ Here's how you'd load your theme when calling Asciidoctor PDF:
1581
+
1582
+ $ asciidoctor-pdf -a pdf-stylesdir=resources/themes -a pdf-style=basic -a pdf-fontsdir=resources/fonts
1583
+
1584
+ If all goes well, Asciidoctor PDF should run without an error or warning.
1585
+
1586
+ NOTE: You only need to specify the `pdf-fontsdir` if you are using custom fonts in your theme.
1587
+
1588
+ You can skip setting the `pdf-stylesdir` attribute and just pass the absolute path of your theme file to the `pdf-style` attribute.
1589
+
1590
+ $ asciidoctor-pdf -a pdf-style=resources/themes/basic-theme.yml -a pdf-fontsdir=resources/fonts
1591
+
1592
+ However, in this case, image paths in your theme won't be resolved properly.
1341
1593
 
1342
- == Applying a Theme
1594
+ Paths are resolved relative to the current directory.
1595
+ However, in the future, this may change so that paths are resolved relative to the base directory (typically the document's directory).
1596
+ Therefore, it's recommend that you specify absolute paths for now to future-proof your configuration.
1343
1597
 
1344
- PENDING
1598
+ $ asciidoctor-pdf -a pdf-stylesdir=/path/to/resources/themes -a pdf-style=basic -a pdf-fontsdir=/path/to/resources/fonts