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 with text renders by default as Markdown #6087

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

Conversation

knsv
Copy link
Collaborator

@knsv knsv commented Nov 27, 2024

… text

πŸ“‘ Summary

Adding differentiation between regular strings and markdown strings.

Resolves #5824 and #6048

πŸ“ Design Decisions

Adding back createLabel for the cases where you do not want markdown text

πŸ“‹ 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 Nov 27, 2024

πŸ¦‹ Changeset detected

Latest commit: 4693aa2

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 Nov 27, 2024

βœ… Deploy Preview for mermaid-js ready!

Name Link
πŸ”¨ Latest commit 4693aa2
πŸ” Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/674e387aa5b85100083a437a
😎 Deploy Preview https://deploy-preview-6087--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 Nov 27, 2024

Open in Stackblitz

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

commit: 4693aa2

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

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

Project coverage is 4.48%. Comparing base (df636c6) to head (4693aa2).

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

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #6087      +/-   ##
==========================================
- Coverage     4.48%   4.48%   -0.01%     
==========================================
  Files          383     383              
  Lines        54038   54057      +19     
  Branches       596     596              
==========================================
  Hits          2425    2425              
- Misses       51613   51632      +19     
Flag Coverage Ξ”
unit 4.48% <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/flowDb.ts 0.00% <0.00%> (ΓΈ)
...aid/src/rendering-util/rendering-elements/edges.js 0.00% <0.00%> (ΓΈ)
...c/rendering-util/rendering-elements/shapes/util.ts 0.00% <0.00%> (ΓΈ)

Copy link

argos-ci bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Argos notifications β†—οΈŽ

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 176 changed, 340 added, 339 removed, 4 failures Dec 2, 2024, 11:06 PM

addSvgBackground: !!node.icon || !!node.img,
});
let text;
if (node.labelType !== 'string') {
Copy link

Choose a reason for hiding this comment

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

Is there a reason why this is !== 'string' rather than === 'markdown' as was done in the edge?

As I understand it, in:

graph LR
  foo[foo] --> bar["bar"] --> baz["`baz`"]
| name | labelType |
|------+-----------|
| foo  | text      |
| bar  | string    |
| baz  | markdown  |

My position is that both text and string labelTypes should be rendered as plain text, and only labelType markdown should be rendered as markdown. Is there some case where that falls down for your needs?

@ajuckel
Copy link

ajuckel commented Mar 3, 2025

@knsv I did a rebase of this branch on top of develop, and addressed my comment above, in new PR #6345. If it's easier for you to address the conflicts yourself to merge this, I would ask that you cherry-pick my 148c4f6 commit. For my purposes, I need both text and string labelTypes be treated as non-markdown.

If there's anything I can do to help either this, #6345, or #6277 get to a state it can be merged, please let me know.

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.

Bug Flowchart: Node with text renders by default as Markdown
4 participants