Skip to content

fix: show a callout's title text while its marker is concealed - #593

Merged
mtskf merged 4 commits into
mainfrom
fix/callout-title-visible
Dec 4, 2026
Merged

mtskf merged 4 commits into
mainfrom
fix/callout-title-visible

Conversation

@mtskf

@mtskf mtskf commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

With the caret outside a callout, > [!WARNING] Title used to hide its whole marker row, so the title text appeared nowhere. Now only the marker part is hidden: from the first > through [!TYPE], any +/- fold suffix and the whitespace after it. The title stays on screen as the callout's title row. Untitled callouts behave as before (whole row hidden).

Changes

  • callout.ts: a new calloutConcealSpan computes {from, to, hidesLine} once from the marker grammar (matchCalloutMarker now returns where the marker ends, and calloutTypeForLine delegates to it). calloutMarkerConceal is that span plus the selection check.
  • callout-marker-conceal.ts: records come from calloutConcealSpan. One Decoration.replace covers exactly the span, and the exclusion zone is that same span. The zero-height line class is added only when the whole row is hidden (hidesLine).
  • block-style.ts: the line-skip check is now lineInExclusionZone (new in shared.ts), so a row is skipped only when a zone covers it whole. The -open corner migrates only when the marker row is hidden, so a titled row keeps its corner, outer gap and quoll-callout-marker header class.
  • theme.ts: comments only.
  • Folding is unchanged. Marker-only callouts still never conceal.
  • Note on the TODO wording: its Done-when says the hidden range starts at "marker 行の行頭". For a titled row this PR starts at the first > instead, and the 0-3 spaces of indent before it stay visible. Body rows keep that indent too (blockquote-reveal hides only the >), so this keeps the title aligned with the body. The untitled whole-row case still starts at the line start. Any whitespace the marker grammar accepts (including a no-break space) counts as "no title".

Related

  • TODO: REV-20261203-15 — a > [!WARNING] タイトル title shows nowhere while the caret is outside the callout

Test Plan

  • Unit (happy-dom), cm-decoration-callout-marker-conceal.test.ts:
    • The predicate returns span = [first >, title start) for > [!WARNING] タイトル, >[!NOTE] Title, > [!NOTE] Title, a tab-separated marker, [!WARNING]+ heads up, [!WARNING]- heads up, **title** and a no-break-space-separated title.
    • Whitespace-only tails (including a lone no-break space) and an indented untitled marker still hide the whole line, and a caret inside reveals the source.
    • Field: a single replace with no hidden line class, and the exclusion zone equals the replace range (all spellings).
    • The **title** full-stack mount does not throw, and the DOM row shows title without [!TIP].
    • The equivalence check (incremental update vs fresh full build) covers:
      • typing a title onto an untitled marker and deleting a title — >-line edits, so these take the structural full-rebuild arm;
      • an edit above an indented titled callout, which asserts it is non-structural and so takes the bounded rigid-shift arm. A mutation of that shift goes red.
  • Unit, cm-decoration-block-style.test.ts: a titled row keeps -open / -outer-open / quoll-callout-marker, and the body row does not take the corner. A whole-line zone skips the row, a partial zone does not. This replaces the old "line-start-in-zone" pin, which encoded the behaviour this PR changes on purpose.
  • Real Chromium, new test/webview-browser/callout-title-row.browser.test.ts:
    • Cases: plain title, +, - and bold title.
    • Each checks that the title row is visible with no [! or **, has rounded top corners and top padding, and that the body row is not top-rounded.
    • Caret into the body and back out restores identical geometry.
    • Indented case > [!NOTE] Title: the title and the body text share the same left x.
    • Contrast case: an untitled marker row stays at zero height and the body takes the corner.
  • Revert-check, run in throwaway worktrees:
    • Against unmodified main source, 4/5 browser tests and 14 unit tests went red (the untitled contrast case stays green on purpose).
    • The review-fix cases (indent alignment, no-break space) went red on the first commit, c0e2848.
    • All are green at head.
  • pnpm compile, pnpm lint and the full vitest suite (parallel-checks) pass.
  • E2E not run: this is a webview-only decoration change, with no host, message-protocol or E2E-covered path touched.

@mtskf
mtskf merged commit 6b415ae into main Dec 4, 2026
2 checks passed
@mtskf
mtskf deleted the fix/callout-title-visible branch December 4, 2026 04:51
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