Skip to content

fix(blazor): vendor mermaid, MathJax, highlight.js, github-markdown-css - #1552

Merged
rbuergi merged 1 commit into
mainfrom
feat/vendor-js-libs
Aug 14, 2026
Merged

rbuergi merged 1 commit into
mainfrom
feat/vendor-js-libs

Conversation

@rbuergi

@rbuergi rbuergi commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Part of the modularization program's asset-reference cleanup (the revisit of mermaid/mathjax/monaco refs).

Why: five view-time CDN loads silently broke diagrams, math, code highlighting, and markdown styling on locked-down networks — and the mermaid URL was unpinned (every visitor got whatever unpkg shipped last).

What: all four libraries ship as static web assets under _content/MeshWeaver.Blazor/lib (the existing mammoth/pdfjs-dist pattern), pinned — mermaid 11.12.1, MathJax 3.2.2, highlight.js 11.11.1 + github themes, github-markdown-css 5.8.1. Seven call sites rewritten; grep confirms zero external script/style URLs remain in the Blazor trees.

Deliberately out of scope: the MAUI client's Monaco CDN loader (Memex.Client/Pages/MonacoEditorView.cs) — needs BlazorMonaco's assets served inside the BlazorWebView; follow-up.

Verification: MeshWeaver.Blazor.Portal builds -c Release -warnaserror clean. What's New entry included (Fix).

🤖 Generated with Claude Code

…wn-css — no more CDN loads at view time

Five view-time CDN references made diagrams, math, code highlighting,
and markdown styling silently break on networks that block public CDNs —
and the mermaid URL was UNPINNED (unpkg /mermaid/dist: every visitor got
whatever shipped last). All four libraries now ship as static web assets
under _content/MeshWeaver.Blazor/lib (the mammoth/pdfjs-dist precedent),
pinned: mermaid 11.12.1, MathJax 3.2.2, highlight.js 11.11.1 (+ github
themes), github-markdown-css 5.8.1. Seven call sites rewritten; zero
external script/style URLs remain in the Blazor trees.

Remaining CDN reference (deliberately separate): the MAUI client's
Monaco loader (memex/Memex.Client/Pages/MonacoEditorView.cs) needs the
BlazorMonaco assets served inside the BlazorWebView — its own change.

Verified: MeshWeaver.Blazor.Portal builds -c Release -warnaserror clean
(0 Errors).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 10:36

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.

Pull request overview

This PR removes runtime CDN dependencies for Mermaid, MathJax, highlight.js, and GitHub Markdown CSS in the Blazor portal by vendoring pinned copies as static web assets under _content/MeshWeaver.Blazor/lib, improving reliability on locked-down networks.

Changes:

  • Vendored pinned versions of highlight.js and GitHub Markdown CSS (plus themes) into wwwroot/lib.
  • Updated multiple Blazor JS call sites to load Mermaid/MathJax/Markdown CSS from _content/... instead of public CDNs.
  • Added a “What’s New” entry documenting the offline rendering fix.

Reviewed changes

Copilot reviewed 7 out of 15 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/MeshWeaver.Documentation/Data/WhatsNew/2026-08-14-offline-diagram-math-rendering.md Adds release note describing offline-friendly rendering.
src/MeshWeaver.Blazor/wwwroot/lib/highlightjs/styles/github.min.css Adds vendored highlight.js GitHub light theme.
src/MeshWeaver.Blazor/wwwroot/lib/highlightjs/styles/github-dark.min.css Adds vendored highlight.js GitHub dark theme.
src/MeshWeaver.Blazor/wwwroot/lib/highlightjs/highlight.min.js Adds vendored highlight.js runtime.
src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown.min.css Adds vendored GitHub Markdown CSS (base).
src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown-light.min.css Adds vendored GitHub Markdown CSS (light).
src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown-dark.min.css Adds vendored GitHub Markdown CSS (dark).
src/MeshWeaver.Blazor/wwwroot/highlightUtils.js Switches highlight.js loader from CDN to vendored static assets.
src/MeshWeaver.Blazor/Components/Mermaid.razor.js Switches Mermaid loader from CDN to vendored static assets.
src/MeshWeaver.Blazor/Components/MathBlock.razor.js Switches MathJax loader from CDN to vendored static assets.
src/MeshWeaver.Blazor/Components/MarkdownView.razor.js Switches markdown theme fallback path from CDN to vendored static assets.
src/MeshWeaver.Blazor/Components/CollaborativeMarkdownView.razor.js Switches Mermaid/MathJax loading from CDN to vendored static assets.
src/MeshWeaver.Blazor.Portal/Layout/PortalLayoutBase.razor.js Switches markdown theme fallback path from CDN to vendored static assets.
Files not reviewed (5)
  • src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown-dark.min.css: Generated file
  • src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown-light.min.css: Generated file
  • src/MeshWeaver.Blazor/wwwroot/lib/github-markdown-css/github-markdown.min.css: Generated file
  • src/MeshWeaver.Blazor/wwwroot/lib/highlightjs/styles/github-dark.min.css: Generated file
  • src/MeshWeaver.Blazor/wwwroot/lib/highlightjs/styles/github.min.css: Generated file

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

Comment thread src/MeshWeaver.Blazor/Components/Mermaid.razor.js
Comment thread src/MeshWeaver.Blazor/Components/CollaborativeMarkdownView.razor.js
Comment thread src/MeshWeaver.Blazor/wwwroot/highlightUtils.js
Comment thread src/MeshWeaver.Blazor/Components/MarkdownView.razor.js
Comment thread src/MeshWeaver.Blazor.Portal/Layout/PortalLayoutBase.razor.js
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 0)

725 tests  ±0   725 ✅ ±0   10m 42s ⏱️ -4s
 10 suites ±0     0 💤 ±0 
 10 files   ±0     0 ❌ ±0 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 3)

   11 files  ±0     11 suites  ±0   5m 27s ⏱️ +10s
1 837 tests ±0  1 734 ✅ +1  103 💤 ±0  0 ❌  - 1 
2 178 runs  +1  2 075 ✅ +2  103 💤 ±0  0 ❌  - 1 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 5)

1 920 tests  ±0   1 728 ✅ ±0   6m 13s ⏱️ +8s
   11 suites ±0     192 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 4)

1 949 tests  ±0   1 939 ✅ ±0   8m 36s ⏱️ +43s
   11 suites ±0      10 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 1)

1 532 tests  ±0   1 532 ✅ ±0   7m 35s ⏱️ -1s
   11 suites ±0       0 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 2)

2 481 tests  ±0   2 480 ✅ ±0   7m 57s ⏱️ +2s
   12 suites ±0       1 💤 ±0 
   12 files   ±0       0 ❌ ±0 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    66 files  ±0      66 suites  ±0   46m 32s ⏱️ +58s
10 444 tests ±0  10 138 ✅ +1  306 💤 ±0  0 ❌  - 1 
10 785 runs  +1  10 479 ✅ +2  306 💤 ±0  0 ❌  - 1 

Results for commit 47b478f. ± Comparison against base commit d3405ac.

@rbuergi
rbuergi merged commit e7ab071 into main Aug 14, 2026
22 checks passed
@rbuergi

rbuergi commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-ups in #1556 (sourcemap strips + naming). The mermaid window-attachment claim is falsified: the vendored bundle ends with globalThis["mermaid"] = ... — the global is attached as before.

rbuergi added a commit that referenced this pull request Aug 14, 2026
chore(blazor): vendored-asset polish from the #1552 review
@rbuergi
rbuergi deleted the feat/vendor-js-libs branch August 19, 2026 10:29
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.

2 participants