render-config-table.sh's block_flat wraps a `code` block's content in one backtick span, unescaped
Id: TD-PPagop-26080702 · Status: resolved · Filed: 2026-08-07 · Resolved: 2026-08-09 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/276
scripts/render-config-table.sh’s block_flat (added for #220, the
x-docs.readme/x-docs.spec block-note format) flattens a {"code": ...}
note block into a table cell as "`" + (.code | gsub("\n"; " ")) + "`"
— the code text wrapped in one plain backtick pair, its newlines turned to
spaces. If .code itself contains a backtick, the resulting cell carries an
unbalanced or nested code span (`echo `foo` bar`), which either breaks
the cell’s own Markdown or bleeds into the next column.
No key in this repository’s config.schema.json currently uses a code
block whose content contains a backtick, so nothing is visibly broken today
— test/render-config-table.test.sh’s sigma fixture (the only code
block test) deliberately avoids one. This is a latent gap, not an active
bug.
Fix: back off to the widest run of consecutive backticks in .code, plus
one, as the span’s own delimiter (the same rule CommonMark itself uses for
nesting a code span inside a code span) — e.g.
(.code | [match("`+"; "g").string | length] | max // 0) picks the run
length, then wrap with that many backticks plus one, padding a leading and
trailing space if the code itself starts or ends with a backtick (also a
CommonMark code-span requirement). Add a fixture code block containing a
backtick to test/render-config-table.test.sh alongside the fix, so the
case stops being untested once it stops being unhandled.