PolicyEngine / PolicyEngine/policyengine-app-v2

Migrate blog posts from Markdown to MDX

Open
#492 0 comments 0 reactions 0 assignees View on GitHub

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 .md files in app/src/data/posts/articles/
  • Rendered using ReactMarkdown with rehype-raw in MarkdownFormatter.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

  1. Embed React components directly - <OrgLogos />, <PolicyChart />, custom calculators
  2. Interactive blog posts - live code examples, toggleable sections
  3. Reusable components - consistent styling across posts
  4. Better DX - TypeScript support, props validation
  5. Backward compatible - plain markdown still works

Implementation Steps

  1. Add MDX dependencies:

    • @mdx-js/react
    • @mdx-js/rollup (for Vite) or @mdx-js/loader
  2. Configure Vite to handle .mdx files

  3. Create MDX component provider with allowed components

  4. Update MarkdownFormatter.tsx to use MDX renderer for .mdx files (keep ReactMarkdown for legacy .md files)

  5. Update posts.json or post loading logic to handle both .md and .mdx

  6. Document component usage for blog authors

  7. Gradually migrate posts that would benefit from components

Considerations

  • Keep backward compatibility with existing .md posts
  • 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-logos route added for blog embedding

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.