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