Skip to content

feat(blog): render posts with framed MDX figures - #104

Merged
AnxForever merged 1 commit into
mainfrom
feat/blog-mdx-figures
Nov 16, 2026
Merged

AnxForever merged 1 commit into
mainfrom
feat/blog-mdx-figures

Conversation

@AnxForever

Copy link
Copy Markdown
Owner

What

Blog posts now render through withMdxcn with mdxcn's figure set ported into components/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, from shadcn-labs/mdxcn): GraphCompare, GraphTable, GraphDiff, Terminal, Steps, Callout, Quote, Footnotes plus the frame/parser modules. The upstream motion scroll-in fade was dropped, so no new dependency.
  • components/mdx/index.tsx — withMdxcn upgrades 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 @utility blocks.
  • 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

  1. next-mdx-remote runs removeJavaScriptExpressions in RSC mode, which deletes every prop={...} before render — <GraphCompare rows={[...]}> would render an empty frame with no error. Figures therefore take their data as children.
  2. A client component's children arrive with their type wrapped in React.lazy, so typeName could not see the Row/Col markers and the rows silently disappeared. typeName now 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 in opengraph-image.tsx)
  • tsc --noEmit: clean
  • vitest: 8707 passed; the one failure in templates-export.test.ts comes from the in-flight ui-sdk template work on a separate branch, not this change
  • next build --webpack: exit 0; the production HTML contains all six figure rows and the callout
  • Client cost: the figure chunk is 9.2 KB gzip, loaded with the blog post page

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.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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: bbd4d57a-8625-4081-a495-a058128fa77b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@AnxForever
AnxForever merged commit 40c3ae2 into main Nov 16, 2026
9 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