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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +62 -42
  3. data/bin/asciidoctor-pdf +3 -2
  4. data/data/fonts/{LICENSE-noto-fonts-2014-01-30 → LICENSE-noto-fonts-2014-11-17} +0 -0
  5. data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
  6. data/data/fonts/mplus1mn-bolditalic-ascii.ttf +0 -0
  7. data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
  8. data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
  9. data/data/fonts/notoserif-bold-latin.ttf +0 -0
  10. data/data/fonts/notoserif-bolditalic-latin.ttf +0 -0
  11. data/data/fonts/notoserif-italic-latin.ttf +0 -0
  12. data/data/fonts/notoserif-regular-latin.ttf +0 -0
  13. data/data/themes/default-theme.yml +95 -43
  14. data/docs/theming-guide.adoc +1344 -0
  15. data/lib/asciidoctor-pdf/asciidoctor_ext.rb +2 -0
  16. data/lib/asciidoctor-pdf/asciidoctor_ext/list.rb +9 -0
  17. data/lib/asciidoctor-pdf/asciidoctor_ext/list_item.rb +16 -0
  18. data/lib/asciidoctor-pdf/converter.rb +982 -294
  19. data/lib/asciidoctor-pdf/core_ext/array.rb +1 -1
  20. data/lib/asciidoctor-pdf/core_ext/ostruct.rb +2 -2
  21. data/lib/asciidoctor-pdf/pdf_core_ext.rb +2 -0
  22. data/lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb +25 -0
  23. data/lib/asciidoctor-pdf/pdfmarks.rb +9 -5
  24. data/lib/asciidoctor-pdf/prawn_ext.rb +1 -0
  25. data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +8 -8
  26. data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +56 -14
  27. data/lib/asciidoctor-pdf/prawn_ext/formatted_text/transform.rb +52 -10
  28. data/lib/asciidoctor-pdf/prawn_ext/images.rb +22 -0
  29. data/lib/asciidoctor-pdf/sanitizer.rb +37 -0
  30. data/lib/asciidoctor-pdf/theme_loader.rb +130 -30
  31. data/lib/asciidoctor-pdf/version.rb +1 -1
  32. metadata +41 -23
  33. data/data/fonts/LICENSE-liberation-fonts-2.00.1 +0 -102
  34. data/data/fonts/liberationmono-bold-latin.ttf +0 -0
  35. data/data/fonts/liberationmono-bolditalic-latin.ttf +0 -0
  36. data/data/fonts/liberationmono-italic-latin.ttf +0 -0
  37. data/data/fonts/liberationmono-regular-latin.ttf +0 -0
  38. data/data/fonts/mplus1p-bold-latin.ttf +0 -0
  39. data/data/fonts/mplus1p-light-latin.ttf +0 -0
  40. data/data/fonts/mplus1p-regular-latin.ttf +0 -0
  41. data/data/themes/asciidoctor-theme.yml +0 -174
  42. data/examples/chronicles.adoc +0 -429
  43. data/examples/chronicles.pdf +0 -0
  44. data/examples/edge-cases.adoc +0 -60
  45. data/examples/example-pdf-screenshot.png +0 -0
  46. data/examples/example.adoc +0 -27
  47. data/examples/example.pdf +0 -0
  48. data/examples/sample-title-logo.jpg +0 -0
  49. data/examples/wolpertinger.jpg +0 -0
@@ -0,0 +1,1344 @@
1
+ = Asciidoctor PDF Theming Guide
2
+ Dan Allen <https://github.com/mojavelinux>
3
+ :toc: macro
4
+ :icons: font
5
+ :idprefix:
6
+ :idseparator: -
7
+ :window: _blank
8
+
9
+ ////
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
19
+ ////
20
+
21
+ The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file that Asciidoctor PDF generates from AsciiDoc.
22
+ The theme is driven by a YAML-based configuration file.
23
+ This document explains how the theming system works, how to define a custom theme and how to enable the theme when running Asciidoctor PDF.
24
+
25
+ toc::[]
26
+
27
+ == Language Overview
28
+
29
+ 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
+ Therefore, if you have a background in web design, the theme language should be immediately familiar to you.
31
+
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`).
34
+
35
+ A theme (or style) is described in a YAML-based data format and stored in a dedicated theme file.
36
+ YAML is a human-friendly data format that resembles CSS and helps to describe the theme.
37
+ The theme language adds some extra features to YAML, such as variables, basic math, measurements and color values.
38
+ These enhancements will be explained in detail in later sections.
39
+
40
+ The theme file must be named _<name>-theme.yml_, where `<name>` is the name of the theme.
41
+
42
+ Here's an example of a basic theme file:
43
+
44
+ .basic-theme.yml
45
+ [source,yaml]
46
+ ----
47
+ page:
48
+ layout: portrait
49
+ margin: [0.75in, 1in, 0.75in, 1in]
50
+ size: Letter
51
+ base:
52
+ font_color: #333333
53
+ font_family: Times-Roman
54
+ font_size: 12
55
+ line_height_length: 17
56
+ line_height: $base_line_height_length / $base_font_size
57
+ vertical_rhythm: $base_line_height_length
58
+ heading:
59
+ font_color: #262626
60
+ font_size: 17
61
+ font_style: bold
62
+ line_height: 1.2
63
+ margin_bottom: $vertical_rhythm
64
+ link:
65
+ font_color: #002FA7
66
+ outline_list:
67
+ indent: $base_font_size * 1.5
68
+ ----
69
+
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.
72
+ All the available keys are documented in <<keys>>.
73
+
74
+ Keys may be nested to an arbitrary depth to eliminate redundant prefixes (an approach inspired by SASS).
75
+ Once the theme is loaded, all keys are flattened into a single map of qualified keys.
76
+ Nesting is simply a shorthand way of organizing the keys.
77
+ In the end, a theme is just a map of key/value pairs.
78
+
79
+ Nested keys are adjoined to their parent key with an underscore (`_`).
80
+ This means the selector part (e.g., `link`) is combined with the property name (e.g., `font_color`) into a single, qualified key (e.g., `link_font_color`).
81
+
82
+ For example, let's assume we want to set the base (i.e., global) font size and color.
83
+ These keys may be written longhand:
84
+
85
+ [source,yaml]
86
+ ----
87
+ base_font_color: #333333
88
+ base_font_family: Times-Roman
89
+ base_font_size: 12
90
+ ----
91
+
92
+ Or, to avoid having to type the prefix `base_` multiple times, the keys may be written hierarchically:
93
+
94
+ [source,yaml]
95
+ ----
96
+ base:
97
+ font_color: #333333
98
+ font_family: Times-Roman
99
+ font_size: 12
100
+ ----
101
+
102
+ Or even:
103
+
104
+ [source,yaml]
105
+ ----
106
+ base:
107
+ font:
108
+ color: #333333
109
+ family: Times-Roman
110
+ size: 12
111
+ ----
112
+
113
+ Each level of nesting must be indented by twice the amount of indentation of the parent level.
114
+ Also note the placement of the colon after each key name.
115
+
116
+ == Values
117
+
118
+ The value of a key may be one of the following types:
119
+
120
+ * String
121
+ - Font family name (e.g., Roboto)
122
+ - Font style (normal, bold, italic, bold_italic)
123
+ - Alignment (left, center, right, justify)
124
+ - Color as hex string (e.g., #ffffff)
125
+ - Image path
126
+ * Number (integer or float) with optional units
127
+ * Array
128
+ - Color as RGB array (e.g., [51, 51, 51])
129
+ - Color CMYK array (e.g., [50, 100, 0, 0])
130
+ - Margin (e.g., [1in, 1in, 1in, 1in])
131
+ - Padding (e.g., [1in, 1in, 1in, 1in])
132
+ * Variable reference (e.g., $base_font_color)
133
+ * Math expression
134
+
135
+ Note that keys almost always require a value of a specific type, as documented in <<keys>>.
136
+
137
+ === Inheritance
138
+
139
+ Like CSS, inheritance is a key feature in the Asciidoctor PDF theme language.
140
+ 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.
142
+
143
+ The following keys are inherited:
144
+
145
+ * font_family
146
+ * font_color
147
+ * font_size
148
+ * font_style
149
+ * line_height (currently some exceptions)
150
+ * text_transform (only for headings)
151
+ * margin_bottom (falls back to $vertical_rhythm)
152
+
153
+ .Heading Inheritance
154
+ ****
155
+ Headings are special in that they inherit starting from a specific heading level (e.g., `heading_font_size_h2`) to the heading category (e.g., `heading_font_size`) and then directly to the base value (e.g., `base_font_size`), skipping any enclosing context.
156
+ ****
157
+
158
+ === Variables
159
+
160
+ 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
+ Variables consist of the key name preceded by a dollar (`$`) (e.g., `$base_font_size`).
162
+ 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).
164
+
165
+ For example, once the following line is processed,
166
+
167
+ [source,yaml]
168
+ ----
169
+ base:
170
+ font_color: #333333
171
+ ----
172
+
173
+ the variable `$base_font_color` will be available for use in subsequent lines and will resolve to `#333333`.
174
+
175
+ Let's say you want to make the font color of the sidebar title the same as the heading font color.
176
+ Just assign the value `$heading_font_color` to the `$sidebar_title_font_color`.
177
+
178
+ [source,yaml]
179
+ ----
180
+ heading:
181
+ font_color: #191919
182
+ sidebar:
183
+ title:
184
+ font_color: $heading_font_color
185
+ ----
186
+
187
+ You can also use variables in math expressions to use one value to build another.
188
+ This is commonly done to set font sizes proportionally.
189
+ It also makes it easy to test different values very quickly.
190
+
191
+ [source,yaml]
192
+ ----
193
+ base:
194
+ font_size: 12
195
+ font_size_large: $base_font_size * 1.25
196
+ font_size_small: $base_font_size * 0.85
197
+ ----
198
+
199
+ We'll cover more about math expressions in the next section.
200
+
201
+ === Math Expressions & Functions
202
+
203
+ The theme language supports basic math operations to support calculated values.
204
+ The following table lists the supported operations and the corresponding operator for each.
205
+
206
+ [%header%autowidth]
207
+ |===
208
+ |Operation |Operator
209
+
210
+ |multiply
211
+ |*
212
+
213
+ |divide
214
+ |/
215
+
216
+ |add
217
+ |+
218
+
219
+ |subtract
220
+ |-
221
+ |===
222
+
223
+ NOTE: Like programming languages, multiple and divide take precedence over add and subtract.
224
+
225
+ The operator must always be surrounded by a space on either side.
226
+ Here's an example of a math expression with fixed values.
227
+
228
+ [source,yaml]
229
+ ----
230
+ conum:
231
+ line_height: 4 / 3
232
+ ----
233
+
234
+ Variables may be used in place of numbers anywhere in the expression:
235
+
236
+ [source,yaml]
237
+ ----
238
+ base:
239
+ font_size: 12
240
+ font_size_large: $base_font_size * 1.25
241
+ ----
242
+
243
+ Values used in a math expression are automatically coerced to a float value before the operation.
244
+ If the result of the expression is an integer, the value is coerced to an integer afterwards.
245
+
246
+ IMPORTANT: Numeric values less than 1 must have a 0 before the decimal point (e.g., 0.85).
247
+
248
+ The theme language also supports several functions for rounding the result of a math expression.
249
+ The following functions may be used if they surround the whole value or expression for a key.
250
+
251
+ round(...):: Rounds the number to the nearest half integer.
252
+ floor(...):: Rounds the number up to the next integer.
253
+ ceil(...):: Rounds the number down the previous integer.
254
+
255
+ You might use these functions in font size calculations so that you get more exact values.
256
+
257
+ [source,yaml]
258
+ ----
259
+ base:
260
+ font_size: 12.5
261
+ font_size_large: ceil($base_font_size * 1.25)
262
+ ----
263
+
264
+ === Measurement Units
265
+
266
+ Several of the keys require a value in points (pt), the unit of measure for the PDF canvas.
267
+ A point is defined as 1/72 of an inch.
268
+ However, us humans like to think in real world units like inches (in), centimeters (cm) or millimeters (mm).
269
+ You can let the theme do this conversion for you automatically by adding a unit notation next to any number.
270
+
271
+ The following units are supported:
272
+
273
+ [%header%autowidth]
274
+ |===
275
+ |Unit |Suffix
276
+
277
+ |Inches
278
+ |in
279
+
280
+ |Centimeter
281
+ |cm
282
+
283
+ |Millimeter
284
+ |mm
285
+
286
+ |Points
287
+ |pt
288
+ |===
289
+
290
+ Here's an example of how you can use inches to define the page margins:
291
+
292
+ [source,yaml]
293
+ ----
294
+ page:
295
+ margin: [0.75in, 1in, 0.75in, 1in]
296
+ ----
297
+
298
+ === Colors
299
+
300
+ The theme language supports color values in three formats:
301
+
302
+ Hex:: A string of 3 or 6 characters with an optional leading `#`.
303
+ RGB:: An array of numeric values ranging from 0 to 255.
304
+ CMYK:: An array of numeric values ranging from 0 to 1 or from 0% to 100%.
305
+
306
+ ==== Hex
307
+
308
+ The hex color value is likely most familiar to web developers.
309
+ The value must be either 3 or 6 characters (case insensitive) with an optional leading hash (`#`).
310
+
311
+ The following are all equivalent values for the color red:
312
+
313
+ [%autowidth,cols=4]
314
+ |===
315
+ |f00
316
+ |#f00
317
+ |ff0000
318
+ |#ff0000
319
+ |F00
320
+ |#F00
321
+ |FF0000
322
+ |#FF0000
323
+ |===
324
+
325
+ Here's how a hex color value appears in the theme file:
326
+
327
+ [source,yaml]
328
+ ----
329
+ base:
330
+ font_color: #ff0000
331
+ ----
332
+
333
+ ==== RGB
334
+
335
+ An RGB array value must be three numbers ranging from 0 to 255.
336
+ The values must be separated by commas and be surrounded by square brackets.
337
+
338
+ NOTE: An RGB array is automatically converted to a hex string internally, so there's no difference between ff0000 and [255, 0, 0].
339
+
340
+ Here's how to specify the color red in RGB:
341
+
342
+ * [255, 0, 0]
343
+
344
+ Here's how a RGB color value appears in the theme file:
345
+
346
+ [source,yaml]
347
+ ----
348
+ base:
349
+ font_color: [255, 0, 0]
350
+ ----
351
+
352
+ ==== CMYK
353
+
354
+ A CMYK array value must be four numbers ranging from 0 and 1 or from 0% to 100%.
355
+ The values must be separated by commas and be surrounded by square brackets.
356
+
357
+ Unlike the RGB array, the CMYK array _is not_ converted to a hex string internally.
358
+ PDF has native support for CMYK colors, so you can preserve the original color values in the final PDF.
359
+
360
+ Here's how to specify the color red in CMYK:
361
+
362
+ * [0, 0.99, 1, 0]
363
+ * [0, 99%, 100%, 0]
364
+
365
+ Here's how a CMYK color value appears in the theme file:
366
+
367
+ [source,yaml]
368
+ ----
369
+ base:
370
+ font_color: [0, 0.99, 1, 0]
371
+ ----
372
+
373
+ === Images
374
+
375
+ PENDING
376
+
377
+ == Fonts
378
+
379
+ You can select from built-in PDF fonts or custom fonts loaded from TrueType font (TTF) files.
380
+ If you want to use custom fonts, you must first declare them in your theme file.
381
+
382
+ === Built-in Fonts
383
+
384
+ The names of the built-in fonts (for general-purpose text) are as follows:
385
+
386
+ [%header%autowidth]
387
+ |===
388
+ |Font Name |Font Family
389
+
390
+ |Helvetica
391
+ |sans-serif
392
+
393
+ |Times-Roman
394
+ |serif
395
+
396
+ |Courier
397
+ |monospace
398
+ |===
399
+
400
+ Using a built-in font requires no additional files.
401
+ You can use the key anywhere a `font_family` property is accepted in the theme file.
402
+ For example:
403
+
404
+ [source,yaml]
405
+ ----
406
+ base:
407
+ font_family: Times-Roman
408
+ ----
409
+
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.
411
+ WINANSI includes most of the characters needed for writing in Western languages (English, French, Spanish, etc).
412
+ For anything outside of that, PDF is BYOF (Bring Your Own Font).
413
+
414
+ Even though the built-in fonts require the content to be encoded in WINANSI, _you still type your AsciiDoc document in UTF-8_.
415
+ 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
+
418
+ === Custom Fonts
419
+
420
+ The limited character set of WINANSI, or the bland look of the built-in fonts, may motivate you to load your own font.
421
+ Custom fonts can enhance the look of your PDF theme substantially.
422
+
423
+ To start, you need to find a collection of TTF file of the font you want to use.
424
+ A collection typically consists of all four styles of a font:
425
+
426
+ * normal
427
+ * italic
428
+ * bold
429
+ * bold_italic
430
+
431
+ You'll need all four styles to support AsciiDoc content properly.
432
+ _Asciidoctor PDF cannot italicize a font that is not italic like a browser can._
433
+
434
+ Once you've obtained the TTF files, put them into a directory in your project where you want to store the fonts.
435
+ It's recommended that you name them consistently so it's easier to type the names in the theme file.
436
+
437
+ Let's assume the name of the font is https://github.com/google/roboto/tree/master/out/RobotoTTF[Roboto].
438
+ Name the files as follows:
439
+
440
+ * roboto-normal.ttf (_originally Roboto-Regular.ttf_)
441
+ * roboto-italic.ttf (_originally Roboto-Italic.ttf_)
442
+ * roboto-bold.ttf (_originally Roboto-Bold.ttf_)
443
+ * roboto-bold_italic.ttf (_originally Roboto-BoldItalic.ttf_)
444
+
445
+ Next, declare the font under the `font_catalog` key at the top of your theme file, giving it a unique key (e.g., `Roboto`).
446
+
447
+ [source,yaml]
448
+ ----
449
+ font:
450
+ catalog:
451
+ Roboto:
452
+ normal: roboto-normal.ttf
453
+ italic: roboto-italic.ttf
454
+ bold: roboto-bold.ttf
455
+ bold_italic: roboto-bold_italic.ttf
456
+ ----
457
+
458
+ You can use the key you gave to the font in the font catalog anywhere a `font_family` property is accepted in the theme file.
459
+ For instance, to use the Roboto font for all headings, you'd use:
460
+
461
+ [source,yaml]
462
+ ----
463
+ heading:
464
+ font_family: Roboto
465
+ ----
466
+
467
+ When you execute Asciidoctor PDF, you need to specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
468
+
469
+ $ asciidoctor-pdf -a pdf-style=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
470
+
471
+ WARNING: Currently, all fonts referenced by the theme need to be present in the directory specified by the `pdf-fontsdir` attribute.
472
+
473
+ You can add any number of fonts to the catalog.
474
+ Each font must be assigned a unique key, as shown here:
475
+
476
+ [source,yaml]
477
+ ----
478
+ font:
479
+ catalog:
480
+ Roboto:
481
+ normal: roboto-normal.ttf
482
+ italic: roboto-italic.ttf
483
+ bold: roboto-bold.ttf
484
+ bold_italic: roboto-bold_italic.ttf
485
+ RobotoLight:
486
+ normal: roboto-light-normal.ttf
487
+ italic: roboto-light-italic.ttf
488
+ bold: roboto-light-bold.ttf
489
+ bold_italic: roboto-light-bold_italic.ttf
490
+ ----
491
+
492
+ === Fallback fonts
493
+
494
+ 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.
495
+ You only need to specify one fallback font...typically one that has a full set of symbols.
496
+
497
+ Like with other custom fonts, you first need to declare the fallback font.
498
+ Let's choose https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/[Droid Sans Fallback].
499
+ You can map all the styles to a single font file (since bold and italic don't usually make sense for symbols).
500
+
501
+ [source,yaml]
502
+ ----
503
+ font:
504
+ catalog:
505
+ Roboto:
506
+ normal: roboto-normal.ttf
507
+ italic: roboto-italic.ttf
508
+ bold: roboto-bold.ttf
509
+ bold_italic: roboto-bold_italic.ttf
510
+ DroidSansFallback:
511
+ normal: droid-sans-fallback.ttf
512
+ italic: droid-sans-fallback.ttf
513
+ bold: droid-sans-fallback.ttf
514
+ bold_italic: droid-sans-fallback.ttf
515
+ ----
516
+
517
+ Next, assign the key to the `fallbacks` key under the `font_catalog` key.
518
+ Be sure to surround the key name in square brackets as shown below.
519
+
520
+ [source,yaml]
521
+ ----
522
+ font:
523
+ catalog:
524
+ Roboto:
525
+ normal: roboto-normal.ttf
526
+ italic: roboto-italic.ttf
527
+ bold: roboto-bold.ttf
528
+ bold_italic: roboto-bold_italic.ttf
529
+ DroidSansFallback:
530
+ normal: droid-sans-fallback.ttf
531
+ italic: droid-sans-fallback.ttf
532
+ bold: droid-sans-fallback.ttf
533
+ bold_italic: droid-sans-fallback.ttf
534
+ fallbacks: [DroidSansFallback]
535
+ ----
536
+
537
+ TIP: If you are using more than one fallback font, separate each key name by a comma.
538
+
539
+ That's it!
540
+ Now you're covered.
541
+ You don't need to reference the fallback font anywhere else in your theme file to use it.
542
+
543
+ CAUTION: Using a fallback font does slow down PDF generation slightly.
544
+ It's best to select fonts that have all the characters you need.
545
+
546
+ == Keys
547
+
548
+ TBW
549
+
550
+ === Page
551
+
552
+ [cols="1d,1d,2m"]
553
+ |===
554
+ |Key |Value Type |Example
555
+
556
+ |page_background_color
557
+ |<<colors,color>>
558
+ |background_color: ffffff
559
+
560
+ |page_layout
561
+ |portrait, landscape
562
+ |layout: portrait
563
+
564
+ |page_margin
565
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
566
+ |margin: [0.5in, 0.67in, 0.67in, 0.67in]
567
+
568
+ |page_size
569
+ |named size, <<measurement-units,measurement array [2]>>
570
+ |size: Letter
571
+ |===
572
+
573
+ === Base
574
+
575
+ [cols="1d,1d,2m"]
576
+ |===
577
+ |Key |Value Type |Example
578
+
579
+ |base_font_color
580
+ |<<colors,color>>
581
+ |font_color: #333333
582
+
583
+ |base_font_family
584
+ |<<fonts,font family name>>
585
+ |font_family: NotoSerif
586
+
587
+ |base_font_size
588
+ |<<values,number>>
589
+ |font_size: 10.5
590
+
591
+ |base_line_height_length
592
+ |<<values,number>>
593
+ |line_height_length: 12
594
+
595
+ |base_line_height
596
+ |<<values,number>>
597
+ |line_height: 1.14
598
+
599
+ |base_font_size_large
600
+ |<<values,number>>
601
+ |font_size_large: 13
602
+
603
+ |base_font_size_small
604
+ |<<values,number>>
605
+ |font_size_small: 9
606
+
607
+ |base_font_style
608
+ |normal, italic, bold, bold_italic
609
+ |font_style: normal
610
+
611
+ |base_align
612
+ |left, center, right, justify
613
+ |align: justify
614
+
615
+ |base_border_radius
616
+ |<<values,number>>
617
+ |border_radius: 4
618
+
619
+ |base_border_width
620
+ |<<values,number>>
621
+ |border_width: 0.5
622
+
623
+ |base_border_color
624
+ |<<colors,color>>
625
+ |border_color: eee
626
+ |===
627
+
628
+ === Vertical and Horizontal Rhythm
629
+
630
+ [cols="1d,1d,2m"]
631
+ |===
632
+ |Key |Value Type |Example
633
+
634
+ |vertical_rhythm
635
+ |<<values,number>>
636
+ |vertical_rhythm: 12
637
+
638
+ |horizontal_rhythm
639
+ |<<values,number>>
640
+ |horizontal_rhythm: 12
641
+ |===
642
+
643
+ === Link
644
+
645
+ [cols="1d,1d,2m"]
646
+ |===
647
+ |Key |Value Type |Example
648
+
649
+ |link_font_color
650
+ |<<colors,color>>
651
+ |font_color: 428BCA
652
+
653
+ |link_font_family
654
+ |<<fonts,font family name>>
655
+ |font_family: Roboto
656
+
657
+ |link_font_size
658
+ |<<values,number>>
659
+ |font_size: 9
660
+
661
+ |link_font_style
662
+ |normal, italic, bold, bold_italic
663
+ |font_style: normal
664
+ |===
665
+
666
+ === Literal Inline
667
+
668
+ The literal key is used for inline monospaced text in prose and table cells.
669
+
670
+ [cols="1d,1d,2m"]
671
+ |===
672
+ |Key |Value Type |Example
673
+
674
+ |literal_font_color
675
+ |<<colors,color>>
676
+ |font_color: B12146
677
+
678
+ |literal_font_family
679
+ |<<fonts,font family name>>
680
+ |font_family: Mplus1mn
681
+
682
+ |literal_font_size
683
+ |<<values,number>>
684
+ |font_size: 12
685
+
686
+ |literal_font_style
687
+ |normal, italic, bold, bold_italic
688
+ |font_style: bold
689
+ |===
690
+
691
+ === Heading
692
+
693
+ [cols="1d,1d,2m"]
694
+ |===
695
+ |Key |Value Type |Example
696
+
697
+ |heading_font_color
698
+ |<<colors,color>>
699
+ |font_color: 333333
700
+
701
+ |heading_h<n>_font_color
702
+ |<<colors,color>>
703
+ |h2_font_color: [0, 99%, 100%, 0]
704
+
705
+ |heading_font_family
706
+ |<<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
712
+
713
+ |heading_font_size
714
+ |<<values,number>>
715
+ |font_size: 9
716
+
717
+ |heading_h<n>_font_size
718
+ |<<values,number>>
719
+ |h6_font_size: round($base_font_size * 1.7)
720
+
721
+ |heading_font_style
722
+ |normal, italic, bold, bold_italic
723
+ |font_style: bold
724
+
725
+ |heading_h<n>_font_style
726
+ |normal, italic, bold, bold_italic
727
+ |h3_font_style: bold_italic
728
+
729
+ |heading_line_height
730
+ |<<values,number>>
731
+ |line_height: 1.2
732
+
733
+ |heading_margin_top
734
+ |<<measurement-units,measurement>>
735
+ |margin_top: $vertical_rhythm * 0.2
736
+
737
+ |heading_margin_bottom
738
+ |<<measurement-units,measurement>>
739
+ |margin_bottom: 9.600
740
+ |===
741
+
742
+ === Title Page
743
+
744
+ [cols="1d,1d,2m"]
745
+ |===
746
+ |Key |Value Type |Example
747
+
748
+ |title_page_align
749
+ |left, center, right, justify
750
+ |align: right
751
+
752
+ |title_page_title_top
753
+ |percentage
754
+ |title_top: 55%
755
+
756
+ |title_page_title_font_size
757
+ |<<values,number>>
758
+ |title_font_size: 27
759
+
760
+ |title_page_title_font_color
761
+ |<<colors,color>>
762
+ |title_font_color: 999999
763
+
764
+ |title_page_title_line_height
765
+ |<<values,number>>
766
+ |title_line_height: 0.9
767
+
768
+ |title_page_subtitle_font_size
769
+ |<<values,number>>
770
+ |subtitle_font_size: 18
771
+
772
+ |title_page_subtitle_font_style
773
+ |normal, italic, bold, bold_italic
774
+ |subtitle_font_style: bold_italic
775
+
776
+ |title_page_subtitle_line_height
777
+ |<<values,number>>
778
+ |subtitle_line_height: 1
779
+
780
+ |title_page_authors_margin_top
781
+ |<<measurement-units,measurement>>
782
+ |authors_margin_top: 13.125
783
+
784
+ |title_page_authors_font_size
785
+ |<<values,number>>
786
+ |authors_font_size: $base_font_size_large
787
+
788
+ |title_page_authors_font_color
789
+ |<<colors,color>>
790
+ |authors_font_color: 181818
791
+
792
+ |title_page_revision_margin_top
793
+ |<<measurement-units,measurement>>
794
+ |revision_margin_top: 13.125
795
+ |===
796
+
797
+ === Block
798
+
799
+ // Blocks include admonition, example, quote, verse, sidebar, image, listing, literal, and table.
800
+
801
+ [cols="1d,1d,2m"]
802
+ |===
803
+ |Key |Value Type |Example
804
+
805
+ |block_padding
806
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
807
+ |padding: [12, 15, 12, 15]
808
+
809
+ |block_margin_top
810
+ |<<measurement-units,measurement>>
811
+ |margin_top: 0
812
+
813
+ |block_margin_bottom
814
+ |<<measurement-units,measurement>>
815
+ |margin_bottom: 1
816
+ |===
817
+
818
+ === Caption
819
+
820
+ [cols="1d,1d,2m"]
821
+ |===
822
+ |Key |Value Type |Example
823
+
824
+ |caption_font_color
825
+ |<<colors,color>>
826
+ |font_color: 333333
827
+
828
+ |caption_font_family
829
+ |<<fonts,font family name>>
830
+ |font_family: Mplus1mn
831
+
832
+ |caption_font_size
833
+ |<<values,number>>
834
+ |font_size: 11
835
+
836
+ |caption_font_style
837
+ |normal, italic, bold, bold_italic
838
+ |font_style: italic
839
+
840
+ |caption_align
841
+ |left, center, right, justify
842
+ |align: left
843
+
844
+ |caption_margin_inside
845
+ |<<measurement-units,measurement>>
846
+ |margin_inside: 3
847
+
848
+ |caption_margin_outside
849
+ |<<measurement-units,measurement>>
850
+ |margin_outside: 0
851
+ |===
852
+
853
+ === Code
854
+
855
+ [cols="1d,1d,2m"]
856
+ |===
857
+ |Key |Value Type |Example
858
+
859
+ |code_font_color
860
+ |<<colors,color>>
861
+ |font_color: 333333
862
+
863
+ |code_font_family
864
+ |<<fonts,font family name>>
865
+ |font_family: Mplus1mn
866
+
867
+ |code_font_size
868
+ |<<values,number>>
869
+ |font_size: 11
870
+
871
+ |code_font_style
872
+ |normal, italic, bold, bold_italic
873
+ |font_style: italic
874
+
875
+ |code_padding
876
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
877
+ |padding: 11
878
+
879
+ |code_line_height
880
+ |<<values,number>>
881
+ |line_height: 1.25
882
+
883
+ |code_background_color
884
+ |<<colors,color>>
885
+ |background_color: F5F5F5
886
+
887
+ |code_border_color
888
+ |<<colors,color>>
889
+ |border_color: CCCCCC
890
+
891
+ |code_border_radius
892
+ |<<values,number>>
893
+ |border_radius: 4
894
+
895
+ |code_border_width
896
+ |<<values,number>>
897
+ |border_width: 0.75
898
+ |===
899
+
900
+ === Blockquote
901
+
902
+ [cols="1d,1d,2m"]
903
+ |===
904
+ |Key |Value Type |Example
905
+
906
+ |blockquote_font_color
907
+ |<<colors,color>>
908
+ |font_color: 333333
909
+
910
+ |blockquote_font_family
911
+ |<<fonts,font family name>>
912
+ |font_family: Notoserif
913
+
914
+ |blockquote_font_size
915
+ |<<values,number>>
916
+ |font_size: 13
917
+
918
+ |blockquote_font_style
919
+ |normal, italic, bold, bold_italic
920
+ |font_style: bold
921
+
922
+ |blockquote_border_width
923
+ |<<values,number>>
924
+ |border_width: 5
925
+
926
+ |blockquote_border_color
927
+ |<<colors,color>>
928
+ |border_color: EEEEEE
929
+
930
+ |blockquote_cite_font_size
931
+ |<<values,number>>
932
+ |cite_font_size: 9
933
+
934
+ |blockquote_cite_font_color
935
+ |<<colors,color>>
936
+ |cite_font_color: 999999
937
+
938
+ |blockquote_cite_font_family
939
+ |<<fonts,font family name>>
940
+ |cite_font_family: Notoserif
941
+
942
+ |blockquote_cite_font_style
943
+ |normal, italic, bold, bold_italic
944
+ |cite_font_style: bold
945
+
946
+ |===
947
+
948
+ === Sidebar
949
+
950
+ [cols="1d,1d,2m"]
951
+ |===
952
+ |Key |Value Type |Example
953
+
954
+ |sidebar_border_color
955
+ |<<colors,color>>
956
+ |border_color: FFFFFF
957
+
958
+ |sidebar_border_radius
959
+ |<<values,number>>
960
+ |border_radius: 4
961
+
962
+ |sidebar_border_width
963
+ |<<values,number>>
964
+ |border_width: 0.5
965
+
966
+ |sidebar_background_color
967
+ |<<colors,color>>
968
+ |background_color: EEEEEE
969
+
970
+ |sidebar_title_font_color
971
+ |<<colors,color>>
972
+ |title_font_color: 333333
973
+
974
+ |sidebar_title_font_family
975
+ |<<fonts,font family name>>
976
+ |title_font_family: NotoSerif
977
+
978
+ |sidebar_title_font_size
979
+ |<<values,number>>
980
+ |title_font_size: 13
981
+
982
+ |sidebar_title_font_style
983
+ |normal, italic, bold, bold_italic
984
+ |title_font_style: bold
985
+
986
+ |sidebar_title_align
987
+ |left, center, right, justify
988
+ |title_align: center
989
+ |===
990
+
991
+ === Example
992
+
993
+ [cols="1d,1d,2m"]
994
+ |===
995
+ |Key |Value Type |Example
996
+
997
+ |example_border_color
998
+ |<<colors,color>>
999
+ |border_color: EEEEEE
1000
+
1001
+ |example_border_radius
1002
+ |<<values,number>>
1003
+ |border_radius: 4
1004
+
1005
+ |example_border_width
1006
+ |<<values,number>>
1007
+ |border_width: 0.75
1008
+
1009
+ |example_background_color
1010
+ |<<colors,color>>
1011
+ |background_color: transparent
1012
+ |===
1013
+
1014
+ === Admonition
1015
+
1016
+ [cols="1d,1d,2m"]
1017
+ |===
1018
+ |Key |Value Type |Example
1019
+
1020
+ |admonition_border_color
1021
+ |<<colors,color>>
1022
+ |border_color: EEEEEE
1023
+
1024
+ |admonition_border_width
1025
+ |<<values,number>>
1026
+ |border_width: 0.5
1027
+ |===
1028
+
1029
+ === Image
1030
+
1031
+ [cols="1d,1d,2m"]
1032
+ |===
1033
+ |Key |Value Type |Example
1034
+
1035
+ |image_align_default
1036
+ |left, center, right, justify
1037
+ |align_default: left
1038
+ |===
1039
+
1040
+ === Lead
1041
+
1042
+ [cols="1d,1d,2m"]
1043
+ |===
1044
+ |Key |Value Type |Example
1045
+
1046
+ |lead_font_size
1047
+ |<<values,number>>
1048
+ |font_size: 13
1049
+
1050
+ |lead_line_height
1051
+ |<<values,number>>
1052
+ |line_height: 1.4
1053
+ |===
1054
+
1055
+ === Abstract
1056
+
1057
+ [cols="1d,1d,2m"]
1058
+ |===
1059
+ |Key |Value Type |Example
1060
+
1061
+ |abstract_font_color
1062
+ |<<colors,color>>
1063
+ |font_color: 5C6266
1064
+
1065
+ |abstract_font_size
1066
+ |<<values,number>>
1067
+ |font_size: 13
1068
+
1069
+ |abstract_line_height
1070
+ |<<values,number>>
1071
+ |line_height: 1.4
1072
+
1073
+ |abstract_font_style
1074
+ |normal, italic, bold, bold_italic
1075
+ |font_style: italic
1076
+ |===
1077
+
1078
+ === Thematic Break
1079
+
1080
+ [cols="1d,1d,2m"]
1081
+ |===
1082
+ |Key |Value Type |Example
1083
+
1084
+ |thematic_break_border_color
1085
+ |<<colors,color>>
1086
+ |border_colorL EEEEEE
1087
+
1088
+ |thematic_break_margin_top
1089
+ |<<measurement-units,measurement>>
1090
+ |margin_top: 6
1091
+
1092
+ |thematic_break_margin_bottom
1093
+ |<<measurement-units,measurement>>
1094
+ |margin_bottom: 18
1095
+ |===
1096
+
1097
+ === Description list
1098
+
1099
+ [cols="1d,1d,2m"]
1100
+ |===
1101
+ |Key |Value Type |Example
1102
+
1103
+ |description_list_term_font_style
1104
+ |normal, italic, bold, bold_italic
1105
+ |term_font_style: italic
1106
+
1107
+ |description_list_description_indent
1108
+ |<<values,number>>
1109
+ |description_indent: 15
1110
+ |===
1111
+
1112
+
1113
+ === Outline list
1114
+
1115
+ [cols="1d,1d,2m"]
1116
+ |===
1117
+ |Key |Value Type |Example
1118
+
1119
+ |outline_list_indent
1120
+ |<<measurement-units,measurement>>
1121
+ |list_indent: 40
1122
+
1123
+ |outline_list_item_spacing
1124
+ |<<measurement-units,measurement>>
1125
+ |item_spacing: 4
1126
+ |===
1127
+
1128
+ === Table
1129
+
1130
+ [cols="1d,1d,2m"]
1131
+ |===
1132
+ |Key |Value Type |Example
1133
+
1134
+ |table_background_color
1135
+ |<<colors,color>>
1136
+ |background_color: FFFFFF
1137
+
1138
+ |table_even_row_background_color
1139
+ |<<colors,color>>
1140
+ |even_row_background_color: F9F9F9
1141
+
1142
+ |table_foot_background_color
1143
+ |<<colors,color>>
1144
+ |foot_background_color: F0F0F0
1145
+
1146
+ |table_border_color
1147
+ |<<colors,color>>
1148
+ |border_color: DDDDDD
1149
+
1150
+ |table_border_width
1151
+ |<<values,number>>
1152
+ |border_width: 0.5
1153
+
1154
+ |table_cell_padding
1155
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
1156
+ |cell_padding: [3, 3, 6, 3]
1157
+ |===
1158
+
1159
+ [[key-toc]]
1160
+ === Table of Contents
1161
+
1162
+ [cols="1d,1d,2m"]
1163
+ |===
1164
+ |Key |Value Type |Example
1165
+
1166
+ |toc_dot_leader_content
1167
+ |double-quoted string
1168
+ |dot_leader_content: ". "
1169
+
1170
+ |toc_dot_leader_color
1171
+ |<<colors,color>>
1172
+ |dot_leader_color: 999999
1173
+
1174
+ |toc_font_color
1175
+ |<<colors,color>>
1176
+ |font_color: 333333
1177
+
1178
+ |toc_h<n>_font_color
1179
+ |<<colors,color>>
1180
+ |h3_font_color: 999999
1181
+
1182
+ |toc_font_family
1183
+ |<<fonts,font family name>>
1184
+ |font_family: NotoSerif
1185
+
1186
+ |toc_font_size
1187
+ |<<values,number>>
1188
+ |font_size: 9
1189
+
1190
+ |toc_font_style
1191
+ |normal, italic, bold, bold_italic
1192
+ |font_style: bold
1193
+
1194
+ |toc_line_height
1195
+ |number
1196
+ |line_height: 1.5
1197
+
1198
+ |toc_indent
1199
+ |<<measurement-units,measurement>>
1200
+ |indent: 20
1201
+
1202
+ |toc_margin_top
1203
+ |<<measurement-units,measurement>>
1204
+ |indent: 20
1205
+ |===
1206
+
1207
+ === Running Header & Footer
1208
+
1209
+ [cols="3,5,5m"]
1210
+ |===
1211
+ |Key |Value Type |Example
1212
+
1213
+ |header_background_color
1214
+ |<<colors,color>>
1215
+ |background_color: EEEEEE
1216
+
1217
+ |header_border_color
1218
+ |<<colors,color>>
1219
+ |border_color: DDDDDD
1220
+
1221
+ |header_border_width
1222
+ |<<measurement-units,measurement>>
1223
+ |border_width: 0.25
1224
+
1225
+ |header_font_color
1226
+ |<<colors,color>>
1227
+ |font_color: 333333
1228
+
1229
+ |header_font_family
1230
+ |<<fonts,font family name>>
1231
+ |font_family: NotoSerif
1232
+
1233
+ |header_font_size
1234
+ |<<values,number>>
1235
+ |font_size: 9
1236
+
1237
+ |header_font_style
1238
+ |normal, italic, bold, bold_italic
1239
+ |font_style: italic
1240
+
1241
+ |header_height
1242
+ |<<measurement-units,measurement>>
1243
+ |height: 0.75in
1244
+
1245
+ |header_padding
1246
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
1247
+ |padding: [0, 3, 0, 3]
1248
+
1249
+ |header_image_valign
1250
+ |top, center, bottom, <<measurement-units,measurement>>
1251
+ |image_valign: 4
1252
+
1253
+ |header_valign
1254
+ |top, center, bottom
1255
+ |valign: center
1256
+
1257
+ |header_<side>_content_<align>*
1258
+ |quoted string
1259
+ v|`recto_content:
1260
+ right: '\{page-number}'`
1261
+
1262
+ |footer_background_color
1263
+ |<<colors,color>>
1264
+ |background_color: EEEEEE
1265
+
1266
+ |footer_border_color
1267
+ |<<colors,color>>
1268
+ |border_color: DDDDDD
1269
+
1270
+ |footer_border_width
1271
+ |<<measurement-units,measurement>>
1272
+ |border_width: 0.25
1273
+
1274
+ |footer_font_color
1275
+ |<<colors,color>>
1276
+ |font_color: 333333
1277
+
1278
+ |footer_font_family
1279
+ |<<fonts,font family name>>
1280
+ |font_family: NotoSerif
1281
+
1282
+ |footer_font_size
1283
+ |<<values,number>>
1284
+ |font_size: 9
1285
+
1286
+ |footer_font_style
1287
+ |normal, italic, bold, bold_italic
1288
+ |font_style: italic
1289
+
1290
+ |footer_height
1291
+ |<<measurement-units,measurement>>
1292
+ |height: 0.75in
1293
+
1294
+ |footer_padding
1295
+ |<<measurement-units,measurement>>, <<measurement-units,measurement array [4]>>
1296
+ |padding: [0, 3, 0, 3]
1297
+
1298
+ |footer_image_valign
1299
+ |top, center, bottom, <<measurement-units,measurement>>
1300
+ |image_valign: 4
1301
+
1302
+ |footer_valign
1303
+ |top, center, bottom
1304
+ |valign: top
1305
+
1306
+ |footer_<side>_content_<align>*
1307
+ |quoted string
1308
+ v|`recto_content:
1309
+ center: '\{page-number}'`
1310
+ |===
1311
+
1312
+ {asterisk} `<side>` can be `recto` (odd pages) or `verso` (even pages).
1313
+ `<align>` can be `left`, `center` or `right`.
1314
+
1315
+ IMPORTANT: You must define a height for the running header or footer, respectively, or it will not be shown.
1316
+
1317
+ NOTE: The background color spans the width of the page.
1318
+ When a background color is specified, the border also spans the width of the page.
1319
+
1320
+ 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
+
1322
+ * page-count
1323
+ * page-number
1324
+ * document-title
1325
+ * document-subtitle
1326
+ * chapter-title
1327
+ * section-title
1328
+ * section-or-chapter-title
1329
+
1330
+ For example:
1331
+
1332
+ [source,yaml]
1333
+ ----
1334
+ footer:
1335
+ height: 0.75in
1336
+ recto_content:
1337
+ right: '{section-or-chapter-title} | {page-number}'
1338
+ verso_content:
1339
+ left: '{page-number} | {chapter-title}'
1340
+ ----
1341
+
1342
+ == Applying a Theme
1343
+
1344
+ PENDING