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

Supports Textual UML Diagrams in the markdown editor instead of picture reference #4229

Closed
baikangwang opened this issue Mar 3, 2017 · 4 comments · Fixed by #6776
Closed
Labels
🎯 feature Categorizes as related to a new feature

Comments

@baikangwang
Copy link

baikangwang commented Mar 3, 2017

The Textual UML Diagrams draws simple SVG UML chart diagram from textual representation of the diagram. take the flow chart for example,
In the markdown editor such as issue comments and wiki pages typed the below textual code,

st=>start: Start
e=>end: End
op1=>operation: My Operation
sub1=>subroutine: My Subroutine
cond=>condition: Yes or No?
io=>inputoutput: catch something...

st->op1->cond
cond(yes)->io->e
cond(no)->sub1(right)->op1

then they would be rendered as a simple SVG flow chart diagram when the page showed up

flow chart diagram

It's cooool feature! I could post UML diagrams to project wiki without any image reference if gogs was able to support it. Currently I had to setup an external images website to provide image links for gogs wiki.

The feature can be introduced as plugins into gogs, see below reference for details,

sequence: Turns text into UML sequence diagrams
flowchart: Draws simple SVG flow chart diagrams from textual representation of the diagram
mermaid: A simple markdown-like script language for generating charts from text via javascript

I am using Typora as off-line markdown editor which already supports this feature, and now I was expecting to post its output completely to gogs wiki if gogs supported as well.

Thanks a lot for team! Thanks for your good job!

@unknwon unknwon changed the title [Feature Request] - Supports Textual UML Diagrams in the markdown editor instead of picture reference Supports Textual UML Diagrams in the markdown editor instead of picture reference Mar 3, 2017
@unknwon unknwon added 🎯 feature Categorizes as related to a new feature priority: maybe You know what, it sounds good labels Mar 3, 2017
@terzinnorbert
Copy link

I had a quick solution for that. Add the following lines to templates/inject/head.tmpl:

<script src="https://unpkg.com/mermaid@8.0.0-rc.8/dist/mermaid.min.js"></script>
<script>
    $(document).ready(function() {
        mermaid.init({noteMargin: 10}, ".language-mermaid");
    });
</script>

and restart the service

@jianblog
Copy link

Gogs version 0.11.86.0130

after add above scripts into templates/inject/head.tmpl, and restart gogs web.

then edit an markdown file or issue:

st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end

st->op->cond
cond(yes)->e
cond(no)->op

but nothing happens when preview or save. If these steps right?

@ghost
Copy link

ghost commented Mar 9, 2020

Gogs version 0.11.86.0130

after add above scripts into templates/inject/head.tmpl, and restart gogs web.

then edit an markdown file or issue:

st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end

st->op->cond
cond(yes)->e
cond(no)->op

but nothing happens when preview or save. If these steps right?

According to the solution @terzinnorbert posted, he imported the mermaid (a nice opensource textual UML tool) library into gogs.
So you need to follow mermaid syntax like:

graph TD:
    A-->B;
    B-->C;
    C-->D;

For more information, please visit https://mermaid-js.github.io/mermaid/#/README.

It works perfectly for me.

@free1139
Copy link
Contributor

@unknwon
Could you take a look is the #6630 right when you have time?
I test it base on v0.12.3 cause the main code can't run in my old repository.

@unknwon unknwon linked a pull request Mar 5, 2022 that will close this issue
@unknwon unknwon removed the priority: maybe You know what, it sounds good label Mar 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🎯 feature Categorizes as related to a new feature
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants