Skip to content

help-model epic: the backtick parser (slice B) - #370

Merged
helly25 merged 2 commits into
mainfrom
feat/help-parse
Aug 5, 2026
Merged

help-model epic: the backtick parser (slice B)#370
helly25 merged 2 commits into
mainfrom
feat/help-parse

Conversation

@helly25

@helly25 helly25 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Slice B of the help-model epic (#154): xff/cli/help_parse turns authored strings into the 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.
  • ParseBlocks: blank lines separate Prose paragraphs (whitespace-normalized, run through ParseInline); a `````` fence opens a verbatim Example to 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).

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
helly25 enabled auto-merge (squash) August 5, 2026 21:35
@helly25
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.
@helly25
helly25 enabled auto-merge (squash) August 5, 2026 21:44
@helly25
helly25 merged commit 9547a86 into main Aug 5, 2026
9 checks passed
@helly25
helly25 deleted the feat/help-parse branch August 5, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant