Skip to content

Conversation

@maximilianfalco
Copy link
Contributor

PR App Fix CX-2520

🧰 Changes

Adds a format option to calloutTransformer in both mdx and mdxish to control empty blockquote handling:

  • when format === 'md', empty blockquotes are replaced with paragraphs containing the stringified content ('>')
  • when format === 'mdx' (or undefined) they remain as blockquotes to allow rendering as empty callouts.

This fixes errors when processing standalone '>' in MD format and preserves empty callout rendering in MDX. Includes tests for both formats in the transformer, MDX serialization, and mdxish processing pipelines.

The main reason the logic is split between these formats is because the excerpt component in the page headers uses the MD format while the body uses the MDX format. This done to allow cases like this:

Screenshot 2025-12-12 at 17 47 52

🧬 QA & Testing

@maximilianfalco maximilianfalco marked this pull request as draft January 15, 2026 04:30
visit(tree, 'blockquote', (node: Blockquote) => {
if (!(node.children[0].type === 'paragraph' && node.children[0].children[0].type === 'text')) return;
visit(tree, 'blockquote', (node: Blockquote, index: number | undefined, parent: Parent | undefined) => {
if (!isCalloutStructure(node)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this check and the code inside it to its own function, on top of this file? I think it would improve readability


// For 'mdx' format (or undefined): leave empty blockquotes as-is (can be rendered as empty callout)
// For 'md' format: always replace non-callout blockquotes with stringified content
if (format !== 'md' && isEmpty) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not md but it's not empty, do we still want to stringify the content?

@eaglethrost
Copy link
Contributor

I think it would be good to add a test to render the Callout and make sure it doesn't break the UI

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.

2 participants