Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mermaid2 diagrams with annotations shows half the (+) button and nothing happens when you click it #88

Closed
elgalu opened this issue Sep 9, 2023 · 9 comments
Labels
mermaid-js This isssue relates to the mermaid javascript library mkdocs-material This issue is connected with the mkdocs-material API

Comments

@elgalu
Copy link

elgalu commented Sep 9, 2023

Hi, thanks a lot for this plugin, it's extremely useful<3

The mkdocs.yml -> features: content.code.annotate almost works except that the button is half-visible and more importantly click doesn't trigger the annotation even with securityLevel: loose

Please find a minimal working example with code at:
Demo: https://elgalu.github.io/mermaid2-content.code.annotate/
Code: https://github.com/elgalu/mermaid2-content.code.annotate/

@fralau
Copy link
Owner

fralau commented Sep 21, 2023

Thanks for your message. I am not sure what I can do from my level of expertise, since the plugin merely calls the mermaid.js library.

But looking at the HTML page actually generated, I see something a bit weird in it:

<div class="highlight"><pre><span></span><code>&lt;div class="annotate" markdown&gt;
<span class="sb">```mermaid</span>
<span class="s">graph TD</span>
<span class="s">A[Client (1)] --&gt; B[Server]</span>
<span class="sb">```</span>
&lt;/div&gt;

At least, we have a clue on why the tag is not executed.

One thing I might advise you (just in case) would be to skip a line between the div and the triple quotes:

 <div class="annotate" markdown>

```mermaid
 graph TD
 A[Client (1)] --> B[Server]
 ```
 </div>

@elgalu
Copy link
Author

elgalu commented Sep 21, 2023

Thanks. Yeah I tried all sort of combinations wrt adding/removing between the div and the triple quotes.

@fralau fralau added mermaid-js This isssue relates to the mermaid javascript library mkdocs-material This issue is connected with the mkdocs-material API labels Sep 26, 2023
@fralau
Copy link
Owner

fralau commented Sep 26, 2023

If you remove the <div>, it will work, right?

Here is what I would do, if I were you: deactivate the mermaid2 plugin, and then see if you see the same anomaly in the HTML generated (i.e. the HTML markers are transformed into entities)?

Do that while keeping the mermaid2 custom-fence; and then change it to the standard recommended for Material. That should give us more information on where the problem comes from.

@elgalu
Copy link
Author

elgalu commented Sep 26, 2023

Thanks, added to the demo Without the div, annotate does nothing

@fralau
Copy link
Owner

fralau commented Sep 26, 2023

The point now is to determine who could help you since it is a "holistic" problem of multiple interactions that involves:

  • Annotate extension
  • Material theme
  • Mermaid2 plugin
  • mermaid.js
  • and mkdocs itself.

So, where does the problem come from?

Perhaps a problem to be discussed on mkdocs/community?

@elgalu
Copy link
Author

elgalu commented Sep 26, 2023

yeah I also raised it at mermaid-js/mermaid#4865

@fralau
Copy link
Owner

fralau commented Sep 26, 2023

Here is @squidfunk's advice on the community room:

Annotations are not supported in Mermaid diagrams.
Reason: with Mermaid, you're in SVG space, which has entirely different layout and positioning semantics than HTML. It is probably possible to make it work, but from my research trying to make tooltips work in SVG, it's quite an effort.

@fralau
Copy link
Owner

fralau commented Sep 26, 2023

Should we consider this an issue or a discussion?

@elgalu
Copy link
Author

elgalu commented Sep 26, 2023

yes, we can keep it in the community room, closing.

@elgalu elgalu closed this as completed Sep 26, 2023
Repository owner locked and limited conversation to collaborators Sep 26, 2023
@fralau fralau converted this issue into discussion #91 Sep 26, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
mermaid-js This isssue relates to the mermaid javascript library mkdocs-material This issue is connected with the mkdocs-material API
Projects
None yet
Development

No branches or pull requests

2 participants