feat(mdxish): always compile callouts to JSX in mdxishMdastToMd#1498
Draft
eaglethrost wants to merge 1 commit into
Draft
feat(mdxish): always compile callouts to JSX in mdxishMdastToMd#1498eaglethrost wants to merge 1 commit into
eaglethrost wants to merge 1 commit into
Conversation
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.
🎯 What does this PR do?
Updates the mdxish callout serializer (
mdxishMdastToMd) to always compile callouts to<Callout>JSX syntax instead of the legacy MD blockquote format.PR #17745 adds icon + color selection for callouts in the MdxishEditor UI, but the engine always serialized callouts to the legacy blockquote (
> 📘 Hey), which dropped any custom icon/theme on round-trip. This PR persists those selections.processor/transform/mdxish/callout-to-jsx.ts— a transform that converts everyrdme-calloutmdast node into anmdxJsxFlowElement(<Callout icon=… theme=…>), reusingtoAttributesand themdxJsxStringifyextension already wired intomdxishMdastToMd.mdxishMdastToMd(alongsidemdxishTablesToJsx). The RMDX (mdx) pipeline and the sharedprocessor/compile/callout.tsblockquote compiler are untouched, so RMDX behavior is unchanged.🧪 QA tips
transformCalloutinmdxish-jsx-to-mdast.ts: a body-only (empty) callout drops its placeholder title paragraph so re-parsing re-derivesemptyfrom the absence of a leading heading (no fragileemptyattribute needed).readme-to-mdx(icon→theme viathemes,theme→icon viadefaultIcons) so both attributes always persist.> 🚧 It works!→<Callout icon="🚧" theme="warn">### It works!…</Callout>, body-only callouts re-deriveempty: true, and authored JSX callouts round-trip unchanged in shape.📸 Screenshot or Loom
N/A — engine-side serialization change, covered by unit tests.