Repository navigation
feat(blog): render posts with framed MDX figures - #104
Merged
Merged
Conversation
Port mdxcn's figure set into components/mdx and render blog posts
through withMdxcn, so a post can draw a comparison, table, diff,
terminal, steps block, callout, quote or footnotes in the site's own
dashed-frame language instead of an embedded widget library.
Plain Markdown is upgraded as well: a GitHub alert blockquote becomes a
callout, a quote ending in a byline becomes a framed quote, a console
fence becomes a terminal, and the footnotes section gets a frame. Posts
without those constructs render exactly as before.
Two React Server Components constraints are handled here. next-mdx-remote
deletes every `prop={...}` attribute in RSC mode, so figures take their
data as children; and a client component's children arrive with their
`type` wrapped in React.lazy, which `typeName` now resolves before
reading the item markers, otherwise the rows disappear silently.
The authoring rules are documented in CONTRIBUTING and the figures are
covered by unit tests.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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
Blog posts now render through
withMdxcnwith mdxcn's figure set ported intocomponents/mdx/, so a post can draw a comparison, table, diff, terminal, steps block, callout, quote or footnotes in the site's own dashed-frame language instead of an embedded widget library.components/mdx/— twelve trimmed files (MIT, fromshadcn-labs/mdxcn):GraphCompare,GraphTable,GraphDiff,Terminal,Steps,Callout,Quote,Footnotesplus the frame/parser modules. The upstreammotionscroll-in fade was dropped, so no new dependency.components/mdx/index.tsx—withMdxcnupgrades plain Markdown: GitHub alert blockquotes become callouts, a quote ending in a byline becomes a framed quote, a console fence becomes a terminal, and the footnotes section gets a frame. Posts without those constructs render exactly as before.app/globals.css—--graph-*ink mapped onto the existing palette plus three dashed-rule@utilityblocks.app/blog/[slug]/page.tsx— component map built once at module scope.content/blog/glassmorphism-vs-neo-brutalist.mdx— one comparison figure and one callout as a real use case.docs/CONTRIBUTING.md— new "Writing a Blog Post" section.tests/unit/components/mdx-figures.test.tsx— seven cases.Two RSC constraints handled
next-mdx-remoterunsremoveJavaScriptExpressionsin RSC mode, which deletes everyprop={...}before render —<GraphCompare rows={[...]}>would render an empty frame with no error. Figures therefore take their data as children.typewrapped inReact.lazy, sotypeNamecould not see theRow/Colmarkers and the rows silently disappeared.typeNamenow resolves the lazy type first; a regression test mirrors that shape and fails without the fix.Verification
eslint: 0 errors (one pre-existing<img>warning inopengraph-image.tsx)tsc --noEmit: cleanvitest: 8707 passed; the one failure intemplates-export.test.tscomes from the in-flight ui-sdk template work on a separate branch, not this changenext build --webpack: exit 0; the production HTML contains all six figure rows and the callout