diff mbox series

[16/16] standards: describe how a code block states its language

Message ID 20261201152251.2742634-17-twoerner@gmail.com
State New
Headers show
Series docs: highlight code blocks as BitBake by default | expand

Commit Message

Trevor Woerner Dec. 1, 2026, 3:22 p.m. UTC
The manuals highlight a code block as BitBake unless it says otherwise,
which is a rule a contributor can only discover by reading conf.py.
Write it down, along with the languages the other blocks use and what to
do with a block the BitBake lexer cannot read.

AI-Generated: codex/claude-opus 5.5 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 documentation/standards.md | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/documentation/standards.md b/documentation/standards.md
index 152a90923401..2614220ef0e1 100644
--- a/documentation/standards.md
+++ b/documentation/standards.md
@@ -134,6 +134,28 @@  Note that only "absolute" paths (starting with a '/') are allowed. The root
 directory of that path is documentation/, that is, :doc:`/bsp-manual/index`
 points at documentation/bsp-manual/index.rst.
 
+### Code blocks
+
+A code block is highlighted as BitBake unless it says otherwise, because
+most of the code in the manuals is BitBake metadata. A block of anything
+else states its language:
+
+    .. code-block:: console
+
+       $ bitbake core-image-minimal
+
+Use the language the block actually is, not the one it resembles. A
+session with a prompt is `console`, a script without one is `shell`, and
+a listing of paths or program output is `text`.
+
+If the BitBake lexer cannot read a valid BitBake block, show it as `text`
+and say why in a comment above it, so it can be switched back once the
+lexer is fixed:
+
+    .. Shown as text: the Pygments BitBake lexer misreads this block.
+
+    .. code-block:: text
+
 ## Adding screenshots
 
 The preferred format for adding screenshots is