help-model epic: the backtick parser (slice B) - #370
Merged
Conversation
xff/cli/help_parse turns authored strings into the help model, with backticks as
the only markup (per docs/design-help-model.md):
- ParseInline: `code` (single backticks) -> a kCode run, the rest kText; a
doubled backtick `` is one literal backtick; an unterminated backtick stays
literal. Nothing else is markup.
- ParseBlocks: blank lines separate Prose paragraphs (whitespace-normalized,
run through ParseInline); a ``` fence opens a verbatim Example that runs to
the closing ``` (the info string, e.g. sh, becomes Example.lang; the body
keeps its indentation).
Deliberately no #, -, or * parsing: those are xff's flag / glob / regex
characters, so they stay literal (a test locks that `*.txt [a-z] {a,b}` is one
text run, and that a fenced body keeps `*literal*` verbatim). Headings, bullets,
refs remain typed nodes the model builder supplies.
help_parse_test covers inline (code spans, doubled/unterminated backticks,
literal metacharacters) and blocks (paragraphs, blank-line breaks, wrapped-line
joining, fences with/without lang, mixed prose+fence). No live rendering wired
yet.
helly25
enabled auto-merge (squash)
August 5, 2026 21:35
helly25
disabled auto-merge
August 5, 2026 21:39
Adopt the ElementsAreArray convention (new STYLE_CPP rule): ElementsAre is
variadic so clang-format bin-packs a long matcher list unreadably, whereas
ElementsAreArray({...}) takes a braced init-list, so a trailing comma opts it
into one-matcher-per-line (the aggregate trailing-comma lever). Convert the
multi-matcher ElementsAre in help_parse_test.cc; single-element checks stay
ElementsAre.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice B of the help-model epic (#154):
xff/cli/help_parseturns authored strings into the model, with backticks as the only markup (perdocs/design-help-model.md).ParseInline:code(single backticks) -> akCoderun, the restkText; a doubled backtick is one literal backtick; an unterminated backtick stays literal.ParseBlocks: blank lines separateProseparagraphs (whitespace-normalized, run throughParseInline); a `````` fence opens a verbatimExampleto the closing fence (info string -> `Example.lang`; body indentation kept).Deliberately no
#/-/*parsing - those are xff's flag/glob/regex characters, so they stay literal (locked by tests:*.txt [a-z] {a,b}is one text run; a fenced body keeps*literal*verbatim). Headings/bullets/refs stay typed nodes the model builder supplies.Tests cover inline (spans, doubled/unterminated, literal metacharacters) and blocks (paragraphs, breaks, wrapped-line joining, fences with/without lang, mixed). No live rendering wired yet.
Next: slice C (
Render(Document, Backend)+ port roff/markdown/plain, byte-identical).