Skip to contentSkip to conversation

docs: document the conventions used in the manuals

PATCH Superseded Trevor Woerner 2 participants 3 messages Sep 22

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs: document the conventions used in the manuals

The manuals use angle brackets for placeholders and a prompt to mark a command, and say so nowhere. A reader can only infer both, and one example reads as advice to paste a line that will not parse.

Add a page stating them, in the sidebar beside the other top-level entries, so it is reachable from every manual.

AI-Generated: codex/claude-opus 5 (xhigh)

---
Changes in v2:
- The page is a document in its own right, reached from a toctree in documentation/index.rst, rather than included into each manual's index. This is Antonin's suggestion and it is the better shape: the page appears in the sidebar of every manual, so a reader meets it wherever they are, and the diff touches two files rather than fifteen.
- Retitled "Documentation Conventions", which is short enough for the sidebar and matches "Documentation Downloads" beside it. The old title said "this document", which no longer describes a standalone page.
- The example showing that a leading "#" is a comment is tagged text rather than console. Pygments' console lexer reads a leading "#" as a root prompt and lexes the rest of the line as bash, so v1 rendered that line as a prompt running a command, with the word "command" coloured as a shell builtin - the opposite of what the sentence above it says.
- Added an opening sentence saying the conventions apply throughout the documentation, since the page is now landed on directly rather than read at the end of a manual.

The wording of both sections is unchanged.

 documentation/conventions.rst | 55 +++++++++++++++++++++++++++++++++++
 documentation/index.rst       |  7 +++++
 2 files changed, 62 insertions(+)
 create mode 100644 documentation/conventions.rst
documentation/conventions.rst new file +55 -0
new file mode 100644
index 000000000000..469ad5879b51
@@ -0,0 +1,55 @@
+.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
+
+=========================
+Documentation Conventions
+=========================
+
+These conventions apply throughout the Yocto Project documentation.
+
+Placeholders
+============
+
+Text enclosed in angle brackets is a placeholder. Replace it, including the
+brackets, with a value of your own:
+
+.. code-block:: none
+
+   SRCREV:pn-<recipe> = "${AUTOREV}"
+
+Here, ``<recipe>`` stands for the name of your recipe. A placeholder is
+never text to be copied as it stands, and an example containing one will
+not work until every placeholder in it has been replaced.
+
+Commands and prompts
+====================
+
+Commands are shown with the prompt that runs them, and the prompt is not
+part of the command. Do not type it.
+
+A ``$`` introduces a command you run as your normal user:
+
+.. code-block:: console
+
+   $ bitbake core-image-minimal
+
+Where a command needs administrative privileges on your build host, it is
+shown with ``sudo`` rather than with a root prompt:
+
+.. code-block:: console
+
+   $ sudo apt install gawk
+
+A full prompt ending in ``#`` introduces a command run as ``root``, usually
+on a target machine rather than on your build host:
+
+.. code-block:: console
+
+   root@qemux86-64:~# gdb /bin/cat
+
+Within an example, a line beginning with ``#`` is a comment rather than a
+command:
+
+.. code-block:: text
+
+   # This is a comment, not a command to run as root.
+   $ bitbake core-image-minimal
documentation/index.rst +7 -0
index 4bfc40bef070..72e51a4454d7 100644
@@ -116,3 +116,10 @@ Release notes and migration guides for the different Yocto Project releases.
    :hidden:
 
    downloads
+
+.. toctree::
+   :maxdepth: 1
+   :caption: Documentation Conventions
+   :hidden:
+
+   conventions
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
#1 lore raw
Quoted 66 lines · Trevor Woerner via lists.yoctoproject.org

The manuals use angle brackets for placeholders and a prompt to mark a command, and say so nowhere. A reader can only infer both, and one example reads as advice to paste a line that will not parse.

Add a page stating them, in the sidebar beside the other top-level entries, so it is reachable from every manual.

AI-Generated: codex/claude-opus 5 (xhigh)

---
Changes in v2:
- The page is a document in its own right, reached from a toctree in documentation/index.rst, rather than included into each manual's index. This is Antonin's suggestion and it is the better shape: the page appears in the sidebar of every manual, so a reader meets it wherever they are, and the diff touches two files rather than fifteen.
- Retitled "Documentation Conventions", which is short enough for the sidebar and matches "Documentation Downloads" beside it. The old title said "this document", which no longer describes a standalone page.
- The example showing that a leading "#" is a comment is tagged text rather than console. Pygments' console lexer reads a leading "#" as a root prompt and lexes the rest of the line as bash, so v1 rendered that line as a prompt running a command, with the word "command" coloured as a shell builtin - the opposite of what the sentence above it says.
- Added an opening sentence saying the conventions apply throughout the documentation, since the page is now landed on directly rather than read at the end of a manual.

The wording of both sections is unchanged.

 documentation/conventions.rst | 55 +++++++++++++++++++++++++++++++++++
 documentation/index.rst       |  7 +++++
 2 files changed, 62 insertions(+)
 create mode 100644 documentation/conventions.rst
documentation/conventions.rst new file +25 -0
new file mode 100644
index 000000000000..469ad5879b51
@@ -0,0 +1,55 @@
+.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
+
+=========================
+Documentation Conventions
+=========================
+
+These conventions apply throughout the Yocto Project documentation.
+
+Placeholders
+============
+
+Text enclosed in angle brackets is a placeholder. Replace it, including the
+brackets, with a value of your own:
+
+.. code-block:: none
+
+   SRCREV:pn-<recipe> = "${AUTOREV}"
+
+Here, ``<recipe>`` stands for the name of your recipe. A placeholder is
+never text to be copied as it stands, and an example containing one will
+not work until every placeholder in it has been replaced.
+
+Commands and prompts
+====================
+

documentation/conventions.rst line 35

Quoted 10 lines
documentation/conventions.rst new file +10 -0
+Commands are shown with the prompt that runs them, and the prompt is not
+part of the command. Do not type it.
+
+A ``$`` introduces a command you run as your normal user:
+
+.. code-block:: console
+
+   $ bitbake core-image-minimal
+
+Where a command needs administrative privileges on your build host, it is

s/build host/:term:build host/

documentation/conventions.rst line 43

Quoted 8 lines
documentation/conventions.rst new file +8 -0
+shown with ``sudo`` rather than with a root prompt:
+
+.. code-block:: console
+
+   $ sudo apt install gawk
+
+A full prompt ending in ``#`` introduces a command run as ``root``, usually
+on a target machine rather than on your build host:

s/build host/:term:build host/

documentation/conventions.rst line 47

Quoted 3 lines
documentation/conventions.rst new file +3 -0
+.. code-block:: console
+
+   root@qemux86-64:~# gdb /bin/cat

How about "root@machine:~# " instead? I would rather have a generic machine to use throughout the documentation than a real example. Unless the context in which the documentation is written makes sense for a specific machine, of course. But we should at least have a default name for generic target command examples.

documentation/conventions.rst line 52

Quoted 5 lines
documentation/conventions.rst new file +5 -0
+
+Within an example, a line beginning with ``#`` is a comment rather than a
+command:
+
+.. code-block:: text

Sadly the "console" lexer does not interpret lines starting with "# " as comments. Would it make sense to use the "shell" lexer instead, in these cases where commands and comments are mixed?

Antonin

#2 lore raw
Quoted 80 lines · Antonin Godard
Quoted 66 lines · Trevor Woerner via lists.yoctoproject.org

The manuals use angle brackets for placeholders and a prompt to mark a command, and say so nowhere. A reader can only infer both, and one example reads as advice to paste a line that will not parse.

Add a page stating them, in the sidebar beside the other top-level entries, so it is reachable from every manual.

AI-Generated: codex/claude-opus 5 (xhigh)

---
Changes in v2:
- The page is a document in its own right, reached from a toctree in documentation/index.rst, rather than included into each manual's index. This is Antonin's suggestion and it is the better shape: the page appears in the sidebar of every manual, so a reader meets it wherever they are, and the diff touches two files rather than fifteen.
- Retitled "Documentation Conventions", which is short enough for the sidebar and matches "Documentation Downloads" beside it. The old title said "this document", which no longer describes a standalone page.
- The example showing that a leading "#" is a comment is tagged text rather than console. Pygments' console lexer reads a leading "#" as a root prompt and lexes the rest of the line as bash, so v1 rendered that line as a prompt running a command, with the word "command" coloured as a shell builtin - the opposite of what the sentence above it says.
- Added an opening sentence saying the conventions apply throughout the documentation, since the page is now landed on directly rather than read at the end of a manual.

The wording of both sections is unchanged.

 documentation/conventions.rst | 55 +++++++++++++++++++++++++++++++++++
 documentation/index.rst       |  7 +++++
 2 files changed, 62 insertions(+)
 create mode 100644 documentation/conventions.rst
documentation/conventions.rst new file +25 -0
new file mode 100644
index 000000000000..469ad5879b51
@@ -0,0 +1,55 @@
+.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
+
+=========================
+Documentation Conventions
+=========================
+
+These conventions apply throughout the Yocto Project documentation.
+
+Placeholders
+============
+
+Text enclosed in angle brackets is a placeholder. Replace it, including the
+brackets, with a value of your own:
+
+.. code-block:: none
+
+   SRCREV:pn-<recipe> = "${AUTOREV}"
+
+Here, ``<recipe>`` stands for the name of your recipe. A placeholder is
+never text to be copied as it stands, and an example containing one will
+not work until every placeholder in it has been replaced.
+
+Commands and prompts
+====================
+

documentation/conventions.rst line 35

Quoted 10 lines
documentation/conventions.rst new file +10 -0
+Commands are shown with the prompt that runs them, and the prompt is not
+part of the command. Do not type it.
+
+A ``$`` introduces a command you run as your normal user:
+
+.. code-block:: console
+
+   $ bitbake core-image-minimal
+
+Where a command needs administrative privileges on your build host, it is

s/build host/:term:build host/

Quoted 10 lines

documentation/conventions.rst line 43

Quoted 8 lines
documentation/conventions.rst new file +8 -0
+shown with ``sudo`` rather than with a root prompt:
+
+.. code-block:: console
+
+   $ sudo apt install gawk
+
+A full prompt ending in ``#`` introduces a command run as ``root``, usually
+on a target machine rather than on your build host:

s/build host/:term:build host/

Agreed on both above.

Quoted 9 lines

documentation/conventions.rst line 47

Quoted 3 lines
documentation/conventions.rst new file +3 -0
+.. code-block:: console
+
+   root@qemux86-64:~# gdb /bin/cat

How about "root@machine:~# " instead? I would rather have a generic machine to use throughout the documentation than a real example. Unless the context in which the documentation is written makes sense for a specific machine, of course. But we should at least have a default name for generic target command examples.

Agreed; this should be the default.

Quoted 8 lines

documentation/conventions.rst line 52

Quoted 4 lines
documentation/conventions.rst new file +4 -0
+Within an example, a line beginning with ``#`` is a comment rather than a
+command:
+
+.. code-block:: text

Sadly the "console" lexer does not interpret lines starting with "# " as comments. Would it make sense to use the "shell" lexer instead, in these cases where commands and comments are mixed?

*shell* loses the "$" prompt, *console* loses the comment; therefore *text* is the least wrong... for now. I have a set of lexer patches and a set of re-tagging patches (neither yet sent) that together fix this. *text* is not the final answer: it is the right one until those land, and the best one if they never do.

NOTE: this conventions (v2) page only becomes completely true once the other patchset (docs-fixes)[1] lands. I was expecting [1] to be considered first, then conventions-v2.

conventions-v3 is on its way with the above fixes.

Quoted 1 line

Antonin

[1]: https://lore.kernel.org/r/[email protected]