summaryrefslogtreecommitdiff
path: root/docs/modules/theme/pages/admonition.adoc
blob: 1ed9db7f163bf377c839d584ab264fd5cb0e42b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
= Admonition Category Keys
:description: Reference list of the available admonition category keys and their value types.
:navtitle: Admonition
:source-language: yaml

[#admonition]
== admonition

The keys in the `admonition` category control the arrangement and style of admonition blocks and the icon used for each admonition type.

[cols="3,5,6a"]
|===
|Key |Value Type |Example

|background-color
|xref:color.adoc[Color] +
(default: _not set_)
|[source]
admontition:
  background-color: #757575

|border-color
|xref:blocks.adoc#border-color[Color] +
(default: _not set_)
|[source]
admonition:
  border-color: #E6E8FA

|border-radius
|xref:blocks.adoc#radius[Measurement] +
(default: _not set_)
|[source]
admonition:
  border-radius: 4

|border-style
|xref:blocks.adoc#border-style[Border style] +
(default: `solid`)
|[source]
admonition:
  border-style: dashed

|border-width
|xref:blocks.adoc#border-width[Measurement] {vbar} xref:blocks.adoc#border-width[Measurement[\]] +
(default: _not set_)
|[source]
admonition:
  border-width: 0.5

// TODO What about admonition_rule_color which is used on line 106 in the admonition_spec.rb?

|column-rule-color
|xref:color.adoc[Color] +
(default: `'EEEEEE'`)
|[source]
admonition:
  column-rule-color: #AA0000

|column-rule-style
|`dashed` {vbar} `dotted` {vbar} `double` {vbar} `solid` +
(default: `solid`)
|[source]
admonition:
  column-rule-style: double

|column-rule-width
|xref:measurement-units.adoc[Measurement] +
(default: `0.5`)
|[source]
admonition:
  column-rule-width: 0.6

|font-color
|xref:color.adoc[Color] +
(default: _inherit_)
|[source]
admonition:
  font-color: #999999

|font-family
|xref:font-support.adoc[Font family name] +
(default: _inherit_)
|[source]
admonition:
  font-family: Noto Sans

|font-kerning
|`none` {vbar} `normal` +
(default: _inherit_)
|[source]
admonition:
  font-kerning: none

|font-size
|xref:text.adoc#font-size[Font size] +
(default: _inherit_)
|[source]
admonition:
  font-size: $base-font-size-large

|font-style
|xref:text.adoc#font-style[Font style] +
(default: _inherit_)
|[source]
admonition:
  font-style: italic

|padding
|xref:blocks.adoc#padding[Measurement] {vbar} xref:blocks.adoc#padding[Measurement[\]] +
(default: `[4, 12, 4, 12]`)
|[source]
admonition:
  padding: 1cm

|text-transform
|xref:text.adoc#transform[Text transform] +
(default: _inherit_)
|[source]
admonition:
  text-transform: none
|===

[#label]
== admonition-label

The keys in the `admonition-label` category control the arrangement and style of the text-based labels on admonition blocks.

[cols="3,5,6a"]
|===
|Key |Value Type |Example

|font-color
|xref:color.adoc[Color] +
(default: _inherit_)
|[source]
admonition:
  label:
    font-color: #262626

|font-family
|xref:font-support.adoc[Font family name] +
(default: _inherit_)
|[source]
admonition:
  label:
    font-family: M+ 1p

|font-kerning
|`none` {vbar} `normal` +
(default: _inherit_)
|[source]
admonition:
  label:
    font-kerning: none

|font-size
|xref:text.adoc#font-size[Font size] +
(default: _inherit_)
|[source]
admonition:
  label:
    font-size: 12

|font-style
|xref:text.adoc#font-style[Font style] +
(default: `bold`)
|[source]
admonition:
  label:
    font-style: bold_italic

|min-width
|xref:measurement-units.adoc[Measurement] +
(default: _not set_)
|[source]
admonition:
  label:
    min-width: 48

|<<padding,padding>>
|xref:measurement-units.adoc[Measurement] {vbar} xref:measurement-units.adoc[Measurement[top(n/a),right,bottom(n/a),left\]] +
(default: `$admonition-padding`)
|[source]
admonition:
  label:
    padding: [0, 12, 0, 12]

|text-align
|xref:text.adoc#text-align[Text alignment] +
(default: `center`)
|[source]
admonition:
  label:
    text-align: left

|text-transform
|xref:text.adoc#transform[Text transform] +
(default: `uppercase`)
|[source]
admonition:
  label:
    text-transform: lowercase

|vertical-align
|`bottom` {vbar} `middle` {vbar} `top` +
(default: `middle`)
|[source]
admonition:
  label:
    vertical-align: top
|===

[#padding]
=== padding

The top and bottom padding values are ignored on the `admonition-label-padding` key.

[#label-name]
== admonition-label-<name>

The keys in the `admonition-label-<name>` category control the arrangement and style of the text-based label that matches a built-in admonition name.
`<name>` can be `note`, `tip`, `warning`, `important`, or `caution`.

[cols="3,5,6a"]
|===
|Key |Value Type |Example

|font-color
|xref:color.adoc[Color] +
(default: _inherit_)
|[source]
admonition:
  label:
    caution:
      font-color: #262626

|font-family
|xref:font-support.adoc[Font family name] +
(default: _inherit_)
|[source]
admonition:
  label:
    important:
      font-family: M+ 1p

|font-kerning
|`none` {vbar} `normal` +
(default: _inherit_)
|[source]
admonition:
  label:
    warning:
      font-kerning: none

|font-size
|xref:text.adoc#font-size[Font size] +
(default: _inherit_)
|[source]
admonition:
  label:
    tip:
      font-size: 12

|font-style
|xref:text.adoc#font-style[Font style] +
(default: `bold`)
|[source]
admonition:
  label:
    tip:
      font-style: bold_italic

|text-transform
|xref:text.adoc#transform[Text transform] +
(default: `uppercase`)
|[source]
admonition:
  label:
    note:
      text-transform: lowercase
|===

[#icon-name]
== admonition-icon-<name>

The keys in the `admonition-icon-<name>` category control the arrangement and style of the specified icon associated with a built-in admonition name.
`<name>` can be `note`, `tip`, `warning`, `important`, or `caution`.
All icon types must be grouped under a single `icon` category.
In other words, the `icon` category _cannot_ be declared multiple times and its keys _cannot_ be flattened (e.g., `tip-name: far-lightbulb` is not valid syntax).

A font-based icon is placed in a container with a width 1.5 times the size of the icon.
This is done to give the icon more padding than the textual label.
This behavior will be configurable starting in Asciidoctor PDF 3.

The `image` key is only relevant when image-based icons are used (`icons=image`).
It's an alternative to using the `icon` attribute on the admonition block.
The path is resolved starting from the location of the AsciiDoc document and relative to the value of the `iconsdir` attribute.
The image macro syntax is not supported for this key.
The width is controlled by the `width` key.
The `width` key is only used for image-based icons.

[cols="3,5,6a"]
|===
|Key |Value Type |Example

|image
|path +
(default: _not set_)
|[source]
admonition:
  icon:
    tip:
      image: bulb.png

|<<name,name>>
|<icon set>-<icon name> +
(default: _not set_)
|[source]
admonition:
  icon:
    tip:
      name: fas-fire

|scale
|Number in range (0,1] +
(default: `2 / 3`)
|[source]
admonition:
  icon:
    note:
      scale: 1

|size
|xref:language.adoc#values[Number] +
(default: `36`)
|[source]
admonition:
  icon:
    note:
      size: 24

|stroke-color
|xref:color.adoc[Color] +
(default: caution=`#BF3400`; important=`#BF0000`; note=`#19407C`; tip=`#111111`; warning=`#BF6900`)
|[source]
admonition:
  icon:
    important:
      stroke-color: #FF0000

|width
|xref:measurement-units.adoc[Measurement] +
(default: `36`)
|[source]
admonition:
  icon:
    important:
      width: 24
|===

[#icon]
=== Identifying an icon

The `name` key assigned to a built-in admonition only accepts a value in the format of <icon set>-<icon name>`.
A value is always required when assigning an icon to a built-in admonition.
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.
The prefix (e.g., `fas-`) of the value determines which font set to use.
If the prefix is not specified, `fa-` is assumed.

[#name]
== admonition-<name>

Asciidoctor PDF does not currently support theming admonitions by name (i.e., type).
In other words, the theming system doesn't provide the `admonition-<name>` category key, where `<name>` is the admonition name (e.g., note, tip, etc).
That means it's not possible to apply a background color to one admonition type, such as NOTE, without applying it to all admonitions.
However, it is possible to extend Asciidoctor PDF to add this capability.

In order to add support for the `admonition-<name>` category key to the theming system, you need to create an extended converter.
That converter will intercept requests to convert an admonition and temporarily promote settings on the `admonition-<name>` category key to the `admonition` category key.
Once the admonition is converted (i.e., rendered), the original theme settings will be restored.

You can find the details of this extended converter in the xref:extend:use-cases.adoc#theme-admonition-per-type[theme admonition per type] use case on the xref:extend:use-cases.adoc[] page.
To apply the extension, refer to xref:extend:use-converter.adoc[].