PolicyEngine / PolicyEngine/policyengine-app-v2
Migrate blog posts from Markdown to MDX
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 50m
- Merged PRs (30d)
- 39
Description
Summary
Migrate the blog system from plain Markdown (rendered via ReactMarkdown) to MDX to enable embedding React components directly in blog posts.
Current State
- Blog posts are
.mdfiles inapp/src/data/posts/articles/ - Rendered using
ReactMarkdownwithrehype-rawinMarkdownFormatter.tsx - ~100+ existing markdown posts
- Some posts are Jupyter notebooks (
.ipynb) - Currently using iframe workarounds to embed React components (e.g., OrgLogos)
Benefits of MDX
- Embed React components directly -
<OrgLogos />,<PolicyChart />, custom calculators - Interactive blog posts - live code examples, toggleable sections
- Reusable components - consistent styling across posts
- Better DX - TypeScript support, props validation
- Backward compatible - plain markdown still works
Implementation Steps
-
Add MDX dependencies:
@mdx-js/react@mdx-js/rollup(for Vite) or@mdx-js/loader
-
Configure Vite to handle
.mdxfiles -
Create MDX component provider with allowed components
-
Update
MarkdownFormatter.tsxto use MDX renderer for.mdxfiles (keep ReactMarkdown for legacy.mdfiles) -
Update
posts.jsonor post loading logic to handle both.mdand.mdx -
Document component usage for blog authors
-
Gradually migrate posts that would benefit from components
Considerations
- Keep backward compatibility with existing
.mdposts - Jupyter notebooks (
.ipynb) need separate handling - Consider build performance with many MDX files
- Document available components for non-technical contributors
Related
- Current iframe workaround:
/embed/org-logosroute added for blog embedding
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading MarkdownFormatter.tsx and inspecting the posts in app/src/data/posts/articles/, then trace how posts.json or the post-loading logic handles file types. Review the Vite configuration and the existing iframe workaround for embedded components. Done means .mdx posts render components while legacy .md and .ipynb handling remain supported, with component usage documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, react, typescript, vite
- Domain
- documentation, frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100