Skip to content

markdown: support rendering Mermaid diagrams - #6776

Merged
unknwon merged 4 commits into
gogs:mainfrom
free1139:feat/mermaid2
Mar 5, 2022
Merged

unknwon merged 4 commits into
gogs:mainfrom
free1139:feat/mermaid2

Conversation

@free1139

@free1139 free1139 commented Feb 20, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 status: waits for QA The changes looks good, just need some sanity check from maintainers and removed status: waits for review labels Mar 4, 2022

@unknwon unknwon left a comment

Copy link
Copy Markdown
Member

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 and removed status: waits for QA The changes looks good, just need some sanity check from maintainers labels Mar 5, 2022
@codecov

codecov Bot commented Mar 5, 2022 •

Copy link
Copy Markdown

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
@duriandrivendesign

Copy link
Copy Markdown

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

unknwon commented Jan 7, 2023

Copy link
Copy Markdown
Member

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
@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

None yet

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