-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Enable CSS-like linear-gradient fills for flowchart nodes #5912
Conversation
|
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
commit: |
// Look for all gradient styles, ensuring that nested parentheses due to color functions are handled properly | ||
const linearGradientStyles = vertex.cssCompiledStyles | ||
?.join('') | ||
?.match(/fill\s*:\s*linear-gradient\(([^()]*(\([^()]*\))*[^()]*)+\)/g); |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5912 +/- ##
==========================================
- Coverage 5.00% 4.96% -0.05%
==========================================
Files 338 339 +1
Lines 48221 48641 +420
Branches 551 552 +1
==========================================
Hits 2413 2413
- Misses 45808 46228 +420
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
📑 Summary
This PR adds support for CSS-like linear-gradient fills to Mermaid, following the CSS linear-gradient syntax. It introduces a reusable gradient utility that can be applied to other diagrams in the future, though this PR focuses on flowcharts as an example of how the feature can be used.
Resolves #2907 and #4476
📏 Design Decisions
The implementation involves updating the lexer to recognize the linear-gradient syntax and modifying the renderer to correctly apply the gradient fills to flowchart nodes. The design follows a CSS-like approach to maintain familiarity for users.
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.