Skip to content

Commit 4315e31

Browse files
silverwindlunnytechknowlogick
authored
Add mermaid JS renderer (#12334)
* 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 * add feature entry, switch to neutral theme, remove border * add bindFunctions support * remove unnecessary border-radius Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 46ef562 commit 4315e31

File tree

10 files changed

+521
-41
lines changed

10 files changed

+521
-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.

docs/content/page/index.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
128128
- Environment variables
129129
- Command line options
130130
- Multi-language support ([21 languages](https://github.com/go-gitea/gitea/tree/master/options/locale))
131+
- [Mermaid](https://mermaidjs.github.io/) Diagram support
131132
- Mail service
132133
- Notifications
133134
- Registration confirmation

0 commit comments

Comments
 (0)