-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add documentation to add Mermaid.js to Gitea #9872
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
Conversation
} | ||
``` | ||
|
||
If you want Mermaid.js outside of markdown you would move the above script tags to just after the scripts loading jquery. Mermaid will detect and use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outside markdown, what does that mean? If you have html or other external render?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you write html files or want to use it in your templates
<script>mermaid.init(".language-mermaid")</script> | ||
``` | ||
|
||
to `footer.tmpl` within the `{{if .RequireHighlightJS}}...{{end}}` block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better with a tmpl within the custom
folder. Add a new custom/extra_highlight.tmpl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the site admin has to place this code within base/footer.tmpl
it would require to be updated in case of other changes. Better to have a specific custom file for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok it turns out that it being in custom/footer.tmpl doesn't break anything. It just means that it needs to be loaded everytime I guess we could stick a {{if .RequirHighlightJS}}....{{end}}
around it?
Codecov Report
@@ Coverage Diff @@
## master #9872 +/- ##
=========================================
Coverage ? 42.31%
=========================================
Files ? 605
Lines ? 79313
Branches ? 0
=========================================
Hits ? 33563
Misses ? 41609
Partials ? 4141 Continue to review full report at Codecov.
|
@@ -100,6 +100,45 @@ Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful temp | |||
- `body_outer_post.tmpl`, before the bottom `<footer>` element. | |||
- `footer.tmpl`, right before the end of the `<body>` tag, a good place for additional Javascript. | |||
|
|||
#### Example: Mermaid.js | |||
|
|||
If you would like to add [mermaid.js](https://mermaid-js.github.io/) support to Gitea's markdown you simply add: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, this link is already 404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be https://mermaid-js.github.io/mermaid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bloody hell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've sent another PR
Add documentation to https://docs.gitea.io/en-us/customizing-gitea/ to show how to add Mermaid.js to Gitea.
Relevant #3340
Relevant #9553