Skip to content

fix: .md fences render in astro dev (prerelease.7) - #22

Merged
kieronlanning merged 1 commit into
mainfrom
fix/md-fences-dev-preamble
Nov 9, 2026
Merged

kieronlanning merged 1 commit into
mainfrom
fix/md-fences-dev-preamble

Conversation

@kieronlanning

Copy link
Copy Markdown
Contributor

On a .md page with no React island, the injected fence script failed in astro dev with @vitejs/plugin-react can't detect preamble: @astrojs/react installs React's fast-refresh preamble only through before-hydration, which runs only on pages with an island.

The script now imports @vitejs/plugin-react/preamble (the plugin's own virtual module, empty outside dev) before the diagram code, when window.$RefreshReg$ is not already set.

  • Test: installs the React preamble before it loads the .md fence components (RED then GREEN); suite 220 passed, 2 skipped; tsc clean.
  • Checked in a consuming Starlight site (packed tarball): .md page with two fences renders 12 and 8 nodes, no page errors, in astro dev and in astro preview.
  • Bumps to 1.0.0-prerelease.7; CHANGELOG and Troubleshooting updated.

@kieronlanning
kieronlanning merged commit 3e37444 into main Nov 9, 2026
4 checks passed
@kieronlanning
kieronlanning deleted the fix/md-fences-dev-preamble branch November 9, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant