Expand description
Associate .dtx documentation prose with the macro/environment it documents.
A .dtx brackets each documented entity with ltxdoc vocabulary — a macro or
environment environment, or a \DescribeMacro/\DescribeEnv command — while
the implementation lives in a (usually nested) macrocode block. The parser
keeps these apart on purpose: a documentation margin is DOC_MARGIN trivia that
never binds into a DOC_COMMENT (AGENTS.md decision #9 forbids a signature
lookup in the trivia-binding decision). Connecting prose to code is therefore a
semantic-layer job — this query.
It mirrors outline: a single CST walk producing LSP-agnostic
DocAssociations (byte ranges, no lsp_types), unit-testable without the
language server. The ltxdoc set is static and standard, so — like the sectioning
commands and \label in outline — the constructs are
recognized by name rather than through a per-document signature scan.
The implementation a documented macro brackets is found structurally: the code
is the macrocode/macrocode* block(s) nested inside the documenting
environment, the conventional .dtx idiom. Descent stops at a nested macro/
environment so its macrocode is attributed to it, not the outer construct.
\DescribeMacro/\DescribeEnv carry no nested code (the definition lives
elsewhere; file-wide def-site linking is a deferred follow-up).
Structs§
- DocAssociation
- One documented entity: the documenting construct, the name it documents, and any code it brackets.
Enums§
- DocKind
- Which ltxdoc construct introduced the association.
Functions§
- doc_
associations - Collect every documentation↔code association in
root, in document order.