Giter Site home page Giter Site logo

Comments (5)

guansss avatar guansss commented on August 20, 2024 1

It turns out that the annotations are half escaped, resulting in unexpected HTML tag that breaks Mermaid parser:

1661911981205

I looked into the source of fence_mermaid formatter and the comment says it does not escape the Mermaid source, so I switched to the official formatter superfences.fence_div_format (which does escape) and then everything worked without problem.

  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_div_format

Looks like escaping the source is necessary? Then I'm wondering, what was the original purpose of not to escape? Does escaping have pitfalls?

from mkdocs-mermaid2-plugin.

github-actions avatar github-actions commented on August 20, 2024

Thank you for your contribution! This is very appreciated.

from mkdocs-mermaid2-plugin.

fralau avatar fralau commented on August 20, 2024

That's a thought-provoking question 🤔. I will look into it.

from mkdocs-mermaid2-plugin.

fralau avatar fralau commented on August 20, 2024

The custom mermaid2.fence_mermaid was developed specifically for the loose security mode, which allows tags in text and clicking (it's stated in the code of the fence.py.

When using tags in text, you don't want to escape your HTML .

But if you are operating in the default strict mode (no tags in text and no clickable links), escaping might indeed be better.

🤔 Perhaps I should document this better?

from mkdocs-mermaid2-plugin.

guansss avatar guansss commented on August 20, 2024

Oh I missed that part. Thanks for the answer!

Perhaps I should document this better?

That'll be good. 👍 Maybe also suggest user to manually escape these symbols (e.g. <<abstract>>) as a workaround in loose mode.

from mkdocs-mermaid2-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.