Skip to content

Bundle mermaid locally#2677

Merged
lhw-1 merged 7 commits into
MarkBind:masterfrom
Incogdino:branch-bundleMermaid
Apr 13, 2025
Merged

Bundle mermaid locally#2677
lhw-1 merged 7 commits into
MarkBind:masterfrom
Incogdino:branch-bundleMermaid

Conversation

@Incogdino

@Incogdino Incogdino commented Apr 11, 2025

Copy link
Copy Markdown
Contributor
  • Updated mermaid to use local version (V10.6.0) if a specific version is not specified.
  • Updated tests.

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Closes #2667
Part of #2548

Overview of changes:

  • Updated mermaid to use local version (V10.6.0) if a specific version
    is not specified.
  • Updated tests.

Anything you'd like to highlight/discuss:
We could explore upgrading mermaid to a later version in a future issue.

Testing instructions:

Proposed commit message: (wrap lines at 72 characters)
Bundle mermaid locally

  • Updated mermaid to use local version (V10.6.0) if a specific version
    is not specified.
  • Updated tests.

Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

- Updated mermaid to use local version (V10.6.0) if a specific version
is not specified.
- Updated tests.
@codecov

codecov Bot commented Apr 11, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.90%. Comparing base (223f29e) to head (a505ab4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2677    +/-   ##
========================================
  Coverage   51.90%   51.90%            
========================================
  Files         130      130            
  Lines        7104     7104            
  Branches     1547     1572    +25     
========================================
  Hits         3687     3687            
+ Misses       3263     3118   -145     
- Partials      154      299   +145     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/core/src/plugins/mermaid.ts

@Tim-Siu Tim-Siu 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.

An effective and straightforward fix. LGTM.

Comment thread packages/core/src/plugins/mermaid.ts Outdated
import { PluginContext, FrontMatter } from './Plugin';

const DEFAULT_CDN_ADDRESS = 'https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs';
const DEFAULT_MERMAID_PATH = './mermaidAssets/mermaid.min.js';

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.

Can be simplified const DEFAULT_MERMAID_PATH = 'mermaidAssets/mermaid.min.js'; as well. I used this in other plugins, but not sure which is the best practice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ill update it so that it stays consistent with the convention that we are already using. I don't think there is much difference either, except maybe using ./ is a bit more explicit in defining the path.

Comment thread packages/core/src/plugins/mermaid.ts

@lhw-1 lhw-1 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.

Thanks for the fix @Incogdino! Apart from the issues brought up by other reviewers, LGTM

Incogdino and others added 3 commits April 13, 2025 14:10
1. Relative path now follows our convention to be more implicit.
2. Updated test cases.
@lhw-1 lhw-1 merged commit 1856da1 into MarkBind:master Apr 13, 2025
@github-actions github-actions Bot added the r.Patch Version resolver: increment by 0.0.1 label Apr 13, 2025
lhw-1 added a commit that referenced this pull request Apr 13, 2025
@gerteck

gerteck commented Apr 13, 2025

Copy link
Copy Markdown
Member

Regressions Found:

image

Mermaid rendering does not work in panels (dynamic rendered content)

image

Some further work to refactor the logic would be good

lhw-1 added a commit that referenced this pull request Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r.Patch Version resolver: increment by 0.0.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Previous Mermaid Script CORS issue: Consider bundling Mermaid

5 participants