Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Node and edge labels should only render as markdown if properly delimited #6345

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

ajuckel
Copy link

@ajuckel ajuckel commented Mar 3, 2025

📑 Summary

Restores the behavior that only nodes and edges delimited with double-quote-backtick (e.g. node["`_markdown_ **text**`"]) are processed as markdown.

Resolves #6275, #6048, and #5824

📏 Design Decisions

The implementation is based on #6087. First, I simply rebased on top of develop and resolved the conflicts as seemed appropriate to me.

Intentional changes:

  • Updated the node test from node.labelType !== 'string' to node.labelType === 'markdown'.
  • After looking through the e2e tests, I assumed 'string' was used to resolve some of the iconShape e2e tests. To resolve, I made the label default 'markdown' for nodes built from NodeMetaData, and added the capability to configure it via an additional labelType key.

If this is a more acceptable fix for the linked issues, this would replace my alternate PR #6277.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Mar 3, 2025

🦋 Changeset detected

Latest commit: af6cf0e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit af6cf0e
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/67c7cf358b765d0008f3810d
😎 Deploy Preview https://deploy-preview-6345--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Mar 3, 2025

Open in Stackblitz

npm i https://pkg.pr.new/mermaid-js/mermaid@6345
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@6345
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@6345
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@6345

commit: af6cf0e

Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 52 lines in your changes missing coverage. Please review.

Project coverage is 3.88%. Comparing base (bc2bd3d) to head (af6cf0e).

Files with missing lines Patch % Lines
...c/rendering-util/rendering-elements/shapes/util.ts 0.00% 18 Missing ⚠️
packages/mermaid/src/diagrams/flowchart/flowDb.ts 0.00% 14 Missing ⚠️
.../src/rendering-util/rendering-elements/clusters.js 0.00% 11 Missing ⚠️
...aid/src/rendering-util/rendering-elements/edges.js 0.00% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #6345      +/-   ##
==========================================
- Coverage     3.88%   3.88%   -0.01%     
==========================================
  Files          398     399       +1     
  Lines        42044   42089      +45     
  Branches       638     638              
==========================================
  Hits          1635    1635              
- Misses       40409   40454      +45     
Flag Coverage Δ
unit 3.88% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/diagrams/flowchart/types.ts 100.00% <ø> (ø)
packages/mermaid/src/types.ts 100.00% <ø> (ø)
...aid/src/rendering-util/rendering-elements/edges.js 0.00% <0.00%> (ø)
.../src/rendering-util/rendering-elements/clusters.js 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/flowchart/flowDb.ts 0.00% <0.00%> (ø)
...c/rendering-util/rendering-elements/shapes/util.ts 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

Copy link

argos-ci bot commented Mar 3, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 702 changed, 3 added Mar 5, 2025, 4:23 AM

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.

Markdown-by-default for labels complicates the upgrade from Mermaid 10 to Mermaid 11
3 participants