wip: Add optInMarkdownLabels config setting #6277
Draft
+46
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 Summary
This is a quick strawman implementation of the direction I'm proposing to resolve #6275.
Resolves #6275
Examples of types of labels causing issues in an external project:
After applying new config setting with these changes:
![image](https://private-user-images.githubusercontent.com/126271/413021200-d4e20afe-8990-472c-a13d-2d268077197e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjY2MDUsIm5iZiI6MTczOTU2NjMwNSwicGF0aCI6Ii8xMjYyNzEvNDEzMDIxMjAwLWQ0ZTIwYWZlLTg5OTAtNDcyYy1hMTNkLTJkMjY4MDc3MTk3ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQyMDUxNDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hOWIzOWU2YjA2ZWZhODZmM2QxNTJiMTNiMjU2Y2JjZjNlZjk1NDI3ZGM5YWEzNWNhNjdmMDAyZTU2ZDgwYjZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.xBc5KkJxLVEqB3AL2y77jYlUpZ8tXTZ8T4vYtC0TMw8)
📏 Design Decisions
I've added an
optInMarkdownLabels
config setting. It defaults to false, but when enabled (either in frontmatter, or in a call to initialize), it turns off the auto-markdown processing for node labels.The primary goal is to provide a less intrusive upgrade path from Mermaid 10 to 11. Users who encounter markdown issues in their node rendering when upgrading to Mermaid 11 could set
optInMarkdownLabels
to false in order restore a closer approximation of the 10.x behavior. I'm not claiming this PR will ever guarantee no rendering changes in the upgrade from 10 to 11, but it will certainly provide a fix for theUnsupported markdown
issues that can be accidentally encountered during the upgrade.There are many issues to solve before the implementation could be considered for merge. I'm sharing the early draft just as a conversation point, to see if this approach would be acceptable if the following issues were resolved.
useHtmlLabels
path, which callsmarkdownToHTML
. I should probably update themarkdownToLines
path foruseHtmlLabels=false
as well.📋 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:
.