asciidoctor-pdf 1.5.0.beta.2 → 1.5.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +41 -0
- data/README.adoc +233 -18
- data/asciidoctor-pdf.gemspec +5 -2
- data/data/fonts/ABOUT-mplus1mn-subset +2 -0
- data/data/fonts/ABOUT-mplus1p-subset +1 -0
- data/data/fonts/ABOUT-notoserif-subset +1 -0
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold-subset.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
- data/data/fonts/mplus1mn-regular-subset.ttf +0 -0
- data/data/fonts/mplus1p-regular-fallback.ttf +0 -0
- data/data/fonts/notoserif-bold-subset.ttf +0 -0
- data/data/fonts/notoserif-bold_italic-subset.ttf +0 -0
- data/data/fonts/notoserif-italic-subset.ttf +0 -0
- data/data/fonts/notoserif-regular-subset.ttf +0 -0
- data/data/themes/base-theme.yml +5 -2
- data/data/themes/default-theme.yml +5 -1
- data/docs/theming-guide.adoc +176 -53
- data/lib/asciidoctor-pdf/converter.rb +342 -238
- data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +1 -1
- data/lib/asciidoctor-pdf/formatted_text/parser.rb +16 -4
- data/lib/asciidoctor-pdf/formatted_text/parser.treetop +1 -1
- data/lib/asciidoctor-pdf/formatted_text/transform.rb +22 -6
- data/lib/asciidoctor-pdf/implicit_header_processor.rb +1 -1
- data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +3 -3
- data/lib/asciidoctor-pdf/prawn_ext/images.rb +3 -3
- data/lib/asciidoctor-pdf/sanitizer.rb +1 -1
- data/lib/asciidoctor-pdf/theme_loader.rb +54 -31
- data/lib/asciidoctor-pdf/version.rb +1 -1
- metadata +47 -5
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/data/themes/base-theme.yml
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
vertical_spacing: 12
|
4
4
|
page_background_color: 'FFFFFF'
|
5
5
|
page_layout: portrait
|
6
|
+
page_initial_zoom: FitH
|
6
7
|
# 36 is equivalent to 0.5in
|
7
8
|
page_margin: 36
|
8
9
|
page_margin_inner: 48
|
@@ -15,10 +16,9 @@ base_font_color: '000000'
|
|
15
16
|
base_font_family: Helvetica
|
16
17
|
base_font_size: 12
|
17
18
|
# QUESTION should we rename to min_font_size?
|
18
|
-
base_font_size_min:
|
19
|
+
base_font_size_min: 6
|
19
20
|
base_font_style: normal
|
20
21
|
base_line_height: 1.15
|
21
|
-
base_line_height_length: 13.8
|
22
22
|
base_border_color: 'EEEEEE'
|
23
23
|
base_border_width: 0.5
|
24
24
|
role_big_font_size: 14
|
@@ -28,6 +28,8 @@ button_font_family: Courier
|
|
28
28
|
button_font_style: bold
|
29
29
|
key_font_family: Courier
|
30
30
|
key_font_style: italic
|
31
|
+
mark_background_color: ffff00
|
32
|
+
mark_border_offset: 0.5
|
31
33
|
link_font_color: '0000EE'
|
32
34
|
literal_font_family: Courier
|
33
35
|
heading_font_style: bold
|
@@ -40,6 +42,7 @@ heading_h6_font_size: 10
|
|
40
42
|
heading_line_height: 1.15
|
41
43
|
heading_margin_top: 4
|
42
44
|
heading_margin_bottom: 12
|
45
|
+
heading_min_height_after: 20
|
43
46
|
title_page_align: center
|
44
47
|
title_page_line_height: 1.15
|
45
48
|
title_page_logo_top: 10%
|
@@ -15,6 +15,7 @@ font:
|
|
15
15
|
page:
|
16
16
|
background_color: ffffff
|
17
17
|
layout: portrait
|
18
|
+
initial_zoom: FitH
|
18
19
|
margin: [0.5in, 0.67in, 0.67in, 0.67in]
|
19
20
|
# margin_inner and margin_outer keys are used for recto/verso print margins when media=prepress
|
20
21
|
margin_inner: 0.75in
|
@@ -54,7 +55,6 @@ base:
|
|
54
55
|
role:
|
55
56
|
big:
|
56
57
|
font_size: $base_font_size_large
|
57
|
-
role:
|
58
58
|
small:
|
59
59
|
font_size: $base_font_size_small
|
60
60
|
# FIXME vertical_rhythm is weird; we should think in terms of ems
|
@@ -81,6 +81,9 @@ key:
|
|
81
81
|
border_width: 0.375
|
82
82
|
font_family: $literal_font_family
|
83
83
|
separator: "\u202f+\u202f"
|
84
|
+
mark:
|
85
|
+
background_color: ffff00
|
86
|
+
border_offset: 0.5
|
84
87
|
menu:
|
85
88
|
caret_content: " <font size=\"1.15em\"><color rgb=\"b12146\">\u203a</color></font> "
|
86
89
|
heading:
|
@@ -102,6 +105,7 @@ heading:
|
|
102
105
|
line_height: 1
|
103
106
|
margin_top: $vertical_rhythm * 0.4
|
104
107
|
margin_bottom: $vertical_rhythm * 0.9
|
108
|
+
min_height_after: $base_line_height_length * 1.5
|
105
109
|
title_page:
|
106
110
|
align: right
|
107
111
|
logo:
|
data/docs/theming-guide.adoc
CHANGED
@@ -34,10 +34,10 @@ Topics remaining to document:
|
|
34
34
|
The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file Asciidoctor PDF generates from AsciiDoc.
|
35
35
|
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.
|
36
36
|
|
37
|
-
TIP: The quickest way to
|
38
|
-
This not only gives you
|
39
|
-
If you
|
40
|
-
|
37
|
+
TIP: The quickest way to create your own theme is to <<Extends,extend the default theme>>.
|
38
|
+
This not only gives you a set of foundation styles to build on, it also provides a collection of <<Bundled Fonts,bundled fonts>>.
|
39
|
+
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>>.
|
40
|
+
To reuse the bundled fonts, you can either extend the default theme and/or redeclare the bundled fonts in the font catalog.
|
41
41
|
|
42
42
|
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.
|
43
43
|
Using AFM fonts can result in missing functionality and warnings.
|
@@ -74,8 +74,9 @@ The theme language adds some extra features to YAML, such as variables, basic ma
|
|
74
74
|
These enhancements will be explained in detail in later sections.
|
75
75
|
|
76
76
|
The theme file must be named _<name>-theme.yml_, where `<name>` is the name of the theme.
|
77
|
+
_We recommend *not* using the names *base* or *default* so you don't confuse it with one of the built-in themes._
|
77
78
|
|
78
|
-
Here's an example of a basic theme file:
|
79
|
+
Here's an example of a basic theme file that extends the base theme:
|
79
80
|
|
80
81
|
.basic-theme.yml
|
81
82
|
[source,yaml]
|
@@ -116,7 +117,7 @@ When creating a new theme, you only have to define the keys you want to override
|
|
116
117
|
All the available keys are documented in <<Keys>>.
|
117
118
|
The converter uses the information from the theme map to help construct the PDF.
|
118
119
|
|
119
|
-
Instead of
|
120
|
+
Instead of designing a theme from scratch, you can extend the default theme using the `extends` key as follows:
|
120
121
|
|
121
122
|
[source,yaml]
|
122
123
|
----
|
@@ -126,7 +127,7 @@ base:
|
|
126
127
|
----
|
127
128
|
|
128
129
|
You can also point the extends key at another custom theme to extend from it.
|
129
|
-
|
130
|
+
If you don't want to extend any theme, including the base theme, assign the value `~` to the `extends` key (i.e., `extends: ~`).
|
130
131
|
|
131
132
|
WARNING: If you start a new theme from scratch, we strongly recommend defining TrueType fonts and specifying them in the `base` and `literal` categories.
|
132
133
|
Otherwise, Asciidoctor PDF will use built-in AFM fonts, which can result in missing functionality and warnings.
|
@@ -572,7 +573,7 @@ It's possible to specify no color by assigning the special value `transparent`,
|
|
572
573
|
|
573
574
|
[source,yaml]
|
574
575
|
----
|
575
|
-
|
576
|
+
table:
|
576
577
|
background-color: transparent
|
577
578
|
----
|
578
579
|
|
@@ -652,7 +653,7 @@ IMPORTANT: Asciidoctor has no challenge working with Unicode.
|
|
652
653
|
In fact, it prefers Unicode and considers the entire range.
|
653
654
|
However, once you convert to PDF, you have to meet the font requirements of PDF in order to preserve Unicode characters.
|
654
655
|
That means you need to provide a font (at least a fallback font) that contains glyphs for all the characters you want to use.
|
655
|
-
If you don't, you may notice that characters are missing.
|
656
|
+
If you don't, you may notice that characters are missing (usually replaced with a box).
|
656
657
|
There's nothing Asciidoctor can do to convince PDF to work with extended characters without the right fonts in play.
|
657
658
|
|
658
659
|
=== Built-In (AFM) Fonts
|
@@ -707,6 +708,7 @@ To prevent this warning, you need to specify a TrueType font.
|
|
707
708
|
|
708
709
|
When using a TrueType font, you will get no warning for a missing glyph.
|
709
710
|
That's a consequence of how Prawn works and is outside of Asciidoctor PDF's control.
|
711
|
+
However, you'll likely see it substituted with a box (guaranteed if you're using one of the bundled fonts).
|
710
712
|
|
711
713
|
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].
|
712
714
|
****
|
@@ -731,8 +733,8 @@ A sans-serif font that provides a very complete set of Unicode glyphs.
|
|
731
733
|
Cannot be styled as italic, bold or bold_italic.
|
732
734
|
Used as the fallback font in the `default-with-fallback-font` theme.
|
733
735
|
|
734
|
-
|
735
|
-
|
736
|
+
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.
|
737
|
+
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) include `GEM_FONT_DIR` in the value of the `pdf-fontsdir` attribute, separated from the location of your custom fonts by the path separator (e.g., `path/to/fonts:GEM_FONTS_DIR`).
|
736
738
|
|
737
739
|
=== Custom Fonts
|
738
740
|
|
@@ -790,7 +792,13 @@ When you execute Asciidoctor PDF, specify the directory where the fonts reside u
|
|
790
792
|
|
791
793
|
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
|
792
794
|
|
793
|
-
|
795
|
+
You can specify multiple directories by separating the entries with the path separator (`:` for Unix, `;` for Windows).
|
796
|
+
|
797
|
+
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts:path/to/more-fonts document.adoc
|
798
|
+
|
799
|
+
To include the bundled fonts in the search, use the `GEM_FONTS_DIR` token:
|
800
|
+
|
801
|
+
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts:GEM_FONTS_DIR document.adoc
|
794
802
|
|
795
803
|
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.
|
796
804
|
Effectively, it subsets the font.
|
@@ -826,6 +834,7 @@ This will allow you to use the same font names (aka families) in both your graph
|
|
826
834
|
|
827
835
|
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.
|
828
836
|
You only need to specify a single fallback font, typically one that provides a full set of symbols.
|
837
|
+
If the character isn't found in the fallback font, it will mostly likely be replaced by a box (guaranteed if you're using the bundled fallback font).
|
829
838
|
|
830
839
|
IMPORTANT: The fallback font only gets used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
|
831
840
|
Any glyph missing from an AFM font is simply replaced with the "`not`" glyph (`¬`).
|
@@ -975,11 +984,19 @@ Error text is shown in [.red]#red#.
|
|
975
984
|
|
976
985
|
Currently, custom roles only apply to inline phrases and only support changing the font properties.
|
977
986
|
|
987
|
+
The converter provides several predefined roles.
|
988
|
+
The `big` and `small` roles map the font size to the $base-font-size-large and $base-font-size-small values, respectively.
|
989
|
+
These two roles can be redefined.
|
990
|
+
The `underline` and `line-through` roles add the underline and strikethrough decorations, respectively.
|
991
|
+
These two roles _can't_ be redefined.
|
992
|
+
The color roles (e.g., `blue`), which you may be familiar with from the HTML converter, are not mapped by default.
|
993
|
+
You'll need to define these in your theme if you'd like to make use of them when converting to PDF.
|
994
|
+
|
978
995
|
[cols="3,4,5l"]
|
979
996
|
|===
|
980
997
|
|Key |Value Type |Example
|
981
998
|
|
982
|
-
3+|[#key-prefix-role]*Key Prefix:* <<key-prefix-role,role-<name>
|
999
|
+
3+|[#key-prefix-role]*Key Prefix:* <<key-prefix-role,role-<name>{zwsp}>>
|
983
1000
|
|
984
1001
|
|font-color
|
985
1002
|
|<<colors,Color>> +
|
@@ -1016,7 +1033,7 @@ Currently, custom roles only apply to inline phrases and only support changing t
|
|
1016
1033
|
The keys in this category control the size, margins and background of each page (i.e., canvas).
|
1017
1034
|
We recommended that you define this category before all other categories.
|
1018
1035
|
|
1019
|
-
NOTE: The background of the title page can be styled independently.
|
1036
|
+
NOTE: The background of the title page can be styled independently of other pages.
|
1020
1037
|
See <<Title Page>> for details.
|
1021
1038
|
|
1022
1039
|
[cols="3,4,5l"]
|
@@ -1031,20 +1048,26 @@ See <<Title Page>> for details.
|
|
1031
1048
|
|page:
|
1032
1049
|
background-color: #fefefe
|
1033
1050
|
|
1034
|
-
|background-image^[
|
1035
|
-
|image macro^[
|
1051
|
+
|background-image^[2]^
|
1052
|
+
|image macro^[3]^ +
|
1036
1053
|
(default: _not set_)
|
1037
1054
|
|page:
|
1038
1055
|
background-image: image:page-bg.png[]
|
1039
1056
|
|
1040
|
-
|background-image-(recto{vbar}verso)^[
|
1041
|
-
|image macro^[
|
1057
|
+
|background-image-(recto{vbar}verso)^[2]^
|
1058
|
+
|image macro^[3]^ +
|
1042
1059
|
(default: _not set_)
|
1043
1060
|
|page:
|
1044
1061
|
background-image:
|
1045
1062
|
recto: image:page-bg-recto.png[]
|
1046
1063
|
verso: image:page-bg-verso.png[]
|
1047
1064
|
|
1065
|
+
|initial-zoom
|
1066
|
+
|Fit {vbar} FitH {vbar} FitV +
|
1067
|
+
(default: FitH)
|
1068
|
+
|page:
|
1069
|
+
initial-zoom: Fit
|
1070
|
+
|
1048
1071
|
|layout
|
1049
1072
|
|portrait {vbar} landscape +
|
1050
1073
|
(default: portrait)
|
@@ -1057,13 +1080,13 @@ See <<Title Page>> for details.
|
|
1057
1080
|
|page:
|
1058
1081
|
margin: [0.5in, 0.67in, 1in, 0.67in]
|
1059
1082
|
|
1060
|
-
|margin-inner^[
|
1083
|
+
|margin-inner^[4]^
|
1061
1084
|
|<<measurement-units,Measurement>> +
|
1062
1085
|
(default: 48)
|
1063
1086
|
|page:
|
1064
1087
|
margin-inner: 0.75in
|
1065
1088
|
|
1066
|
-
|margin-outer^[
|
1089
|
+
|margin-outer^[4]^
|
1067
1090
|
|<<measurement-units,Measurement>> +
|
1068
1091
|
(default: 24)
|
1069
1092
|
|page:
|
@@ -1082,11 +1105,14 @@ See <<Title Page>> for details.
|
|
1082
1105
|
numbering-start-at: toc
|
1083
1106
|
|===
|
1084
1107
|
|
1085
|
-
.
|
1086
|
-
The
|
1108
|
+
. To disable the background color for the page, set the value to white (i.e., FFFFFF).
|
1109
|
+
The color keyword `transparent` is not recognized in this context.
|
1110
|
+
. 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`).
|
1111
|
+
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).
|
1112
|
+
The position of the background image can be controlled using the `position` attribute.
|
1087
1113
|
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.
|
1088
|
-
If you
|
1089
|
-
To disable the background
|
1114
|
+
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.
|
1115
|
+
To disable the background image, use the value `none`.
|
1090
1116
|
. Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
|
1091
1117
|
. 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.
|
1092
1118
|
These margins and used when the value `prepress` is assigned to the `media` document attribute.
|
@@ -1161,9 +1187,9 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
|
|
1161
1187
|
|
1162
1188
|
|font-size-min
|
1163
1189
|
|<<values,Number>> +
|
1164
|
-
(default:
|
1190
|
+
(default: 6)
|
1165
1191
|
|base:
|
1166
|
-
font-size-min:
|
1192
|
+
font-size-min: $base-font-size * 0.75
|
1167
1193
|
|
1168
1194
|
// font-size-small is a variable, not an official key
|
1169
1195
|
//|font-size-small
|
@@ -1185,7 +1211,7 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
|
|
1185
1211
|
|
1186
1212
|
|line-height-length^[2]^
|
1187
1213
|
|<<values,Number>> +
|
1188
|
-
(default:
|
1214
|
+
(default: _not set_)
|
1189
1215
|
|base:
|
1190
1216
|
line-height-length: 12
|
1191
1217
|
|
@@ -1201,8 +1227,9 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
|
|
1201
1227
|
. The `text-transform` key cannot be set globally.
|
1202
1228
|
Therefore, this key should not be used.
|
1203
1229
|
The value of `none` is implicit and is documented here for completeness.
|
1204
|
-
.
|
1205
|
-
|
1230
|
+
. The `line-height-length` is a pseudo property that's local the theme.
|
1231
|
+
It's often used for computing the `base-line-height` from the base font size and the desired line height size.
|
1232
|
+
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`.
|
1206
1233
|
|
1207
1234
|
[#keys-vertical-spacing]
|
1208
1235
|
=== Vertical Spacing
|
@@ -1392,13 +1419,46 @@ The keys in this category control the style of most headings, including part tit
|
|
1392
1419
|
|heading:
|
1393
1420
|
margin-top: $vertical-spacing * 0.2
|
1394
1421
|
|
1422
|
+
|margin-page-top
|
1423
|
+
|<<measurement-units,Measurement>> +
|
1424
|
+
(default: 0)
|
1425
|
+
|heading:
|
1426
|
+
margin-page-top: $vertical-spacing
|
1427
|
+
|
1395
1428
|
|margin-bottom
|
1396
1429
|
|<<measurement-units,Measurement>> +
|
1397
1430
|
(default: 12)
|
1398
1431
|
|heading:
|
1399
1432
|
margin-bottom: 9.6
|
1400
1433
|
|
1401
|
-
|
1434
|
+
|min-height-after
|
1435
|
+
|<<measurement-units,Measurement>> +
|
1436
|
+
(default: $base-font-size * $base-line-height * 1.5)
|
1437
|
+
|heading:
|
1438
|
+
min-height-after: 0.5in
|
1439
|
+
|
1440
|
+
|chapter-break-before
|
1441
|
+
|always {vbar} auto +
|
1442
|
+
(default: always)
|
1443
|
+
|heading:
|
1444
|
+
chapter:
|
1445
|
+
break-before: auto
|
1446
|
+
|
1447
|
+
|part-break-before
|
1448
|
+
|always {vbar} auto +
|
1449
|
+
(default: always)
|
1450
|
+
|heading:
|
1451
|
+
part:
|
1452
|
+
break-before: auto
|
1453
|
+
|
1454
|
+
|part-break-after
|
1455
|
+
|always {vbar} auto +
|
1456
|
+
(default: auto)
|
1457
|
+
|heading:
|
1458
|
+
part:
|
1459
|
+
break-after: always
|
1460
|
+
|
1461
|
+
3+|[#key-prefix-heading-level]*Key Prefix:* <<key-prefix-heading-level,heading-h<n>{zwsp}>>^[1]^
|
1402
1462
|
|
1403
1463
|
|align
|
1404
1464
|
|<<text-alignments,Text alignment>> +
|
@@ -1434,7 +1494,25 @@ The keys in this category control the style of most headings, including part tit
|
|
1434
1494
|
|<<text-transforms,Text transform>> +
|
1435
1495
|
(default: $heading-text-transform)
|
1436
1496
|
|heading:
|
1437
|
-
text-transform: lowercase
|
1497
|
+
h3-text-transform: lowercase
|
1498
|
+
|
1499
|
+
|margin-top
|
1500
|
+
|<<measurement-units,Measurement>> +
|
1501
|
+
(default: $heading-margin-top)
|
1502
|
+
|heading:
|
1503
|
+
h2-margin-top: $vertical-spacing * 0.5
|
1504
|
+
|
1505
|
+
|margin-page-top
|
1506
|
+
|<<measurement-units,Measurement>> +
|
1507
|
+
(default: $heading-margin-page-top)
|
1508
|
+
|heading:
|
1509
|
+
h2-margin-page-top: $vertical-spacing
|
1510
|
+
|
1511
|
+
|margin-bottom
|
1512
|
+
|<<measurement-units,Measurement>> +
|
1513
|
+
(default: $heading-margin-bottom)
|
1514
|
+
|heading:
|
1515
|
+
h2-margin-bottom: 10
|
1438
1516
|
|===
|
1439
1517
|
|
1440
1518
|
. `<n>` is a number ranging from 1 to 6, representing each of the six heading levels.
|
@@ -1446,7 +1524,11 @@ If you want the font size of a specific level to be inherited, you must assign t
|
|
1446
1524
|
|
1447
1525
|
The keys in this category control the style of the title page as well as the arrangement and style of the elements on it.
|
1448
1526
|
|
1449
|
-
|
1527
|
+
IMPORTANT: The title page is only enabled by default for the book doctype (e.g., `:doctype: book`).
|
1528
|
+
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:`).
|
1529
|
+
|
1530
|
+
TIP: The title page can be disabled for the book doctype by setting the `notitle` attribute in the AsciiDoc document header (i.e., `:notitle:`).
|
1531
|
+
(For other doctypes, just don't set the `title-page` attribute).
|
1450
1532
|
|
1451
1533
|
[cols="3,4,5l"]
|
1452
1534
|
|===
|
@@ -1466,8 +1548,8 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
|
|
1466
1548
|
|title-page:
|
1467
1549
|
background-color: #eaeaea
|
1468
1550
|
|
1469
|
-
|background-image^[
|
1470
|
-
|image macro^[
|
1551
|
+
|background-image^[2]^
|
1552
|
+
|image macro^[3]^ +
|
1471
1553
|
(default: _not set_)
|
1472
1554
|
|title-page:
|
1473
1555
|
background-image: image:title.png[]
|
@@ -1518,14 +1600,14 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
|
|
1518
1600
|
align: right
|
1519
1601
|
|
1520
1602
|
|image
|
1521
|
-
|image macro^[
|
1603
|
+
|image macro^[3]^ +
|
1522
1604
|
(default: _not set_)
|
1523
1605
|
|title-page:
|
1524
1606
|
logo:
|
1525
1607
|
image: image:logo.png[pdfwidth=25%]
|
1526
1608
|
|
1527
1609
|
|top
|
1528
|
-
|Percentage^[
|
1610
|
+
|Percentage^[4]^ +
|
1529
1611
|
(default: 10%)
|
1530
1612
|
|title-page:
|
1531
1613
|
logo:
|
@@ -1771,8 +1853,11 @@ TIP: The title page can be disabled from the document by setting the `notitle` a
|
|
1771
1853
|
margin-bottom: 5
|
1772
1854
|
|===
|
1773
1855
|
|
1774
|
-
.
|
1775
|
-
The
|
1856
|
+
. To disable the background color for the title page, set the value to white (i.e., FFFFFF).
|
1857
|
+
The color keyword `transparent` is not recognized in this context.
|
1858
|
+
. 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`).
|
1859
|
+
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).
|
1860
|
+
The position of the background image can be controlled using the `position` attribute.
|
1776
1861
|
. Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
|
1777
1862
|
. Percentage unit can be % (relative to content height) or vh (relative to page height).
|
1778
1863
|
|
@@ -2000,7 +2085,7 @@ The keys in this category are used to control the style of literal, listing and
|
|
2000
2085
|
|code:
|
2001
2086
|
padding: 11
|
2002
2087
|
|
2003
|
-
3+|[#key-prefix-
|
2088
|
+
3+|[#key-prefix-code-linenum]*Key Prefix:* <<key-prefix-code-linenum,code-linenum>>^[2]^
|
2004
2089
|
|
2005
2090
|
|font-color
|
2006
2091
|
|<<colors,Color>> +
|
@@ -2654,7 +2739,7 @@ The keys in this category control the arrangement and style of admonition blocks
|
|
2654
2739
|
label:
|
2655
2740
|
text-transform: lowercase
|
2656
2741
|
|
2657
|
-
3+|[#key-prefix-admonition-icon]*Key Prefix:* <<key-prefix-admonition-icon,admonition-icon-<name>
|
2742
|
+
3+|[#key-prefix-admonition-icon]*Key Prefix:* <<key-prefix-admonition-icon,admonition-icon-<name>{zwsp}>>^[2]^
|
2658
2743
|
|
2659
2744
|
|name
|
2660
2745
|
|<icon set>-<icon name>^[3]^ +
|
@@ -2683,6 +2768,8 @@ The keys in this category control the arrangement and style of admonition blocks
|
|
2683
2768
|
|
2684
2769
|
. The top and bottom padding values are ignored on admonition-label-padding.
|
2685
2770
|
. `<name>` can be `note`, `tip`, `warning`, `important`, or `caution`.
|
2771
|
+
All icon types must be grouped under a single `icons` category.
|
2772
|
+
In other words, _do not_ declare the `icons` category multiple times.
|
2686
2773
|
The subkeys in the icon category cannot be flattened (e.g., `tip-name: far-lightbulb` is not valid syntax).
|
2687
2774
|
. Required.
|
2688
2775
|
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.
|
@@ -2710,10 +2797,37 @@ The keys in this category control the arrangement of block images.
|
|
2710
2797
|
(default: _not set_)
|
2711
2798
|
|image:
|
2712
2799
|
width: 100%
|
2800
|
+
|
2801
|
+
|border-color^[2]^
|
2802
|
+
|<<colors,Color>> +
|
2803
|
+
(default: _not set_)
|
2804
|
+
|image:
|
2805
|
+
border-color: #cccccc
|
2806
|
+
|
2807
|
+
|border-radius
|
2808
|
+
|<<values,Number>> +
|
2809
|
+
(default: _not set_)
|
2810
|
+
|image:
|
2811
|
+
border-radius: 2
|
2812
|
+
|
2813
|
+
|border-width^[2]^
|
2814
|
+
|<<values,Number>> +
|
2815
|
+
(default: _not set_)
|
2816
|
+
|image:
|
2817
|
+
border-width: 0.5
|
2818
|
+
|
2819
|
+
|border-fit^[3]^
|
2820
|
+
|content {vbar} auto
|
2821
|
+
(default: content)
|
2822
|
+
|image:
|
2823
|
+
border-fit: auto
|
2713
2824
|
|===
|
2714
2825
|
|
2715
2826
|
. Only applies to block images.
|
2716
2827
|
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.
|
2828
|
+
. 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.
|
2829
|
+
The border is drawn above the image on the inside of the box reserved for the image.
|
2830
|
+
. The value `auto` means the border should expand to fit the width of the container (i.e., full width) instead of the image.
|
2717
2831
|
|
2718
2832
|
[#keys-svg]
|
2719
2833
|
=== SVG
|
@@ -3029,7 +3143,7 @@ The keys in this category control the arrangement and style of unordered list it
|
|
3029
3143
|
|===
|
3030
3144
|
|Key |Value Type |Example
|
3031
3145
|
|
3032
|
-
3
|
3146
|
+
3+|[#key-prefix-ulist-marker-type]*Key Prefix:* <<key-prefix-ulist-marker-type,ulist-marker-<type>{zwsp}>>^[1]^
|
3033
3147
|
|
3034
3148
|
|content
|
3035
3149
|
|<<quoted-string,Quoted string>>
|
@@ -3469,7 +3583,7 @@ The keys in this category control the arrangement and style of the table of cont
|
|
3469
3583
|
|toc:
|
3470
3584
|
margin-top: 0
|
3471
3585
|
|
3472
|
-
3+|[#key-prefix-toc-level]*Key Prefix:* <<key-prefix-toc-level,toc-h<n>
|
3586
|
+
3+|[#key-prefix-toc-level]*Key Prefix:* <<key-prefix-toc-level,toc-h<n>{zwsp}>>^[1]^
|
3473
3587
|
|
3474
3588
|
|font-color
|
3475
3589
|
|<<colors,Color>> +
|
@@ -3920,8 +4034,9 @@ One exception to this rule are inline images, which are described in the next se
|
|
3920
4034
|
==== Images
|
3921
4035
|
|
3922
4036
|
You can add an image to the running header or footer using the AsciiDoc inline image syntax.
|
3923
|
-
|
3924
|
-
|
4037
|
+
The image target is resolved relative to the value of the `pdf-themesdir` attribute.
|
4038
|
+
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.
|
4039
|
+
Otherwise, the image is treated like a normal inline image, for which you can only adjust the width.
|
3925
4040
|
|
3926
4041
|
Here's an example of how to use an image in the running header (which also applies for the footer).
|
3927
4042
|
|
@@ -3961,7 +4076,8 @@ _Specifying an absolute path is recommended._
|
|
3961
4076
|
If you use images in your theme, image paths are resolved relative to this directory.
|
3962
4077
|
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`.
|
3963
4078
|
|
3964
|
-
pdf-fontsdir:: The directory where the fonts used by your theme, if any, are located.
|
4079
|
+
pdf-fontsdir:: The directory or directories where the fonts used by your theme, if any, are located.
|
4080
|
+
Multiple entries must be separated by path separator (`:` for Unix, `;` for Windows).
|
3965
4081
|
_Specifying an absolute path is recommended._
|
3966
4082
|
|
3967
4083
|
Let's assume that you've put your theme files inside a directory named `resources` with the following layout:
|
@@ -3984,7 +4100,7 @@ Here's how you'd load your theme when calling Asciidoctor PDF:
|
|
3984
4100
|
|
3985
4101
|
If all goes well, Asciidoctor PDF should run without an error or warning.
|
3986
4102
|
|
3987
|
-
NOTE: You only need to specify the `pdf-fontsdir` if you
|
4103
|
+
NOTE: You only need to specify the `pdf-fontsdir` if you're using custom fonts in your theme.
|
3988
4104
|
|
3989
4105
|
You can skip setting the `pdf-themesdir` attribute and just pass the absolute path of your theme file to the `pdf-theme` attribute.
|
3990
4106
|
|
@@ -4091,18 +4207,20 @@ These settings override equivalent keys defined in the theme file, where applica
|
|
4091
4207
|
. The path is resolved relative to base_dir.
|
4092
4208
|
. The target of the image macro is resolved relative to `imagesdir`.
|
4093
4209
|
If the image macro syntax is not used, the value is resolved relative to the base directory, which defaults to the document directory.
|
4094
|
-
. By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`).
|
4095
|
-
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).
|
4210
|
+
. 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`).
|
4211
|
+
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).
|
4212
|
+
The position of the background image can be controlled using the `position` attribute.
|
4096
4213
|
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.
|
4097
4214
|
If a background image isn't specified for a side, the converter will use the default page background image (`page-background-image`), if specified.
|
4098
|
-
To disable the background for a side, use the value `none`.
|
4215
|
+
To disable the background image for a side, use the value `none`.
|
4099
4216
|
. Controls whether the `page-number` attribute is accessible to the running header and footer content specified in the theme file.
|
4100
4217
|
Use the `noheader` and `nofooter` attributes to disable the running header and footer, respectively, from the document.
|
4101
4218
|
. 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.
|
4102
4219
|
. _(Experimental)_ The `text-align` document attribute is intended as a simple way to toggle text justification.
|
4103
4220
|
The value of this attribute overrides the `base-align` key set by the theme.
|
4104
4221
|
For more fine-grained control, you should customize using the theme.
|
4105
|
-
.
|
4222
|
+
. The title page is only enabled by default for the book doctype.
|
4223
|
+
To force the title page to be used for other doctypes, set the `title-page` attribute in the document header.
|
4106
4224
|
|
4107
4225
|
== Publishing Mode
|
4108
4226
|
|
@@ -4242,7 +4360,7 @@ For more information about source highlighting with Rouge, refer to the http://r
|
|
4242
4360
|
== Preparing a Custom Font
|
4243
4361
|
|
4244
4362
|
Any TTF font can be used with Prawn--and hence Asciidoctor PDF--without modifications (unless, of course, it's corrupt or contains errors).
|
4245
|
-
However, you may discover that kerning is disabled and certain required glyphs are missing.
|
4363
|
+
However, you may discover that kerning is disabled and certain required glyphs are missing (or replaced with boxes).
|
4246
4364
|
To address these problems, you need to prepare the font using a font program such as {url-fontforge}[FontForge].
|
4247
4365
|
|
4248
4366
|
=== Validate the Font
|
@@ -4282,7 +4400,7 @@ You can find a crash course in how to use the program on the FontForge project s
|
|
4282
4400
|
Here are the modifications you need to apply to a custom font for it to work best with Asciidoctor PDF:
|
4283
4401
|
|
4284
4402
|
* Convert the font to TTF (only required if the font is not already a TTF, such as an OTF or TTC).
|
4285
|
-
* Add the glyphs for the required characters if missing from the font (optional if using a
|
4403
|
+
* Add the glyphs for the required characters if missing from the font (optional if using a fallback font).
|
4286
4404
|
* Subset the font to exclude unused characters to reduce the file size (optional).
|
4287
4405
|
* Save the file using the old-style kern table to activate kerning.
|
4288
4406
|
|
@@ -4294,7 +4412,7 @@ Most fonts do not provide glyphs for all the Unicode character ranges (i.e., scr
|
|
4294
4412
|
In fact, many fonts only include glyphs for Latin (Basic, Supplement, and Extended) and a few other scripts (e.g., Cyrillic, Greek).
|
4295
4413
|
That means certain glyphs Asciidoctor PDF relies on may be missing from the font.
|
4296
4414
|
|
4297
|
-
Below are
|
4415
|
+
Below are the non-Latin characters (identified by Unicode code point) on which Asciidoctor PDF relies that are often missing from fonts.
|
4298
4416
|
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).
|
4299
4417
|
|
4300
4418
|
* \u00a0 - no-break space
|
@@ -4312,6 +4430,11 @@ Unless you're using a fallback font that fills in the missing glyphs, you need t
|
|
4312
4430
|
* \u2014 - em-dash (used in quote attribute)
|
4313
4431
|
* \u203a - single right-pointing quotation mark (used in the menu UI element)
|
4314
4432
|
* \u25ba - right pointer (used for media play icon when icon fonts are disabled)
|
4433
|
+
* .notdef - used as the default glyph when a requested character is missing from the font (usually a box)
|
4434
|
+
|
4435
|
+
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.
|
4436
|
+
Unlike other glyphs, the .notdef glyph is referenced by name only.
|
4437
|
+
It does not have a designated Unicode code point.
|
4315
4438
|
|
4316
4439
|
If you're preparing a font for use in verbatim blocks (e.g., a listing block), you'll also need this range of characters:
|
4317
4440
|
|