r/learnprogramming • u/shakya47 • 3h ago
Resource I got tired of mentally diffing code tutorials, so I built a React/MDX library that highlights what changed on every click
Reading code tutorials usually means scrolling back and forth to figure out what actually changed between steps. I built unfold-mdx so you can learn through code walkthroughs at your own pace, with the new parts highlighted as you step forward.
- Live demos: https://shakya47.github.io/unfold-mdx/
- GitHub: https://github.com/Shakya47/unfold-mdx
- Install:
npm i @unfold-mdx/react
Instead of manually tracking line numbers or adding diff markers, you just write each step as a full snapshot (the explanation so far + the code so far). It compares consecutive snapshots on its own and highlights the new sentences and code lines on every Next click.
What's in 0.1.0:
- Shiki syntax highlighting
- Step-synced highlights on images and Mermaid/SVG diagrams
- Grid layouts, resizable panes, and custom controls
- Headless by default with an optional theme, SSR fallback, and keyboard navigation
- An
llms.txtfile so AI coding agents can write walkthroughs in the right format
2
Upvotes