Javascript necessary to render plantuml from content in a html-block of class "language-plantuml". Possible to use with Gitea.
Go to file
Llewellyn van der Merwe a3076b707a
Update the deflate script. Converted the parse script. Update README.
2022-08-22 13:08:02 +02:00
README.md Update the deflate script. Converted the parse script. Update README. 2022-08-22 13:08:02 +02:00
deflate.js Update the deflate script. Converted the parse script. Update README. 2022-08-22 13:08:02 +02:00
encode.js Javascripts from plantuml and first test 2020-01-19 22:49:21 +01:00
plantuml.js Update the deflate script. Converted the parse script. Update README. 2022-08-22 13:08:02 +02:00

README.md

PlantUML

Javascript necessary to render PlantUML from content in a html-block of class "language-uml".

With help to get this to work on Gitea.

Install

Copy the javascript files to your server. Then to convert all html blocks having the class language-uml add the following to the html page:

<script src="https://your-server.com/deflate.js"></script>
<script src="https://your-server.com/encode.js"></script>
<script src="https://your-server.com/plantuml.js"></script>
<script>
plantUML("http://www.plantuml.com/plantuml")
</script>

Specifically for Gitea

Copy the javascript files to your custom/public folder. Then place the following code in custom/templates/custom/footer.tmpl:

<script>
  $(async () => {
    if (!$('.language-uml').length) return;
    await Promise.all([
      $.getScript('https://your-server.com/deflate.js'), 
      $.getScript('https://your-server.com/encode.js'),
      $.getScript('https://your-server.com/plantuml.js'),
    ]);
    // Replace call with address to your plantuml server
    plantUML("http://www.plantuml.com/plantuml");
  });
</script>

How to use in GITEA

You add a normal code block with 3 backticks ``` but then add to the opening uml like this: ```uml

Example:

```uml
@startuml
(*) --> "Initialization"

if "Some Test" then
  -->[true] "Some Action"
  --> "Another Action"
  -right-> (*)
else
  ->[false] "Something else"
  -->[Ending process] (*)
endif

@enduml
```

Output:

@startuml
(*) --> "Initialization"

if "Some Test" then
  -->[true] "Some Action"
  --> "Another Action"
  -right-> (*)
else
  ->[false] "Something else"
  -->[Ending process] (*)
endif

@enduml

License