Skip to content

markdown: support rendering Mermaid diagrams #6776

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

Merged
merged 4 commits into from
Mar 5, 2022

Conversation

free1139
Copy link
Contributor

@free1139 free1139 commented Feb 20, 2022

Trying to support mermaid issue #4229, #6630

I found that need to ran make not go build to took effect.
make generate && make build for build.

Test the mermaid's diagrams were passed.

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```
```mermaid
sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts <br/>prevail!
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!
```

The renderings
image

@free1139 free1139 mentioned this pull request Feb 20, 2022
@free1139
Copy link
Contributor Author

The the plug-in size has a little big. I don't know why the browser cache doesn't work yet.

image

@unknwon unknwon changed the title add mermaid support Support rendering mermaid in Markdown Mar 4, 2022
@unknwon unknwon self-requested a review March 4, 2022 09:39
@unknwon unknwon added status: waits for review It is waiting to be reviewed by maintainers status: waits for QA The changes looks good, just need some sanity check from maintainers and removed status: waits for review It is waiting to be reviewed by maintainers labels Mar 4, 2022
Copy link
Member

@unknwon unknwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The changes LGTM, I just need to pull down do a sanity check locally.

@unknwon unknwon added status: reviewed It has been reviewed by maintainers and removed status: waits for QA The changes looks good, just need some sanity check from maintainers labels Mar 5, 2022
@codecov
Copy link

codecov bot commented Mar 5, 2022

Codecov Report

Merging #6776 (9378741) into main (8a1a40c) will increase coverage by 0.01%.
The diff coverage is n/a.

@@           Coverage Diff            @@
##            main   #6776      +/-   ##
========================================
+ Coverage   8.79%   8.80%   +0.01%     
========================================
  Files         97      97              
  Lines      13208   13208              
========================================
+ Hits        1161    1163       +2     
+ Misses     11885   11884       -1     
+ Partials     162     161       -1     

@unknwon unknwon changed the title Support rendering mermaid in Markdown Support rendering Mermaid diagrams in Markdown Mar 5, 2022
@unknwon unknwon changed the title Support rendering Mermaid diagrams in Markdown markdown: support rendering Mermaid diagrams Mar 5, 2022
@unknwon unknwon merged commit 7c893a5 into gogs:main Mar 5, 2022
@albetech
Copy link

albetech commented Jan 6, 2023

This feature looks so incredible I tried to find a way to use it for a few hours, but it didn't work for me.

Can you please hint me on how to enable it, if it's disabled? I tried version 0.11, 0.12.10, 0.13-dev, but none of them seem to react to mermaid syntax like illustrated in the first comment in this thread:

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

@unknwon
Copy link
Member

unknwon commented Jan 7, 2023

Hey @albetech - I just did some quick tests against 0.13.0+dev and confirm that mermaid currently only works for markdown files (i.e. doesn't render for issue and its comments), also "Preview" would still display as code block, I had to save and see the rendered diagram.

CleanShot 2023-01-07 at 16 32 58@2x

CleanShot 2023-01-07 at 16 33 08@2x

dna2github pushed a commit to dna2fork/gogs that referenced this pull request May 1, 2023
Co-authored-by: Joe Chen <jc@unknwon.io>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: reviewed It has been reviewed by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supports Textual UML Diagrams in the markdown editor instead of picture reference
3 participants