question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Annotations in class diagram not working with SuperFences

See original GitHub issue

Source:

classDiagram
  class Foo
  <<abstract>> Foo

Expected:

classDiagram
  class Foo
  <<abstract>> Foo

Actual:

image

Here’s the mkdocs.yml, if I disable SuperFences it works as expected.

site_name: Test

docs_dir: docs

plugins:
  - mermaid2

markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid

mkdocs==1.3.1 mkdocs-mermaid2-plugin==0.6.0 pymdown-extensions==9.5

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
guanssscommented, Aug 31, 2022

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?

0reactions
guanssscommented, Sep 1, 2022

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. &lt;&lt;abstract&gt;&gt;) as a workaround in loose mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modelling java annotations in an UML class diagram
If it is a design model that aims to communicate the big picture, it would be advisable not to show any annotations: these...
Read more >
Can I write comments in UML Class diagram? - Stack Overflow
A comment is a textual annotation that can be attached to a set of elements. ... if it is clear from the context,...
Read more >
Annotations - Material for MkDocs
When SuperFences is enabled, annotations can be nested inside annotations by adding the annotate class to the list item hosting the annotation content, ......
Read more >
Suppress Java Annotations in Class Diagram
I'm on Mac OS X. Command + f brings up the list you mention but selecting an item in the list and pressing...
Read more >
All the UML you need to know
I'm not going to invest the time in reiterating the same content here, since you have it in your notes already. Class Diagrams....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found