Skip to content

Record the CommonMark code-span backtick-delimiter gotcha - #1106

Merged
d-morrison merged 1 commit into
mainfrom
ums/code-span-backtick-delimiter
Aug 3, 2026
Merged

Record the CommonMark code-span backtick-delimiter gotcha#1106
d-morrison merged 1 commit into
mainfrom
ums/code-span-backtick-delimiter

Conversation

@dem-ucdh

@dem-ucdh dem-ucdh commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Post-merge UMS top-up from ai-config#1104's own review lifecycle: recording the accepted round-2 finding as a reusable authoring lesson (it is not one of #1104's four recorded lessons — it surfaced from #1104's review).

The lesson

A literal backtick inside a Markdown inline code span needs a longer delimiter, not a backslash. Per CommonMark's code-span rule, backslash escapes are not processed inside code spans and delimiter matching is purely lexical, so a single-backtick span wrapping backtick-bearing text closes at the first inner backtick and renders as garbled fragments.

Why it earns an entry rather than being a one-off (per learn-from-review-findings):

  • It is a recurring authoring trap with a definite rule (widen the delimiter), not a typo.
  • No content check catches it — it is well-formed Markdown, so markdownlint, the semantic-line-break check, and validate all passed on Record four lessons from ai-config#1042's review lifecycle #1104; only the reviewer (or a rendered-blob fetch) saw the garble. That is the same blind spot as the MD010-in-fences gotcha the new section sits beside.

Change

One new ## section in memories/tools.md, beside the existing markdownlint gotchas. Hand-written prose, +39 lines, no generated trees. The entry's own example code spans were checked to render correctly (the double-backtick span at the case record wraps a single-backtick-bearing string with no adjacent-backtick run inside it).

Verification

  • Branched off origin/main; push verified against git ls-remote (matches HEAD, 1 commit ahead).
  • Banned-punctuation scan over origin/main...HEAD: 0 non-ASCII on added lines.
  • Multi-sentence-line scan over the 39 added lines: 0 flagged.

🤖 Generated with Claude Code

https://claude.ai/code/session_015icfsSybE9vMSt8cUrXB6X


Generated by Claude Code

A literal backtick inside a Markdown code span needs a longer delimiter, not
a backslash: CommonMark does not process backslash escapes inside code spans,
and delimiter matching is purely lexical, so a single-backtick span wrapping
backtick-bearing text closes early and garbles. No content check catches it
(well-formed Markdown), so it is in the same blind spot as the MD010-in-fences
gotcha already recorded nearby.

Surfaced as the accepted round-2 review finding on ai-config#1104 (the example
about a backtick pitfall hit a different backtick pitfall). New section in
memories/tools.md beside the markdownlint gotchas.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015icfsSybE9vMSt8cUrXB6X
Copilot AI review requested due to automatic review settings August 3, 2026 22:16
@github-actions
github-actions Bot removed the request for review from Copilot August 3, 2026 22:16
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished reviewView run


Code Review Summary — #1106

PR: "Record the CommonMark code-span backtick-delimiter gotcha" — a single-file addition to memories/tools.md (+39/-0), documenting a Markdown authoring lesson learned during PR #1104's review.

Verification performed

  • Gating check: PR is open, not draft, not previously commented on by claude — proceeded with review.
  • Content correctness: Fetched the CommonMark spec (spec.commonmark.org/0.31.2/#code-spans) and confirmed the entry's core technical claims are accurate — backslash escapes are not processed inside code spans, and a code span closes at the first backtick-run of equal length to its opening delimiter.
  • Worked example: Manually parsed the byte sequence of the new entry's own demonstration code span ( git commit -m "fix the \slast` guard"` ) against CommonMark's delimiter-matching rule. It resolves correctly — the double-backtick delimiter correctly encloses the single-backtick content with no premature closing, exactly as the entry claims.
  • Citation verification (anti-hallucination):
  • Format/style checks: No banned non-ASCII punctuation (em-dash, curly quotes, etc.) in added lines; no obvious multi-sentence-per-line violations found on manual scan — consistent with the PR body's own self-reported scan results.
  • Duplication check: Confirmed this is not a duplicate of the related memories/git.md entry (shell command-substitution backtick gotcha, a different mechanism) or the existing MD010-in-fences entry it sits beside.
  • Structure: Follows the corpus's established Do/Don't pattern and case-record convention used throughout memories/tools.md.

No bugs, no CLAUDE.md/lab-manual violations, and no hallucinated content found. This is a pure-prose documentation change with no code/logic to assess for correctness bugs.

Note: subagent dispatch for this review failed twice with a context-length error (system prompt ~209k tokens > 200k limit) before any task-specific work began — an environment-level constraint, not specific to this PR. Given the PR's small, single-file, prose-only scope, I completed the verification directly instead of retrying subagents.

No --comment argument was provided, so no GitHub comments were posted.

Verdict

Ready for merge.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

💰 Cost: $5.2436 (review) — run

@d-morrison
d-morrison merged commit c59d03a into main Aug 3, 2026
9 checks passed
@d-morrison
d-morrison deleted the ums/code-span-backtick-delimiter branch August 3, 2026 22:23
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.

3 participants