• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015-2024 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5[[markup]]
6= Markup Style
7
8This chapter demonstrates Asciidoc and Specification structure, including
9text layout and markup style.
10
11
12[[markup-copyrights]]
13== Copyrights and Licenses
14
15The asciidoctor source for the Vulkan Specification and related documents is
16under an open source license.
17
18When creating a *new* file, add the following copyright and license
19statement at the top:
20
21[source,asciidoc]
22.Example Markup
23----
24// Copyright YEAR AUTHOR
25// SPDX-License-Identifier: CC-BY-4.0
26
27----
28
29`YEAR` should be replaced by the year in which the file was created.
30
31`AUTHOR` is normally "`The Khronos Group Inc.`".
32If a new file is created by a member company or outside contributor, use
33that entity's legal name as the author.
34
35`SPDX-License-Identifier` gives the license used for the file, following the
36https://spdx.github.io/spdx-spec/using-SPDX-short-identifiers-in-source-files/[SPDX]
37standard for short identifiers in source files.
38`CC-BY-4.0` is the short identifier for the
39https://spdx.org/licenses/CC-BY-4.0.html[Creative Commons Attribution 4.0
40International] license.
41
42No matter who holds the *copyright* on a source file for the Specification,
43it must be placed under the `CC-BY-4.0` *license*.
44When contributing to the Specification, contributors are required to execute
45a Contributor License Agreement to this effect.
46
47When updating an *existing* file, modify the following copyright and license
48statement to include the year(s) of modification.
49For example:
50
51[source,asciidoc]
52.Example Markup
53----
54// Copyright 2018-2024 The Khronos Group Inc.
55// SPDX-License-Identifier: CC-BY-4.0
56
57----
58
59indicates a file which has been been modified in 2018, 2019, and 2020
60inclusive.
61
62Files which are not actual specification source but are "`code-like`", such
63as scripts and Makefiles, are normally placed under the Apache 2.0 license.
64Use `SPDX-License-Identifier:` `Apache-2.0` for such files.
65
66
67[[markup-structure]]
68== Document Structure
69
70Chapters and sections follow a rigid template consisting of an optional
71anchor (if other parts of the document cross-reference the section) followed
72by a link:{docguide}/sections/titles-and-levels/[one line title] and a blank
73line.
74The anchor is typically the base name of the file containing the chapter,
75with a lowercased version of the section name following, with spaces
76replaced by dashes.
77
78Always use the one-line title form, with one to four `=` signs preceding the
79chapter/section title.
80The two-line title form cannot be easily searched for, and often looks like
81other types of asciidoctor delimiters.
82Using a mix of one-line and two-line titles causes compatibility issues, and
83using the two-line title form may implicitly set a backwards-compatibility
84syntax mode we do not want.
85
86Always precede the anchor by two blank lines (except at the beginning of a
87file), and follow the title by a blank line, to set off sections visibly.
88
89[source,asciidoc]
90.Example Markup
91----
92[[markup]]
93= Markup Style
94
95
96[[markup-sample-section]]
97== Sample Section
98----
99
100
101[[markup-include-file-paths]]
102=== Include File Paths
103
104When using the asciidoctor `include::` directive anywhere other than the
105top-level file of the document, always use a full (absolute) path to the
106file being included.
107To make this easier, the specification build process defines several
108attributes which refer to different paths in the document tree:
109
110  * `\{chapters}` - path to the `chapters/` directory containing most of the
111    specification.
112  * `\{appendices}` - path to the `appendices/` directory containing
113    appendices.
114  * `\{generated}` - path to the temporary directory containing generated
115    files such as API includes.
116  * `\{config}` - path to configuration files used in the spec toolchain.
117
118Numerous examples of using these attributes are given in the <<writing,
119Writing Style>> and <<extensions, API Versions, Extensions, and Layers>>
120chapters.
121
122
123[[markup-sample-section]]
124== Sample Section
125
126This is a sample section structurally similar to the <<vulkan-spec,Vulkan
127API Specification>>, nested one level inside a chapter.
128Sections can be nested up to level 5, although not all levels are included
129in the Table of Contents.
130
131
132[[markup-layout]]
133== Asciidoc Markup and Text Layout
134
135Asciidoc source should be text filled to 76 columns with hard line breaks.
136Each sentence in a paragraph ends with a newline to minimize git diff
137conflicts.
138Except when necessary for lists or other markup, text should begin at the
139first column of each line (leading spaces are often semantically meaningful
140in asciidoctor markup).
141
142UTF-8 characters outside the ASCII subset should be used sparingly, only
143when needed for non-English names.
144Instead use asciidoctor markup for special characters, if required.
145For example, two hyphens produces an em-dash:
146
147[NOTE]
148.Example Markup
149====
150
151`+An -- em-dash+` -> An -- em-dash
152====
153
154As an exception, multiplication should be marked with the unicode
155multiplication symbol "`×`" (and *not* an asterisk) when used in plain text.
156You may also use the `\{times}` asciidoctor attribute for this symbol.
157In math sections, the same symbol should be referred to as `\times`.
158In code sections, a conventional asterisk (`*`) should be used instead.
159
160The trailing `+` character causes a hard break in asciidoctor markup, and
161should not be used except for this purpose.
162Markup addition with the \{plus} asciidoctor attribute, except in
163<<writing-math-latexmath, LaTeX math>> and <<markup-blocks, source blocks>>.
164
165See the Asciidoctor docs for
166link:{docguide}/subs/special-characters[supported special characters], as
167well as use of entity references.
168
169Quotation marks should use the 66/99 convention.
170That is, double asymmetric quotation marks, indicated by a quotation mark
171then a backtick as opening marks, and a backtick then quotation mark as
172closing marks (pass:["`like this`"]), which renders "`like this`".
173
174_Never_ use hard tabs or trailing blanks.
175
176* In some cases, limitations of asciidoctor markup may result in lines that
177  are longer than 76 characters and cannot easily be shortened without
178  compromising the output documents.
179
180
181[[markup-minimize-indentation]]
182=== Minimize Indentation
183
184Indentation (leading whitespace) for markup should not be used, except for
185<<markup-sample-section-bullet-lists, bullet lists>> as described below.
186Leading whitespace can affect asciidoctor processing.
187
188When presenting unformatted text, use asciidoctor source blocks as described
189in the next section.
190Source blocks do allow leading whitespace, for example when including sample
191code in C.
192
193
194[[markup-blocks]]
195=== Blocks
196
197There are a variety of asciidoctor _block_ constructs.
198With the exception of <<markup-sample-section-tables,tables>> and of _open
199blocks_ used to group markup together, blocks should be delimited by exactly
200four repeated characters indicating the block type, for consistency.
201The block types and delimiters are shown in the following table.
202
203.Asciidoc Block Delimiters
204[width="70%",options="header",cols="25%,10%,65%"]
205|====
206| Table Type    | Delimiter     | Comments
207| Open          | `--`          | For <<markup-sample-section-bullet-lists,continuation blocks>> and reference pages
208| Open (alt.)   | `----`        | For continuation blocks inside reference pages. Must be preceded by `[open]`
209| Example       | `====`        | For <<markup-informative-notes,Notes>>
210| Passthrough   | `pass:[++++]` | For some kinds of <<writing-math,math markup>>
211| Comment       | `////`        |
212| Listing       | `----`        | For source code listings
213| Sidebar       | `pass:[****]` | For <<markup-implementors-notes,implementor's notes>>
214| Table         | `\|====`      | For <<markup-sample-section-tables,tables>>
215| Quote         | `pass:[____]` |
216| Literal       | `pass:[....]` |
217|====
218
219
220[[markup-blocks-nested-open]]
221==== Open Blocks Nested in Open Blocks
222
223If you need to include an `open` block that would normally use `--`
224delimiters inside an open block delimiting a reference page, such as a
225continuation block, use the markup:
226
227[source,asciidoc,subs=attributes+]
228.Example Markup
229----
230[open]
231{blank}----
232Open block contents
233{blank}----
234----
235
236This replaces prior use of `pass:[~~~~]` delimiters and is enabled by a
237custom asciidoctor extension.
238The `[open]` block type is required in this case, to distinguish the block
239from a regular listing block using the same delimiter.
240
241
242[[markup-footnotes]]
243=== Footnotes
244
245Use manually marked-up footnotes (the asciidoctor footnote construct is OK
246for PDF outputs, but does not work well with long HTML documents since it
247places all footnotes at the end of the document).
248
249Refer to footnotes with asciidoctor superscript notation^1^, and mark up the
250footnotes below, but near the references as labelled lists.
251Manually assigned footnote numbers will inevitably be reused, which is OK as
252long as the colliding numbers are not in the same section.
253
2541::
255    Like this example footnote.
256
257[NOTE]
258====
259.Example Markup
260[source,asciidoc]
261----
262See reference^2^
263
2642::
265    Reference 2.
266----
267
268->
269
270See reference^2^
271
2722::
273    Reference 2.
274====
275
276
277[[markup-sample-section-lists]]
278=== Lists
279
280
281[[markup-sample-section-bullet-lists]]
282==== Bullet Lists and Continuation Blocks
283
284  * Bullet lists are the preferred form of list, aside from glossary
285    definitions.
286  * Lists should have text indented by 4 spaces and the list item delimiter
287    (e.g. one or more asterisks, for bullet lists) indented by two spaces.
288+
289Note that continuation blocks for list items longer than one paragraph
290cannot be indented, only the first paragraph.
291+
292In general, successive list items should not be separated by white space.
293However, list continuation blocks should be followed by a `+` on a line by
294itself, or by a blank line, due to limitations of the asciidoctor parser.
295+
296  * Indent bullet lists two spaces (to the bullet), 4 spaces (to the text,
297    if it extends over multiple lines).
298    This lets us visually distinguish lists from other kinds of markup.
299  ** Nested lists should align the leftmost list item delimiter (bullet,
300     etc.) with the parent delimiter.
301
302[source,asciidoc]
303.Example Markup
304----
305  * This is the first item in a bullet list.
306  * The second item is described with two paragraphs.
307    The second paragraph is in a continuation block:
308+
309This is a continuation block containing the second paragraph,
310+
311  ** This is a nested list item for the second item.
312     Since it follows a continuation block, it must be separated by a blank
313     line or `+` from that block.
314----
315
316[example]
317====
318  * This is the first item in a bullet list.
319  * The second item is described with two paragraphs.
320    The second paragraph is in a continuation block:
321+
322This is a continuation block containing the second paragraph,
323+
324  ** This is a nested list item for the second item.
325     Since it follows a continuation block, it must be separated by a blank
326     line or `+` from that block.
327====
328
329  * It is possible to continue a paragraph of the first bullet after a list
330    of sub-bullets if so desired by using continuations in a similar
331    fashion:
332
333[source,asciidoc]
334.Example Markup
335----
336  * This an item in a bullet list.
337+
338  ** This is a nested list item for the second item.
339     Since it follows a continuation block, it must be separated by a blank
340     line or `+` from that block.
341+
342This is a continuation of the first bullet
343----
344
345[example]
346====
347  * This an item in a bullet list.
348+
349  ** This is a nested list item for the second item.
350     Since it follows a continuation block, it must be separated by a blank
351     line or `+` from that block.
352+
353This is a continuation of the first bullet
354====
355
356
357[[markup-labelled-lists]]
358==== Labelled Lists
359
360Labelled lists may be used in some cases such as
361<<markup-footnotes,footnotes>>; glossary entries; and long lists of
362information about similar names, such as the "`Features, Limits, and
363Formats`" chapter of the Vulkan Specification.
364Whenever labelled lists are used the label and its terminating double colon
365must be alone on a line, followed by the contents of that list entry.
366
367For consistency do not use labels ending in three or four colons, or two
368semicolons, even though these forms are allowed in asciidoctor markup.
369
370[source,asciidoc]
371.Example Markup
372----
373Glossary Entry::
374    This is a glossary entry.
375
376Last Modified Date::
377    2016-02-16
378----
379
380
381[[markup-numbered-lists]]
382==== Numbered Lists
383
384Numbered lists may be used if strictly necessary to place an ordering on
385list items.
386Always use _implicit numbering_, with the bullet point being a single
387period.
388
389  . Explicit numbering with a number preceding the period is prone to
390    accumulating errors as edits are made.
391  . In addition, the markup is harder to recognize for scripts and tools
392    (other than asciidoctor itself) operating on the document source.
393
394[source,asciidoc]
395.Example Markup
396----
397. First list item.
398. Second list item.
399. Etc.
400----
401
402
403[[markup-sample-section-anchors]]
404=== Anchors and Cross-references
405
406In general, chapters and sections should always have anchors, following the
407naming convention <<markup,discussed above>>.
408Anchors to other sections of the document may be inserted as needed.
409In addition, the autogenerated include files defining commands, structures,
410enumerations and flags all define anchors whose name is the name of the
411command or type being defined, so it is easy to link to a (for example) a
412command name such as <<vkCreateCommandPool,vkCreateCommandPool>>.
413However, using the <<markup-macros,markup macros>> described below is
414preferred when linking to anchors corresponding to API names, such as
415flink:vkCreateCommandPool.
416
417If you want a cross-reference to an anchor to appear as something other than
418the raw anchor name, always make sure to include that text as part of the
419cross-reference.
420There are several different toolchains followed for various forms of
421asciidoctor output, and not all of them treat anchors without alt-text the
422same way.
423
424[source,asciidoc]
425.Example Markup
426----
427In general, chapters and sections should always have anchors, following the
428naming convention <<markup,discussed above>>.
429...
430so it is easy to link to a (for example) a command name such as
431<<vkCreateCommandPool,vkCreateCommandPool>>. However, using the
432<<markup-macros,markup macros>> described below is preferred when linking to
433anchors corresponding to API names, such as flink:vkCreateCommandPool.
434----
435
436
437[[markup-sample-section-features]]
438=== Feature Cross-References
439
440When creating a cross-reference to an API feature (see the "`Features,
441Limits, and Formats`" chapter of the Vulkan Specification), use the
442following markup convention:
443
444[source,asciidoc]
445.Example Markup
446----
447The <<features-someFeatureName, pname:someFeatureName>> feature ...
448----
449
450Always use the API feature name as the cross-reference text.
451
452
453[[markup-sample-section-tables]]
454=== Tables
455
456Asciidoc tables should use the block prefix `|====`.
457Where feasible, align the `|` separating cells across rows.
458This will sometimes result in very wide tables in the source document, but
459makes it easier to see which cells belong to which column.
460Alternatively, long cells can be broken onto a separate line with the `|`
461separator appearing first, except for the first row of the table, which must
462all appear on a single line.
463
464Tables should usually be preceded with a short title.
465
466[source,asciidoc]
467.Example Markup
468----
469.Normative Terminology Macros
470[width="100%",options="header"]
471|====
472| Macro Name     | Output
473| can{cl}        | can:
474| cannot{cl}     | cannot:
475|====
476----
477
478
479[[markup-sample-section-images]]
480=== Figures
481
482All figures (images) must be marked up as follows, to ensure there is an
483anchor and that the figure is given a caption which shows the figure number
484and is added to the list of figures.
485
486[source,asciidoc]
487.Example Markup
488----
489[[fig-anchorname]]
490image::{images}/imagename.svg[align="center",title="Figure caption",opts="{imageopts}"]
491----
492
493There must be SVG versions of each figure checked into the `images/`
494directory, to support generating both HTML and PDF outputs.
495This directory is referred to as `\{images}` so that there is a consistent
496path no matter what directory the file including the images is in.
497The PDF generation pipeline is now able to use SVG images, so PDF versions
498of each image are no longer required.
499The `opts=` attribute defaults to `inline`, which decreases output image
500size in the generated HTML.
501However, the `inline` option interferes with generating HTML diffs between
502two specifications with the script we currently use.
503By using an asciidoctor attribute, this behavior can be controlled.
504
505Asciidoctor restricts captions in figures to be a single line in the source
506document.
507If a longer caption is required, follow the figure directive with a sidebar
508block including the full caption preceded by a link to the figure:
509
510[source,asciidoc]
511.Example Markup
512----
513.Caption
514****
515In the <<fig-anchorname,Figure caption>> diagram, the diagram represents
516... long caption text here.
517****
518----
519
520
521[[markup-indentation-equations]]
522=== Indentation of Equations
523
524Asciidoctor separates structural markup in asciidoctor source from
525formatting, in HTML CSS stylesheets and invoked via asciidoctor "`role`"
526attributes on blocks.
527However, the flexibility of CSS stylesheets is not available in PDF layout
528using the existing PDF toolchain and YML stylesheets.
529
530Explicit indentation should be used sparingly in the specification, but one
531place it is useful is with equations.
532Using <<writing-math, asciidoctor math markup>>, the easiest way to produce
533indentation is with a list where the leading bullet or descriptive text is
534suppressed
535
536[source,asciidoc]
537.Example Markup
538----
539[none]
540  * A {plus} B
541
542or
543
544  {empty}:: A {plus} B
545----
546
547->
548
549[example]
550====
551[none]
552  * A {plus} B
553
554or
555
556  {empty}:: A {plus} B
557====
558
559
560[[markup-italicized-enumerant-names]]
561=== Italicized Enumerant Names
562
563When writing a "`wildcard`" enumerant name containing an italicized term
564within it, it is difficult to directly combine constrained formatting markup
565(double underscores) and the single underscores that separate words in the
566enumerant.
567Instead, use attribute substitution as suggested in the "`Escape
568unconstrained formatting marks`" section of the AsciiDoc Language
569Documentation.
570To help when this is required, an attribute `\{ibit}` expanding to
571`pass:[_i_]` is defined in `config/attribs.adoc`, and the same technique can
572be used for similar markup in other cases if `_i_` is not the desired
573italicized term:
574
575[source,asciidoc]
576.Example Markup
577----
578`VK_IMAGE_ASPECT_PLANE__{ibit}__BIT`
579----
580
581->
582
583[example]
584====
585`VK_IMAGE_ASPECT_PLANE__{ibit}__BIT`
586====
587
588[NOTE]
589.Note
590====
591This technique cannot be used with the <<markup-macros, markup macros>> that
592are normally used to semantically tag API names.
593Because there are so few places it is needed, conventional backquote
594formatting markup is used instead.
595====
596
597
598[[markup-macros]]
599== Markup Macros and Normative Terminology
600
601This section discusses Asciidoc macros used in the document.
602In addition to the macros defined by asciidoctor itself, additional macros
603are defined by the <<vulkan-spec,Vulkan API Specification>> and Reference
604Page configuration files.
605
606
607[[markup-macros-api]]
608=== API Markup Macros
609
610These macros must be used to tag command, structure, enumeration, enumerant,
611and other Vulkan-specific names so they can be rendered in a distinctive
612fashion, link to definitions of those names, and be easily searched for in
613the source documents.
614The validation scripts (`make allchecks` output) also rely on these macros
615being used consistently and correctly.
616The API markup macros, with examples of their use, are in the following
617table (note that these examples will not actually successfully link into
618corresponding specification or reference pages, since they are in an
619unrelated document).
620
621.API Markup Macros
622[width="100%",options="header",cols="20%,80%"]
623|====
624| Macro Name    | Usage and Meaning
625| reflink{cl}   | Generates a cross-reference or link to an unknown type of
626                  API entity. This is only used in generated content in the
627                  reference pages which refers to other reference pages
628                  which are not actually part of the API. Example:
629                  reflink{cl}WSIheaders -> reflink:WSIheaders.
630| pass:c[`apiext:`] | Generates a cross-reference or link to the description
631                  of an extension. Example: pass:c[`apiext:VK_KHR_ray_tracing_pipeline`]
632                  -> `apiext:VK_KHR_ray_tracing_pipeline`.
633| flink{cl}     | Generates a cross-reference or link to the definition of
634                  the command name in the macro argument. Example:
635                  flink{cl}vkCreateCommandPool -> flink:vkCreateCommandPool.
636| fname{cl}     | Formats the macro argument like flink{cl}. Does not
637                  generate a cross-reference. Example:
638                  fname{cl}vkCreateCommandPool -> fname:vkCreateCommandPool.
639
640                  Only use this macro <<markup-macros-api-name, when
641                  necessary>>.
642| ftext{cl}     | Formats the macro argument like fname{cl}. May contain
643                  asterisks for wildcards. Not validated. Example:
644                  ftext{cl}vkCmd* -> ftext:vkCmd*.
645
646                  Only use this macro <<markup-macros-api-text, when
647                  necessary>>.
648| slink{cl}     | Generates a cross-reference or link to the definition
649                  of the structure or handle in the macro argument. Example:
650                  slink{cl}VkMemoryHeap -> slink:VkMemoryHeap.
651| sname{cl}     | Formats the macro argument like slink{cl}. Does not
652                  generate a cross-reference. May also be an abstract
653                  structure or handle name. Example:
654                  sname{cl}VkCommandPoolCreateInfo ->
655                  sname:VkCommandPoolCreateInfo.
656
657                  Only use this macro <<markup-macros-api-name, when
658                  necessary>>.
659| stext{cl}     | Formats the macro argument like sname{cl}. May contain
660                  asterisks for wildcards. Not validated. Example:
661                  stext{cl}Vk*CreateInfo -> stext:Vk*CreateInfo.
662
663                  Only use this macro <<markup-macros-api-text, when
664                  necessary>>.
665| elink{cl}     | Formats the macro argument as a Vulkan enumerated
666                  type name and links to the definition of that enumeration
667                  type. Example: elink{cl}VkResult -> elink:VkResult.
668| ename{cl}     | Formats the macro argument as a Vulkan enumerant name.
669                  Example: ename{cl}VK_EVENT_SET -> ename:VK_EVENT_SET.
670                  Note that this is not related to elink{cl}, unlike the
671                  other macro link{cl}/text{cl} pairings.
672| etext{cl}     | Formats the macro argument like ename{cl}. Not validated.
673                  Examples: etext{cl}_RANGE_SIZE -> etext:_RANGE_SIZE,
674                  etext{cl}VK_IMAGE_CREATE_SPARSE_* ->
675                  etext:VK_IMAGE_CREATE_SPARSE_*
676
677                  Only use this macro <<markup-macros-api-text, when
678                  necessary>>.
679| pname{cl}     | Formats the macro argument as a Vulkan parameter or
680                  structure member name. Example: pname{cl}device ->
681                  pname:device.
682| ptext{cl}     | Formats the macro argument like pname{cl}. May contain
683                  asterisks for wildcards. Not validated. Example:
684                  ptext{cl}sparseResidency* -> ptext:sparseResidency*.
685
686                  Only use this macro <<markup-macros-api-text, when
687                  necessary>>.
688| tlink{cl}     | Generates a cross-reference or link to the definition
689                  of the Vulkan type in the macro argument.
690                  Example: tlink{cl}PFN_vkAllocationFunction ->
691                  tlink:PFN_vkAllocationFunction.
692                  This is only used for function pointer and `Vk*Flags`
693                  types at present, although it is a potentially a catch-all
694                  for other types not covered by a more specific macro.
695| tname{cl}     | Formats the macro argument like tlink{cl}. Does not
696                  generate a cross-reference. Example:
697                  tname{cl}PFN_vkAllocationFunction ->
698                  tname:PFN_vkAllocationFunction.
699
700                  Only use this macro <<markup-macros-api-name, when
701                  necessary>>.
702| dlink{cl}     | Generates a cross-reference or link to the definition of
703                  the Vulkan C macro in the macro argument. Example:
704                  dlink{cl}VK_NULL_HANDLE -> dlink:VK_NULL_HANDLE. There are
705                  only a few macros in the Vulkan API, described in the
706                  "`API Boilerplate`" appendix of the <<vulkan-spec,Vulkan
707                  API Specification>>
708| dname{cl}     | Formats the macro argument like dlink{cl}. Does not
709                  generate a cross-reference.
710
711                  Only use this macro <<markup-macros-api-name, when
712                  necessary>>.
713| basetype{cl}  | Formats the macro argument like a basic scalar type,
714                  handle name, or type defined by an external API, with a
715                  definition in the Vulkan Specification.
716                  Examples: basetype{cl}VkBool32 -> basetype:VkBool32,
717                  basetype{cl}AHardwareBuffer -> basetype:AHardwareBuffer,
718                  basetype{cl}VkDeviceSize -> basetype:VkDeviceSize.
719
720                  The `Std*` types used in the Vulkan video APIs
721                  intentionally have no definition in the Vulkan
722                  Specification. Use the code{cl} macro for these types.
723| code{cl}      | Formats the macro argument as a code sample.
724                  Used for SPIR-V keywords, builtin C types, and names
725                  belonging to other APIs such as Linux or Windows system
726                  calls.
727                  Examples: code{cl}uint32_t -> code:uint32_t,
728                  code{cl}ClipDistance -> code:ClipDistance.
729                  code{cl}OpImage*Gather -> code:OpImage*Gather,
730                  code{cl}StdVideoDecodeH264PictureInfo ->
731                  code:StdVideoDecodeH264PictureInfo.
732
733                  This macro allows imbedded field member (`.`) and wildcard
734                  (`*`) text separating words, ending with an optional
735                  wildcard.
736|====
737
738When referring to a compound name (function-parameter, or structure-member),
739combine the macros separated by two colons, resulting in
740flink:vkCmdBindIndexBuffer::pname:indexType and
741slink:VkMemoryHeap::pname:flags.
742This is often done when referring to a particular parameter or member in a
743part of the document other than the description of the corresponding
744function or structure.
745When a nested member within the compound name is referred to, use normal C
746markup:
747
748[source,asciidoc]
749.Example Markup
750----
751flink:vkCmdBindIndexBuffer::pname:indexType
752sname:VkExternalImageFormatProperties::pname:externalMemoryProperties.externalMemoryFeatures
753pname:pAllocateInfo->memoryTypeIndex
754----
755
756[NOTE]
757.Note
758====
759In the macros, "```\->```" is correct markup for the C arrow operator.
760But in any other context (including a "```````" delimited inline literal) it
761would be subject to link:{docguide}/subs/replacements/[Asciidoctor character
762replacement substitutions], resulting in a unicode arrow: ->.
763====
764
765
766[[markup-macros-api-name]]
767==== When to Use *name: Macros
768
769Only use the fname{cl}, sname{cl}, tname{cl}, and dname{cl} macros if no
770definition of the target type with a corresponding anchor exists in the
771document.
772Anchors are automatically defined when including the generated API interface
773definitions under `\{generated}/api/*/*adoc`.
774If an anchor does exist, use the corresponding *link{cl} macro.
775
776[NOTE]
777.Note
778====
779There are many legacy uses of the *name{cl} macros that will be replaced
780over time.
781These uses date from before anchors were added to the generated API
782definitions.
783====
784
785
786[[markup-macros-api-text]]
787==== When to Use *text: Macros
788
789Only use the ftext{cl}, stext{cl}, etext{cl}, and ptext{cl} macros when
790describing something that should be rendered like a command, structure,
791enumerant, or parameter name, respectively, but is not actually one.
792Typically these macros are used for wildcards describing multiple API names
793with common prefixes or suffixes, or common subsets of API names.
794
795
796[[markup-macros-prime-symbols]]
797==== Prime Symbols
798
799Occasionally we want to use mathematical prime symbols as markup in regular
800text, outside of <<latexmath, LaTeX math markup>>.
801While it is easy to write the single quote character for this, since that is
802what LaTeX uses, asciidoctor will turn this into a curved quote character
803whenever it is followed by an alphabetic character.
804For example, when writing the {YCbCr} term widely used to describe a color
805encoding, the obvious markup does not look quite right:
806
807.Prime Attributes (incorrect, with curved prime symbol)
808[width="30%",options="header"]
809|====
810| Markup              | Output
811| `pass:[Y'C~b~C~r~]` | Y'C~b~C~r~
812|====
813
814Using a backslash to escape the apostrophe works in body text, but not
815places such as section titles, captions, and link text.
816When prime symbols are needed, use the Unicode ``prime'' symbol.
817Several predefined asciidoctor variables are available to help with this,
818including symbols for {YCbCr} and {RGBprime} because they are frequently
819used in the specification.
820
821.Prime Attributes (correct)
822[width="30%",options="header"]
823|====
824| Markup              | Output
825| `pass:[{prime}]`    | {prime}
826| `pass:[{YCbCr}]`    | {YCbCr}
827| `pass:[{RGBprime}]` | {RGBprime}
828|====
829
830
831==== Other Markup
832
833Uses of standard Asciidoc markup are less common.
834Occasional asterisk markup is used for *emphasis*.
835Underscores are used for _glossary terms_.
836Backtick markup is used for the C `NULL` macro.
837
838[source,asciidoc]
839.Example Markup
840----
841*emphasis*
842`NULL`
843----
844
845
846==== Glossary Terms
847
848Glossary terms are currently marked up using underscore markup where they
849are defined in the documents, as well as being added to the formal Glossary
850appendix in the <<vulkan-spec,Vulkan API Specification>>.
851However, we will probably change to using custom macros soon, to enable
852linkage between the glossary and definitions in the specification body.
853
854[source,asciidoc]
855.Example Markup
856----
857_Glossary terms_
858----
859
860
861=== Normative Terminology
862
863Normative terminology is precisely defined in section 1.3 of the
864<<vulkan-spec,Vulkan API Specification>>, and is used to visually tag terms
865which express mandatory and optional behavior of Vulkan implementations, and
866of applications using Vulkan.
867
868Whenever one of these terms appears in the <<vulkan-spec,Vulkan API
869Specification>> outside of an <<markup-informative,informative section>>, it
870must be tagged using the macros, to indicate that its use has been carefully
871considered and is consistent with the definitions in section 1.3.
872This is extremely important for determining IP that is in and out of Scope
873during Ratification reviews.
874The normative terminology macros are defined in the following table:
875
876.Normative Terminology Macros
877[width="30%",options="header"]
878|====
879| Macro Name     | Output
880| can{cl}        | can:
881| cannot{cl}     | cannot:
882| may{cl}        | may:
883| may{cl} not    | may: not
884| must{cl}       | must:
885| must{cl} not   | must: not
886| optional{cl}   | optional:
887| optionally{cl} | optionally:
888| required{cl}   | required:
889| should{cl}     | should:
890| should{cl} not | should: not
891|====
892
893Note that the macros are lower-case only, so language should be written such
894that these terms do not appear at the beginning of a sentence (if really
895necessary, additional capitalized macros could be added).
896
897
898==== Optional Behavior
899
900If a described behavior of the implementation is not necessary for
901conformance, use the terms _may{cl}_, _optional{cl}_, or _optionally{cl}_ to
902describe it.
903
904If a described usage pattern by the application is allowed but not
905necessary, use the term _can{cl}_ to describe it.
906
907If language flows more logically using the term "`may not`", use the term
908_may{cl} not_ to describe it.
909
910
911==== Optional Functionality
912
913If functionality (rather than behavior) is optional, it should be described
914as
915
916[source,asciidoc]
917.Example Markup
918----
919not required:
920----
921
922Implementations are not mandated to support functionality which is not
923required, but if they do, they must behave as described by the
924<<vulkan-spec,Vulkan API Specification>>.
925The term _functionality_ includes API features, extensions, and layers.
926
927
928[[markup-informative]]
929== Informative, Editing and Implementor's Notes
930
931There are several possible types of notes.
932Depending on the type of output, they are rendered in different styles, but
933always include a note title, and are usually set off in a box or with an
934icon.
935While asciidoctor supports a wide set of _admonition paragraphs_ such as
936TIP, IMPORTANT, WARNING, and CAUTION, we always use the NOTE form, augmented
937by a note title.
938Each type of note is discussed below.
939
940
941[[markup-informative-notes]]
942=== Informative Sections and Notes
943
944If an entire chapter or section is considered informative, its title should
945be suffixed with "`(Informative)`".
946Additionally, the chapter or section text may begin with the sentence:
947
948[source,asciidoc]
949.Example Markup
950----
951== Explanatory Section (Informative)
952
953This chapter/section is Informative.
954----
955
956Informative notes always appear as part of the document, but are considered
957non-normative.
958They usually describe usage advice for applications, and are always given
959the title _Note_, as in the following example:
960
961[NOTE]
962.Note
963====
964This is an informative note.
965====
966
967[source,asciidoc]
968.Example Markup
969----
970[NOTE]
971.Note
972====
973This is an informative note.
974====
975----
976
977It is not necessary to include the text "`Informative`" in the body of the
978note.
979
980
981[[markup-editing-notes]]
982=== Editing Notes
983
984Editing notes usually only appear in internal (non-published) versions of
985documents, via asciidoctor conditionals.
986If they are not resolved, or are internal issues that should not be visible
987in public, they should be removed from the source before pushing content to
988the canonical GitHub repository.
989They usually tag places where an outstanding Gitlab/GitHub issue is being
990worked, and are always given the title _editing-note_, as in the following
991example:
992
993ifdef::editing-notes[]
994[NOTE]
995.editing-note
996====
997This is an editing note, marked up as follows:
998====
999endif::editing-notes[]
1000
1001[source,asciidoc]
1002.Example Markup
1003----
1004\ifdef::editing-notes[]
1005[NOTE]
1006.editing-note
1007====
1008Contents of an editing note go here.
1009It is good practice to include a Gitlab/GitHub issue number, or link to the
1010issue, in the editing note.
1011====
1012\endif::editing-notes[]
1013----
1014
1015
1016[[markup-implementors-notes]]
1017=== Implementor's Notes
1018
1019Implementor's notes may or may not appear in published versions of
1020documents, via asciidoctor conditionals.
1021They describe suggested approaches or guidelines for people writing Vulkan
1022implementations, and are rare because the hardware being targeted varies so
1023widely.
1024They are always given the title _Implementor's Note_, as in the following
1025example:
1026
1027ifdef::implementation-guide[]
1028.Implementor's Note
1029====
1030This is an implementor's note, marked up as follows:
1031====
1032endif::implementation-guide[]
1033
1034[source,asciidoc]
1035.Example Markup
1036----
1037\ifdef::implementation-guide[]
1038.Implementor's Note
1039====
1040Contents of an implementor's note go here.
1041====
1042\endif::implementation-guide[]
1043----
1044
1045
1046[[markup-word-choices]]
1047== Word Choices
1048
1049There are a variety of common terms that have several equivalent word
1050choices.
1051Always use the words or phrases in the first column instead of the alternate
1052terms.
1053This list may not be comprehensive; when in doubt, be guided by the existing
1054<<vulkan-spec,Vulkan API Specification>>.
1055
1056.Word Choices
1057[width="100%",options="header"]
1058|====
1059| Use This      | Instead Of     | Comments
1060| allocate      | create
1061                | When describing objects or memory resulting from
1062                  ftext:vkAllocate* commands.
1063| application   | client / user  |
1064| begins / begun      | starts / started | For ftext:vkBegin* - also see "`finish`"
1065| finishes / finished | ends / ended     | For ftext:vkEnd* - also see "`begins`"
1066| bitmask       | bit field
1067                | Technically correct. Vulkan bitmasks are just integers and
1068                  are not logically addressable at the bit level.
1069| bound         | currently bound
1070                | Appears primarily in valid usage statements, which are
1071                  always referring to the current state of the objects
1072                  they are validating.
1073                  Rare exceptions may be justified in other cases.
1074| called in a command buffer
1075                | called on a command buffer
1076                | Technically correct.
1077| command       | function
1078                | Except when talking about function pointers returned by
1079                  ftext:vkGet*ProcAddr commands.
1080| component     | channel        | Specifically this refers to color channels/components
1081| create        | allocate
1082                | When describing objects resulting from ftext:vkCreate*
1083                  commands.
1084| depth/stencil | packed (interleaved, combined, _other prefix_)
1085                  depth/stencil, depth-stencil, DepthStencil, etc.
1086                | Combined format implicit in the name.
1087| device        | GPU / processor / accelerator
1088                | The Vulkan specification is functional and could be
1089                  implemented in many different ways.
1090| dispatching command, +
1091  drawing command
1092                | dispatch command,
1093                  draw command   | Glossary usage
1094| executable memory, +
1095  executable state, +
1096  pipeline executable
1097                | executable     | Disambiguation
1098| heterogeneous | heterogenous   | More common
1099| homogeneous   | homogenous     | More common
1100| host          | CPU |
1101| host endianness | platform endianness |
1102| image subresource | subresource
1103                | Except when referring to _host-accessible subresources_
1104| implementation| system / hardware / software
1105                | For consistency, and avoids implied requirements.
1106| implementor   | implementer    | For consistency with historical specification practice
1107| indices       | indexes        | More common
1108| _handle_ is not dlink{cl}VK_NULL_HANDLE
1109                | _handle_ is a valid structure |
1110| member        | field          |
1111| ename:enumerant specifies
1112                | ename:enumerant indicates (denotes)
1113                | When giving a brief description of enums in an enumerated
1114                  type.
1115                  It is often appropriate to use "`enumerant _is_`" when
1116                  describing the behavior or meaning of enumerants in other
1117                  places.
1118| _verb_ on the device
1119                | _verb_ in the device
1120                | Such as "`enabled on`" or "`executed on`"
1121| pname:parameter are/is
1122                | pname:parameter specifies (denotes, indicates)
1123                | In cases when _are_ or _if_ are not grammatically
1124                  appropriate, _specifies_ may be used instead.
1125| pname:parameter is
1126                | the value of pname:parameter is
1127                | In rare cases, _the value of_ is appropriate. See the
1128                  existing specification language for examples.
1129| pname:parameter is a _typename_ containing / controlling / defining /
1130  describing / specifying / etc.
1131                | pname:parameter is a _typename_ that/which contains
1132                  (controls, defines, describes, specifies, etc.)
1133                | Commonly used for more nuanced descriptions of parameters
1134                  or structure members
1135| reference monitor   | mastering display|
1136| runtime       | run time / run-time | Arbitrary choice for consistency
1137| used          | referenced     | When describing attachments specified in a
1138                                   subpass description.
1139| statically used | referenced   | When describing resources or push constants
1140                                   accessed by shader code
1141| _a more specific term_ | referenced | For all other situations.
1142|====
1143
1144[NOTE]
1145.Note
1146====
1147The "`begin/start`" and "`end/finish`" distinction is still being sorted
1148out.
1149See Gitlab issue #61.
1150====
1151
1152
1153[[markup-avoid-contractions]]
1154=== Avoid Abbreviations and Contractions
1155
1156Abbreviations and contractions make the specification sound less formal.
1157Avoid using them in specification text.
1158The following lists provides some guidance, but are not complete.
1159
1160.Word Choices (Contractions)
1161[width="30%",options="header"]
1162|====
1163| Use This      | Instead Of
1164| are not       | aren't
1165| cannot{cl}    | can't
1166| does not      | doesn't
1167| do not        | don't
1168| has not       | hasn't
1169| is not        | isn't
1170| it is         | it's
1171| should not    | shouldn't
1172| that is       | that's
1173| there is      | there's
1174| we are        | we're
1175| we will       | we'll
1176| we would      | we'd
1177| what is       | what's
1178| will not      | won't
1179| would not     | wouldn't
1180|====
1181
1182.Word Choices (Abbreviations)
1183[width="30%",options="header"]
1184|====
1185| Use This      | Instead Of
1186| information   | info
1187| specification | spec
1188|====
1189
1190[NOTE]
1191.Note
1192====
1193Avoid using abbreviations in specification text describing the API, even
1194though there are certain <<naming-abbreviations, approved abbreviations>>
1195used in the names of API entities such as commands, structures, and
1196enumerants.
1197====
1198
1199
1200[[markup-terms-caution]]
1201=== Terms to Use With Caution
1202
1203The term _subset_ is sometimes used to refer to a _strict subset_, and
1204sometimes used to refer to a subset which may be equal to the entire set.
1205This is particularly likely to come up when describing bitmasks.
1206Make sure to use either _subset_ or _strict subset_ as appropriate.
1207
1208
1209[[markup-terms-avoid]]
1210=== Terms to Avoid
1211
1212Do not describe anything in the documentation using vague or wishy-washy
1213terms.
1214Our goal is to precisely describe behavior of implementations.
1215
1216The normative terms may{cl}, optional{cl}, and should{cl} are available when
1217implementations may make choices of behavior, but when such choices are
1218allowed, each choice still must have well-defined behavior.
1219
1220.Terms to Avoid
1221[width="100%",options="header"]
1222|====
1223| Bad Term | Comments
1224| expect   | And variants such as _expected_
1225| likely   | And variants such as _will likely_
1226| allowed, could, generally, might, probably, perhaps
1227           | And all other such terms of choice. Use _may{cl}_ or _can{cl}_
1228             depending on the context.
1229| may{cl} or may{cl} not   | Just use _may{cl}_.
1230|====
1231