-
Notifications
You must be signed in to change notification settings - Fork 0
Add MDX renderer for Markdown with JSX support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Bryan0324 <34998621+Bryan0324@users.noreply.github.com>
Co-authored-by: Bryan0324 <34998621+Bryan0324@users.noreply.github.com>
Bryan0324
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Check original markdown rendering availability.
✅ Original markdown rendering availability verified. After loading
Both renderers coexist without conflicts. The MDX implementation registers as a separate renderer and does not modify or interfere with existing markdown processing. |
|
@copilot Also check if react elements is available for rendering. |
Co-authored-by: Bryan0324 <34998621+Bryan0324@users.noreply.github.com>
✅ React/JSX elements are fully available for rendering in MDX files. Verified support for:
Added comprehensive test coverage in commit f5473c9. All 10 MDX tests pass, including 4 JSX-specific tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Check the results of react elements rendering.
✅ Confirmed: React/JSX elements ARE available for rendering. All JSX features work correctly:
Test Coverage (commit f5473c9):
The MDX renderer uses Preact for JSX runtime and renders to static HTML. |
Adds native support for
.mdxfiles, enabling JSX syntax in Markdown posts. MDX files in_posts/and_drafts/are now automatically processed as posts.Implementation
@mdx-js/mdxfor compilation,preact+preact-render-to-stringfor lightweight SSR (10KB vs React's 40KB)lib/plugins/renderer/mdx.ts): Async renderer that evaluates MDX with Preact JSX runtime and outputs static HTML. Error messages include file paths and stack traces.lib/plugins/renderer/index.ts): Registered.mdx→htmlas async renderer withdisableNunjucksflagFeatures
Markdown Support
Standard Markdown syntax works as expected:
JSX/React Elements
Full JSX syntax support including:
<div className="alert">){new Date().getFullYear()})style={{color: 'red', padding: '10px'}})Usage
Create posts with
.mdxextension:The existing post processor automatically detects and renders
.mdxfiles viactx.render.isRenderable().Testing
Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.