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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add svgId option #645

Merged
merged 2 commits into from
Feb 10, 2024
Merged

feat: add svgId option #645

merged 2 commits into from
Feb 10, 2024

Conversation

ouuan
Copy link
Contributor

@ouuan ouuan commented Feb 9, 2024

馃搼 Summary

Add a new option -I, --svgId [svgId] to set the id attribute of the <svg> element to be rendered.

This is useful when the output is used as a part of HTML, because Mermaid CSS pollutes the global CSS with the id.

馃搹 Design Decisions

svgId || 'my-svg' to use the old id as default. || instead of ?? to avoid empty id and for better compatibility.

馃搵 Tasks

Make sure you

  • 馃摉 have read the contribution guidelines
  • 馃捇 have added unit/e2e tests (if appropriate)
  • 馃敄 targeted master branch

Copy link
Member

@aloisklink aloisklink left a comment

Choose a reason for hiding this comment

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

Looks great to me :)

Awesome that you also added a test case!

Edit: I'll leave this PR open for a few days (or until the next mermaid-cli release) in case anybody else wants to review it, before merging it.

@MindaugasLaganeckas
Copy link
Member

@aloisklink you are welcome to merge it!

@aloisklink aloisklink merged commit eed6ba9 into mermaid-js:master Feb 10, 2024
7 checks passed
@ouuan ouuan deleted the svg-id branch February 11, 2024 03:02
@aloisklink aloisklink added the enhancement New feature or request label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants