docsify icon indicating copy to clipboard operation
docsify copied to clipboard

HTML escape included mermaid files to handle embedded tags

Open mgranell opened this issue 4 years ago • 4 comments

Summary

Fixes an issue where included mermaid files that had embedded tags failed to render, due to the file being included verbatim into the <div> tag, and embedded html within the mermaid file "breaking out" of the div.

e.g. the following mermaid file will fail:

graph TB
  linkStyle default fill:#ffffff

  14["&lt;div style='font-weight: bold'&gt;This will break&lt;/div&gt;&lt;div style='font-size: 70%; margin-top: 0px'&gt;[Software System]&lt;/div&gt;&lt;div style='font-size: 80%; margin-top:10px'&gt;Description&lt;br /&gt;with HTML&lt;/div&gt;"]

What kind of change does this PR introduce?

Bugfix

For any code change,

  • [X] Related documentation has been updated if needed
  • [ ] Related tests have been updated or tests have been added There are no tests that test in the include functionality

Does this PR introduce a breaking change? (check one)

  • [ ] Yes
  • [X] No

Related issue, if any:

Tested in the following browsers:

  • [X] Chrome
  • [ ] Firefox
  • [ ] Safari
  • [X] Edge
  • [ ] IE

mgranell avatar May 27 '21 07:05 mgranell

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/BuaUAwE3i6YbCAWXNVXXgEERWosw
✅ Preview: https://docsify-preview-git-fork-mgranell-fix-embed-ac6ebc-docsify-core.vercel.app

vercel[bot] avatar May 27 '21 07:05 vercel[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c539b25ccde712c302f3d826203a1080af0d01f0:

Sandbox Source
docsify-template Configuration

codesandbox-ci[bot] avatar May 27 '21 07:05 codesandbox-ci[bot]

Test failed due to timeout, not related to change

mgranell avatar May 27 '21 09:05 mgranell

Hi, @mgranell Can you provide a screenshot of the before and after comparison? I test here there is no difference.

sy-records avatar Jun 04 '21 07:06 sy-records