From 9bc841353464049080a5bd0fffa433fd8ba09930 Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Tue, 21 Jan 2020 00:34:23 +0100 Subject: [PATCH] Add documentation how to render PlantUML in code blocks. (#9894) * Add documentation how to render plantuml in code blocks. * Review comments * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: zeripath --- .../doc/advanced/customizing-gitea.en-us.md | 36 ++++++++++++++++++- .../doc/advanced/external-renderers.en-us.md | 2 ++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index 50ef1293a6..f42ade7799 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -18,7 +18,8 @@ menu: Customizing Gitea is typically done using the `CustomPath` folder - by default this is the `custom` folder from the running directory, but may be different if your build has set this differently. This is the central place to override configuration settings, -templates, etc. You can check the `CustomPath` using `gitea help`. You can override +templates, etc. You can check the `CustomPath` using `gitea help`. You can also find +the path on the _Configuration_ tab in the _Site Administration_ page. You can override the `CustomPath` by setting either the `GITEA_CUSTOM` environment variable or by using the `--custom-path` option on the `gitea` binary. (The option will override the environment variable.) @@ -139,6 +140,39 @@ you would need to remove `{{if .RequireHighlightJS}}` and `{{end}}`. Mermaid will detect and use tags with `class="language-mermaid"`. +#### Example: PlantUML + +You can add [PlantUML](https://plantuml.com/) support to Gitea's markdown by using a PlantUML server. +The data is encoded and sent to the PlantUML server which generates the picture. There is an online +demo server at http://www.plantuml.com/plantuml, but if you (or your users) have sensitive data you +can set up your own [PlantUML server](https://plantuml.com/server) instead. To set up PlantUML rendering, +copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highlight and put them in your +`custom/public` folder. Then add the following to `custom/footer.tmpl`: + +```html +{{if .RequireHighlightJS}} + + + + +{{end}} +``` + +You can then add blocks like the following to your markdown: + + ```plantuml + Alice -> Bob: Authentication Request + Bob --> Alice: Authentication Response + + Alice -> Bob: Another authentication Request + Alice <-- Bob: Another authentication Response + ``` + +The script will detect tags with `class="language-plantuml"`, but you can change this by providing a second argument to `parsePlantumlCodeBlocks`. + ## Customizing Gitea mails The `custom/templates/mail` folder allows changing the body of every mail of Gitea. diff --git a/docs/content/doc/advanced/external-renderers.en-us.md b/docs/content/doc/advanced/external-renderers.en-us.md index ec1ee63fb6..2d8945d005 100644 --- a/docs/content/doc/advanced/external-renderers.en-us.md +++ b/docs/content/doc/advanced/external-renderers.en-us.md @@ -22,6 +22,8 @@ it is just a matter of: * add some configuration to your `app.ini` file * restart your Gitea instance +This supports rendering of whole files. If you want to render code blocks in markdown you would need to do something with javascript. See some examples on the [Customizing Gitea](../customizing-gitea) page. + ## Installing external binaries In order to get file rendering through external binaries, their associated packages must be installed.