Skip to content

fix(quarto-parse-errors): point Q-2-12 'opening *' note at the delimiter (bd-1lpkx)#245

Merged
cscheid merged 1 commit into
mainfrom
bugfix/bd-1lpkx-q2-12-opening-star
May 31, 2026
Merged

fix(quarto-parse-errors): point Q-2-12 'opening *' note at the delimiter (bd-1lpkx)#245
cscheid merged 1 commit into
mainfrom
bugfix/bd-1lpkx-q2-12-opening-star

Conversation

@cscheid
Copy link
Copy Markdown
Member

@cscheid cscheid commented May 31, 2026

Summary

For an unclosed single-star emphasis, the This is the opening '*' mark. diagnostic detail underlined the word preceding the * instead of the * itself (off by len(preceding word)):

 1 │ hello world *baz
   │       ──┬──     ┬
   │         ╰──────── This is the opening '*' mark.   ← points at "world"

Root cause

A corpus-data bug, not the matcher. The error machinery records, per capture, the (lr_state, sym) of the tree-sitter token at the capture's (row, column, size) in the example, then resolves it at runtime via find_matching_token.

Q-2-12.json's simple case (content "a *") placed the emphasis-start capture at column 0 — the a text run — so the generated table recorded pandoc_str_token1 for every simple-N variant, and the runtime matcher walked back to the most recent text run (the preceding word).

Fix

Move the capture to column 1, size 2 — the " *" emphasis_delimiter token (the note already sets trimLeadingSpace/trimTrailingSpace, collapsing the span onto the *). This mirrors the already-correct stray-ending-star case.

Regenerated _autogen-table.json: all 32 Q-2-12 captures now record emphasis_delimiter (0 pandoc_str_token1). The regeneration diff is Q-2-12-only; no snapshot or case-file churn.

Scope (narrower than first assumed)

Verified end-to-end that Q-2-13 (**) and Q-2-5 (_) already point their opening notes at the delimiter in the simple case — no change needed.

Tests

Adds test_emphasis_opening_mark (drives the real pampa::readers::qmd::read path):

  • hello world *baz → opening detail at byte 12 (the *)
  • foo *bar → byte 4

Failed pre-fix at byte 6 (start of "world"); passes post-fix.

Verification

  • cargo nextest run -p pampa — 3776 passed
  • cargo nextest run --workspace — 9484 passed
  • cargo xtask verify --skip-hub-build — all steps passed
  • Regression test re-run green on this branch against current main
  • End-to-end via the binary: the caret now underlines the *

🤖 Generated with Claude Code

…ter (bd-1lpkx)

For an unclosed single-star emphasis, the "This is the opening '*' mark."
diagnostic detail underlined the word preceding the '*' instead of the '*'
itself, off by len(preceding word).

Root cause is corpus data, not the matcher. The error machinery records, per
capture, the (lr_state, sym) of the tree-sitter token at the capture's
(row, column, size) in the example, then resolves it at runtime via
find_matching_token. Q-2-12.json's "simple" case (content "a *") placed the
emphasis-start capture at column 0 — the "a" text run — so the generated table
recorded pandoc_str_token1 for every simple-N variant, and the runtime matcher
walked back to the most recent text run (the preceding word).

Fix: move the capture to column 1, size 2 — the " *" emphasis_delimiter token
(the note already sets trimLeadingSpace/trimTrailingSpace, collapsing the span
onto the '*'). This mirrors the already-correct stray-ending-star case.
Regenerated _autogen-table.json: all 32 Q-2-12 captures now record
emphasis_delimiter (0 pandoc_str_token1); the regeneration diff is Q-2-12-only.

Scope is narrower than the original triage assumed (verified end-to-end):
Q-2-13 (**) and Q-2-5 (_) already point their opening notes at the delimiter in
the simple case and need no change.

Adds test_emphasis_opening_mark regression test (drives pampa::readers::qmd::read):
'hello world *baz' -> opening detail at byte 12; 'foo *bar' -> byte 4. Failed
pre-fix at byte 6 (start of "world").

No snapshot or case-file churn. cargo nextest -p pampa (3776), --workspace
(9484), and cargo xtask verify --skip-hub-build all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cscheid cscheid merged commit 16af051 into main May 31, 2026
4 checks passed
@cscheid cscheid deleted the bugfix/bd-1lpkx-q2-12-opening-star branch May 31, 2026 12:20
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