Skip to content
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

Desktop,Mobile: Fixes #10785: Fix math is invisible in certain mermaid diagrams #10820

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Aug 3, 2024

Summary

The upgrade Mermaid to v10.9.1 included support for math expressions in mermaid diagrams.

Joplin renders Mermaid diagrams within <pre>s which have white-space: pre by default. This breaks math expressions in certain diagrams. A previous commit partially fixed this for sequence diagrams (see comment). However, the change doesn't seem sufficient to fix the issue for all sequence diagrams (or perhaps even most? See #10785.).

Resetting the white-space to unset directly on the <pre>, rather than on its direct <svg> descendants seems to fix the issue for the sequence diagram provided in #10785.

Fixes #10785.

Screenshot

screenshot: A mermaid diagram with five boxes and two labelled arrows. The arrows are both labelled with math and each box contains a rendered math expression

Testing plan

  1. Create a new note.
  2. Copy the Mermaid code block for the sequence diagram provided in bug of rendering a mermaid graph #10785 (using markdown GitHub's "quote reply" option).
  3. Verify that math expressions are visible in the rendered note.

This has been tested successfully on Ubuntu 24.04.

@laurent22 laurent22 merged commit 19af6a8 into laurent22:dev Aug 3, 2024
10 checks passed
@idealkindom
Copy link

Summary

The upgrade Mermaid to v10.9.1 included support for math expressions in mermaid diagrams.

Joplin renders Mermaid diagrams within \<pre\>s which have white-space: pre by default. This breaks math expressions in certain diagrams. A previous commit partially fixed this for sequence diagrams (see comment). However, the change doesn't seem sufficient to fix the issue for all sequence diagrams (or perhaps even most? See #10785.).

Resetting the white-space to unset directly on the \<pre\>, rather than on its direct <svg> descendants seems to fix the issue for the sequence diagram provided in #10785.

Fixes #10785.

Screenshot

screenshot: A mermaid diagram with five boxes and two labelled arrows. The arrows are both labelled with math and each box contains a rendered math expression

Testing plan

1. Create a new note.

2. Copy the Mermaid code block for the sequence diagram provided in [bug of rendering a mermaid graph #10785](https://github.com/laurent22/joplin/issues/10785) (using markdown GitHub's "quote reply" option).

3. Verify that math expressions are visible in the rendered note.

This has been tested successfully on Ubuntu 24.04.

Hey. I tried the latest Joplin 3.1.4, it looks that this problem still persist in ver 3.1.4. The string of overall style setting works some how. However when I switch the editor mode I found the bug is still there. And when I try to download the graph in svg, some greek letters were lost. However, if I store the graph in png, it works well.

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.

bug of rendering a mermaid graph
3 participants