Repository navigation
test(renderer): Canvas Candy callout-zone conformance (#16, slice 3) - #82
Merged
Merged
Conversation
Nothing tested `parseCallouts`, the code that turns `>[!cc-header]`-style
markers into layout zones and strips them from the card body. A regression
that left raw markers visible in a card would have shipped silently.
Adds src/renderer/extensions/__tests__/callouts.test.ts (59 tests):
- the eight demo-card texts from Canvas Candy's "Headers and Labels.canvas"
vault, verbatim (header / footer / label-left / label-right, each with and
without -noborder). Each card holds the live marker on one line and the
same syntax repeated inside a fenced code block as a copy-paste example.
Asserted per card: exactly one zone extracted, correct zone/text/noBorder,
the live marker is gone from the body, and the fenced example is left
verbatim (it is documentation, not a marker)
- hasCallouts prefilter: with/without space after ">", plain text, standard
Obsidian callouts (non cc-), and its deliberate looseness on fenced text
- parseCallouts: zero-overhead path, continuation lines, centred callout,
inline markdown kept in zone text, empty title, unknown cc- type left in
the body, ordinary blockquotes untouched, non-callout formatting preserved
exactly
- combinations: header+footer, left+right labels, label+header+footer
(supported since #64)
- the four zone getters, present and absent
Verified the tests can fail: with markers left in the body 21 tests fail, and
with -noborder ignored 4 fail; source restored afterwards.
Slice 3 was parked as ESM-blocked. That was wrong: callouts.ts imports only
unified / remark-parse / remark-gfm, all CommonJS, so it runs under the
existing ts-jest config with no mocking. The ESM problem is specific to
hast-util-from-html in the parseToSegments chain.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
LeslieOA
force-pushed
the
test/callouts-conformance
branch
from
October 4, 2026 20:09
66d757d to
0d119c5
Compare
LeslieOA
added a commit
that referenced
this pull request
Oct 4, 2026
Review of #32 before landing. The catalogue had upstream's class list right but misfiled eleven of the classes: - cc-header, cc-footer, cc-label-left and cc-label-right, with their -noborder variants, were listed as a CSS-class mechanism we skip. They are callouts (>[!cc-header]), which callouts.ts has supported all along, -noborder included. - cc-image-cover and cc-image-clip were listed as cssclasses, with a card-outline clip as the effect. They are callouts that lay an image over the card; "clip" is an invalid object-fit value, so it stretches. They are a real gap: the raw marker shows in the card today. - cc-shape-parallelogram was listed as a missing alias. Upstream's CSS defines only -left and -right, both of which we support. It also adds the sticker convention (file names containing -cc-image), which upstream's list leaves out, and drops the references to #29, which was closed; the conformance tests landed as #67, #68 and #82. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LeslieOA
added a commit
that referenced
this pull request
Oct 4, 2026
Review of #31 before landing. The plan dates from May: - It counted "168 tests" added by #29 as the contract. #29 was closed; the conformance tests landed as #67, #68 and #82, and only the src/core suites test code the port would replace. - It predates src/gtk. The GTK renderer stays TypeScript too, and would load the wasm build, as the README paragraph already says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nothing tested
parseCallouts— the code that turns>[!cc-header]-style markers into layout zones and strips them from the card body. This adds 59 tests for it, so a regression that left rawcc-markers visible in a card fails CI instead of shipping.What is asserted
The eight demo-card texts from Canvas Candy's Headers and Labels.canvas vault, verbatim (header / footer / label-left / label-right, each with and without
-noborder). Each card holds the live marker on one line and the same syntax repeated inside a fenced code block as a copy-paste example. Per card:noBorderare correctPlus the
hasCalloutsprefilter,parseCalloutsedge cases (continuation lines, centred callout, unknowncc-type stays in the body, ordinary blockquotes untouched, formatting preserved exactly), combinations (header+footer, left+right, label+header+footer), and the four zone getters.The tests can fail
Mutation-checked before committing, source restored afterwards:
-noborderignoredCorrection to earlier scoping
Slice 3 of #16 was parked as ESM-blocked. That was wrong:
callouts.tsimports onlyunified/remark-parse/remark-gfm, all CommonJS, so it runs under the existing ts-jest config with no mocking. The ESM problem is specific tohast-util-from-htmlin theparseToSegmentschain.Test plan
Part of #16.
🤖 Generated with Claude Code