Releases: FlyNumber/markdown_docusaurus_plugin
Releases · FlyNumber/markdown_docusaurus_plugin
v2.2.5 — ultrareview fixes
Bundle of seven correctness fixes surfaced by an independent ultrareview of 2.2.4. Semver-patch — no public API changes. Behavior changes are limited to outputs that were previously buggy: collision overwrites, mangled fenced code, silent broken images, dropped Tabs blocks, malformed-hash crashes, and the auto-closing dropdown.
Fixed
intro.mdcollision onslug: '/'routes — sites with bothdocs/intro.mdand a doc routed to/docs/had their build output collide onintro.md, with the second route silently overwriting the first. Trailing-slash routes now resolve toindex.md.- Code fences corrupted by MDX/Docusaurus transforms — docs demonstrating Docusaurus syntax inside fenced code blocks had imports stripped and
<Tabs>rewritten right out of their own examples. Added a fence-aware protection pass that handles backtick and tilde fences (length ≥ 3, ≤3 leading spaces, supports CRLF and unclosed fences), and supports legitimate<Tabs>blocks containing fenced code. - Image dirs only copied to the first route's destination — sibling docs in the same source dir routed to different URL spaces had silent broken images. Switched to
Map<src, Set<dest>>so each source dir is copied to every destination it serves. <TabItem>and YouTube iframe regexes rejected valid attribute orders — reverse-order TabItems silently emptied the entire<Tabs>block; reverse-order YouTube iframes survived as raw HTML. Both now parse attrs independently with single- or double-quote support.- Multi-line and side-effect imports now stripped (
.*?couldn't cross newlines,import './x.css';wasn't matched). - Component scrubber now backreferences the opening tag so siblings like
<Outer><Inner>x</Inner></Outer>no longer leave an orphan</Outer>. (Deeply nested same-name components remain a known regex limitation.) <details>allows attributes on the opening tag and mixed-content summaries; body cleanup only trims outer blank padding so 4-space indents and intentional blank lines survive.Root.jsdecodeURIComponentcrash — malformed hashes like#%foono longer crash the scroll-to-anchor effect.Root.jsscroll-to-anchor timer/listener leaks — quickly clicking different hash links no longer piles up timers that could scroll the page out from under the user.- Dropdown copy-reset timer no longer auto-closes the menu or leaks on unmount.
Internal
- Added a
node --testsuite (zero new dependencies). Run withnpm test. - Extracted
cleanMarkdownForDisplay, fence protection, image mapping, URL building, and hash decoding into focusedlib/modules for testability.
PR: #9
v2.2.3
v2.2.2
Fixed
- Dropdown not appearing on client-side navigation — the MutationObserver introduced in 2.2.1 short-circuited when it found stale DOM during React transitions, causing the button to vanish after page swaps. Observer now stays active to catch content swaps and re-inject reliably.
- Track exact container instance via ref instead of global querySelector to prevent cleanup collisions during page transitions
- Observe
document.bodyinstead of<main>element to survive layout swaps during navigation - Unmount stale React roots before creating new ones to prevent memory leaks
Documentation
- Added note clarifying the dropdown only appears on doc content pages, not category/index pages
v2.2.1
v2.2.0
Added
- Configurable
docsPathoption for sites that don't host docs under/docs/(fixes #3)- Default:
'/docs/'(no behavior change for existing users) - Example:
['docusaurus-markdown-source-plugin', { docsPath: '/' }] - Supports docs-only subdomains, custom route base paths, etc.
- Default:
contentLoadedhook exposing plugin options to theme components via Docusaurus global data- React 19 support — peer dependencies now allow
react ^18.0.0 || ^19.0.0(fixes #1, thanks @kojitakakipathos for flagging in #5)
Changed
- Runtime components now read
docsPathfrom plugin global data instead of hardcoding/docs/ - Updated README: replaced swizzle instructions with
docsPathconfiguration docs
[2.1.0] - 2026-03-03
Changed
- Refactored build processing to use Docusaurus route metadata instead of filesystem scanning
- Plugin now reads
route.metadata.sourceFilePathfrompostBuildroutes prop - Automatically handles custom
routeBasePath, versioned docs, and i18n configurations - Image path rewriting now uses actual route URLs instead of hardcoded
/docs/prefix - Removed
findMarkdownFiles()andcopyImageDirectories()internal functions
Fixed
- Image paths in cleaned markdown now correctly reflect the site's URL structure
- Plugin no longer assumes docs live at the
/docs/URL path
[2.0.1] - 2025-11-24
Documentation
- Added button screenshot to README showing the dropdown UI
- Removed unnecessary v1.x migration guide (no users existed before v2.0.0)
- Simplified Advanced Configuration section
- Removed complex swizzling instructions for blog support
- Added honest note about customization trade-offs
Improved
- Screenshot now displays at 400px width for better README viewing
- Cleaner, more focused documentation
- More transparent about current limitations and future plans
[2.0.0] - 2025-11-24
Breaking Changes
- Eliminated manual file copying requirement - Plugin now uses Docusaurus native APIs
- Users upgrading from v1.x must remove manually copied theme files (
src/theme/Root.jsandsrc/components/MarkdownActionsDropdown/) - Component directory structure changed:
src/→theme/andcomponents/ - Components now bundled with plugin instead of user's project
Added
getThemePath()plugin API to automatically provide theme components.gitignorefile for cleaner development experience- Comprehensive migration guide in README for v1.x users
- Zero-config installation - just add plugin to docusaurus.config.js
Changed
- Plugin now provides components via Docusaurus plugin APIs instead of requiring manual copying
- Updated README with simplified installation instructions
- Component imports now use relative paths instead of
@sitealias - Updated troubleshooting guide to reflect new architecture
- Updated advanced configuration examples to use swizzling
Improved
- Much better developer experience - no manual file management needed
- Components automatically update when plugin updates (no stale copied files)
- Cleaner project structure - plugin consumers don't need theme overrides
- Standard Docusaurus plugin pattern - follows best practices
Technical Details
- Uses Docusaurus
getThemePath()lifecycle method - Components bundled at:
theme/Root.jsandcomponents/MarkdownActionsDropdown/ - Tested in production with 58 markdown files and 10 image directories
- Compatible with Docusaurus v3.x
Migration from v1.x
- Remove manually copied files:
src/theme/Root.jsandsrc/components/MarkdownActionsDropdown/ - Update the plugin:
npm update docusaurus-markdown-source-plugin - Rebuild:
npm run build - CSS in
custom.cssremains unchanged
v1.0.0 - Initial Release
1.0.0 - 2025-11-24
Added
- Initial release of docusaurus-markdown-source-plugin
- Build-time plugin that copies markdown files to build output
- Automatic cleaning of Docusaurus-specific syntax (front matter, imports, MDX components)
- Conversion of HTML elements back to markdown equivalents
- Conversion of relative image paths to absolute paths from /docs/ root
- Automatic copying of image directories to build output
- React dropdown component for viewing and copying markdown
- "View as Markdown" feature - opens raw markdown in new tab
- "Copy Page as Markdown" feature - copies markdown to clipboard
- Dynamic injection into article headers via Root.js theme override
- Click-outside-to-close dropdown behavior
- Mobile-responsive dropdown positioning
- RTL language support for dropdown menu
- Comprehensive deployment guides for:
- Vercel
- Netlify
- Cloudflare Pages
- Apache
- Nginx
- SEO-safe HTTP headers configuration examples
- CSS customization support via custom.css
- Support for Tabs/TabItem component conversion
- Support for details/summary component conversion
- YouTube iframe to text link conversion
- HTML5 video tag handling
- Zero-config setup with sensible defaults
Documentation
- Comprehensive README with installation instructions
- Quick start guide
- Deployment configuration for all major platforms
- Troubleshooting guide
- Advanced configuration examples (blog support, custom URL patterns)
- CSS customization guide
- Live example at flynumber.com/docs
Technical Details
- Dependencies: fs-extra ^11.0.0
- Peer dependencies: @docusaurus/core ^3.0.0, react ^18.0.0
- Requires Node.js >=18.0.0
- Compatible with Docusaurus v3.x
- Uses React 18's createRoot API for component injection