Skip to content

Pin and conditionally load Mermaid in styled HTML exports - #204

Merged
cyanzhong merged 1 commit into
mainfrom
fix/styled-html-remote-dependencies
Sep 30, 2026
Merged

cyanzhong merged 1 commit into
mainfrom
fix/styled-html-remote-dependencies

Conversation

@cyanzhong

Copy link
Copy Markdown
Contributor

Closes #203.

Closes #203

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation addresses conditional loading and version pinning with appropriate build and export coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Pins Mermaid’s CDN version and loads it only when styled HTML contains Mermaid content.

Changes:

  • Defines the installed Mermaid version at build/test time.
  • Conditionally injects the Mermaid module loader.
  • Adds comprehensive export and build-variant tests.
File Description
src/​render.ts Detects Mermaid elements before adding the pinned loader.
types/​env.d.ts Declares the Mermaid version build constant.
vite.config.mts Injects the installed Mermaid version during builds.
vitest.config.ts Injects the version during tests.
tests/​render.styles.test.ts Tests conditional and pinned loading across exports.
tests/​build.test.ts Verifies lite builds exclude the CDN dependency.
dist/​markedit-preview.js Synchronizes the generated full-build artifact.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cyanzhong
cyanzhong merged commit 3778b99 into main Sep 30, 2026
2 checks passed
@cyanzhong
cyanzhong deleted the fix/styled-html-remote-dependencies branch September 30, 2026 12:44
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.

[Feature Request] Make styled HTML exports predictable and usable offline

2 participants