Skip to content

Commit 367a234

Browse files
committed
Add mermaid JS renderer
For feature parity with GitLab. Tested in files, issues, wiki, editor. arc-green only does an inversion because the renderer seems to like to render white backgrounds on boxes. Ref: #3340 Fixes: #12307
1 parent 415fc82 commit 367a234

File tree

9 files changed

+518
-41
lines changed

9 files changed

+518
-41
lines changed

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -108,45 +108,6 @@ Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful temp
108108
- `body_outer_post.tmpl`, before the bottom `<footer>` element.
109109
- `footer.tmpl`, right before the end of the `<body>` tag, a good place for additional Javascript.
110110

111-
#### Example: Mermaid.js
112-
113-
If you would like to add [mermaid.js](https://mermaid-js.github.io/mermaid) support to Gitea's markdown you simply add:
114-
115-
```html
116-
{{if .RequireHighlightJS}}
117-
<script src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script>
118-
<!-- or wherever you have placed it -->
119-
<script>mermaid.init(".language-mermaid")</script>
120-
{{end}}
121-
```
122-
123-
to `custom/footer.tmpl`. You then can add blocks
124-
like below to your markdown:
125-
126-
```mermaid
127-
stateDiagram
128-
[*] --> Active
129-
130-
state Active {
131-
[*] --> NumLockOff
132-
NumLockOff --> NumLockOn : EvNumLockPressed
133-
NumLockOn --> NumLockOff : EvNumLockPressed
134-
--
135-
[*] --> CapsLockOff
136-
CapsLockOff --> CapsLockOn : EvCapsLockPressed
137-
CapsLockOn --> CapsLockOff : EvCapsLockPressed
138-
--
139-
[*] --> ScrollLockOff
140-
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
141-
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
142-
}
143-
```
144-
145-
If you want to use Mermaid.js outside of markdown, e.g. in other templates or HTML files,
146-
you would need to remove `{{if .RequireHighlightJS}}` and `{{end}}`.
147-
148-
Mermaid will detect and use tags with `class="language-mermaid"`.
149-
150111
#### Example: PlantUML
151112

152113
You can add [PlantUML](https://plantuml.com/) support to Gitea's markdown by using a PlantUML server.

0 commit comments

Comments
 (0)