Skip to content

fix: restore native foldable callouts - #43

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/foldable-callouts
Nov 19, 2026
Merged

tannerlinsley merged 1 commit into
mainfrom
taren/foldable-callouts

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Restore foldable callouts lost during the website Markdown migration. > [!TIP]- Title starts closed and > [!TIP]+ Title starts open, using native <details> and <summary> in HTML, React, and Octane.

Add optional CalloutNode.open state and regression coverage for both markers, default titles, escaped titles, formatted content, and ordinary callouts. Include a patch changeset.

Parser and renderer cleanup offsets the added feature. Existing bundle size limits stay in place.

Related to TanStack/tanstack.com#1140. The website will need a dependency update after this package is released.

Validation passed with all 354 tests, TypeScript checking, and a TypeScript build. An additional 441 AST and HTML comparisons against the original source matched.

Bundle sizes below are bytes before → after, measured against 2fe9333 using esbuild minification with browser ESM output targeting ES2022, gzip level 9, and Brotli. Framework runtimes are external. Every measured entry stays at or below its original size in all three formats.

Entry Minified Gzip Brotli
parser only 12,649 → 12,335 5,220 → 5,183 4,809 → 4,772
html renderer no highlighter 17,840 → 17,555 7,050 → 7,045 6,485 → 6,451
html renderer with external highlighter stub 17,876 → 17,591 7,070 → 7,067 6,477 → 6,475
react adapter 17,848 → 17,580 7,001 → 6,999 6,433 → 6,418
octane adapter 17,785 → 17,517 6,967 → 6,965 6,407 → 6,396
docs extension preset 6,285 → 6,144 2,273 → 2,271 2,059 → 2,051
callouts extension 506 → 438 335 → 329 278 → 274
streaming extension 699 → 699 311 → 311 253 → 253
react adapter with streaming extension 18,540 → 18,272 7,186 → 7,182 6,623 → 6,579
tabs transforms 3,152 → 3,102 1,206 → 1,198 1,076 → 1,060
. 18,105 → 17,784 7,177 → 7,161 6,596 → 6,577
./html 18,065 → 17,745 7,164 → 7,151 6,582 → 6,569
./html/streaming 19,605 → 19,320 7,693 → 7,684 7,048 → 7,033
./parser 12,782 → 12,468 5,307 → 5,269 4,886 → 4,854
./react 18,048 → 17,780 7,111 → 7,106 6,533 → 6,513
./octane 17,988 → 17,720 7,076 → 7,074 6,508 → 6,491
./extensions/callouts 660 → 592 432 → 425 360 → 356
./extensions/comment-components 1,073 → 1,073 647 → 647 542 → 542
./extensions/docs 6,449 → 6,308 2,373 → 2,369 2,138 → 2,137
./extensions/framework 1,422 → 1,422 706 → 706 607 → 607
./extensions/headings 1,038 → 1,038 573 → 573 480 → 480
./extensions/streaming 838 → 838 403 → 403 334 → 334
./extensions/tabs 3,399 → 3,349 1,324 → 1,317 1,183 → 1,173
./extensions/autolinks 963 → 963 630 → 630 564 → 564

Summary by CodeRabbit

  • New Features
    • Callouts can now use + to start expanded or - to start collapsed, with native disclosure controls in HTML, React, and Octane output. Callouts without either marker retain their existing static appearance.
  • Bug Fixes
    • Improved Markdown parsing for headings, HTML blocks, lists, tables, and nested content to handle a broader range of formatting consistently.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 867d5da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/markdown Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Callout markers now support closed and open initial states across HTML, React, and Octane. The parser also updates several Markdown recognition rules and nested parsing. Heading collection options and bundler tab construction have changed.

Changes: Foldable Callouts

Layer / File(s) Summary
Callout state and marker parsing
src/types.ts, src/extensions/callouts.ts
CalloutNode adds optional open state. Callout parsing reads + and - markers and sets the title and state.
Disclosure rendering across outputs
src/html.ts, src/react.ts, src/octane.ts, tests/docs-extensions.test.ts, .changeset/foldable-callouts.md
The three renderers use disclosure elements when callout state is present. Tests cover default, closed, and open callouts across all three renderers. The changeset documents the marker syntax.

Markdown Parser Updates

Layer / File(s) Summary
Definition extraction and nested parsing
src/parser.ts
Definition and frontmatter handling changed. Extension blocks, blockquotes, and list items use nested parsers that share the parent depth budget.
Markdown syntax recognition
src/parser.ts
Fence, heading, HTML block, list marker, and table delimiter recognition rules changed.

Heading Collection Options

Layer / File(s) Summary
Heading collection option handling
src/extensions/docs.ts
The extension builder returns its initial extensions when heading collection is disabled. For non-object options, it passes undefined to heading collection.

Bundler Tabs

Layer / File(s) Summary
Bundler tab and panel construction
src/extensions/tabs.ts
The transformer builds tabs and panels for matching vite and rsbuild sections in fixed order. It returns the original node when neither section matches.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Markdown
  participant parseCalloutBlock
  participant CalloutNode
  participant HTMLRenderer
  participant ReactRenderer
  participant OctaneRenderer
  Markdown->>parseCalloutBlock: Parse callout marker and title
  parseCalloutBlock->>CalloutNode: Set kind, title, and optional open state
  CalloutNode->>HTMLRenderer: Render callout
  CalloutNode->>ReactRenderer: Render callout
  CalloutNode->>OctaneRenderer: Render callout
Loading

Suggested reviewers: ladybluenotes

Merge Risk: Minimal · up to 867d5

This change restores foldable callouts using native details and summary elements, with regression tests for both markers across HTML, React, and Octane. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: restore native foldable callouts" matches the main change. The changeset adds native HTML disclosure for foldable callouts (- starts closed, + starts open) in HTML, React, and Octa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: restore native foldable callouts" matches the main change. The changeset adds native HTML disclosure for foldable callouts (- starts closed, + starts open) in HTML, React, and Octane renderers, and the parser, types, and tests support this. The title is short, specific, and uses a conventional commit prefix. It does not cover the parser and renderer cleanup, but that is expected.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf377da6-1942-4d55-89c1-95c6e47507d5
Commits

Reviewing files that changed from the base of the PR and between 2fe9333 and 867d5da.

Files selected for processing: 10

  • .changeset/foldable-callouts.md
  • src/extensions/callouts.ts
  • src/extensions/docs.ts
  • src/extensions/tabs.ts
  • src/html.ts
  • src/octane.ts
  • src/parser.ts
  • src/react.ts
  • src/types.ts
  • tests/docs-extensions.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@tannerlinsley
tannerlinsley merged commit 5748154 into main Nov 19, 2026
15 checks passed
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