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