Skip to content

Stop escaping special characters in mermaid tooltips#109

Merged
Carwyn Pelley (cpelley) merged 1 commit into
mainfrom
more_robust_visual
Jun 25, 2026
Merged

Stop escaping special characters in mermaid tooltips#109
Carwyn Pelley (cpelley) merged 1 commit into
mainfrom
more_robust_visual

Conversation

@cpelley

@cpelley Carwyn Pelley (cpelley) commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Something I had been meaning to get to in quite some time.

<br> tags aren't being recognized as newlines in Mermaid tooltips when used within my custom web component (mermaid-table-standard.js), even though they normally work in standard Mermaid diagrams.

Web components often escape special characters (like <, >, and /) by default when interpolating values into templates. <br> may then be rendered as plain text (&lt;br&gt;) instead of being interpreted as an HTML line break.

Added MutationObserver-based rebinding so this keeps working across Mermaid re-renders/theme toggles.

Test

Before change:

image

After change:

image

@cpelley Carwyn Pelley (cpelley) changed the title Stop no escaped characters in tooltip Stop escaping special characters in mermaid tooltips Jun 23, 2026
@cpelley Carwyn Pelley (cpelley) marked this pull request as ready for review June 23, 2026 15:18
@cpelley

Copy link
Copy Markdown
Collaborator Author

Note Rob Purvis (@mo-robert-purvis) that if you want to play with this yourself you need not change the src of the js file.

Simply open one of the test result files within dagrunner with your browser:
e.g. dagrunner/tests/results/dagrunner.tests.utils.networkx.test_integration.test_basic.html

You will notice that all files generated by the dagrunner tests, reference the relative web component path rather than than the remotely hosted one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good - tooltips fixed

@cpelley Carwyn Pelley (cpelley) merged commit 5902c8d into main Jun 25, 2026
5 checks passed
@cpelley Carwyn Pelley (cpelley) deleted the more_robust_visual branch June 25, 2026 14:08
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.

2 participants