[Customizing Gitea][PlantUML Integration] instructions not working #14746

Open
opened 2025-11-02 11:21:52 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @rejuce on GitHub (Jul 11, 2025).

Description

i followed the guide in Customizing Gitea, to add markdown support for plantUML / digaram generation

i added the scripts to the assets, and modofied footer.tmpl as described

i verfied the assets are reachable and the footer.tmpl is refelcted in frontend.

i added an additonal check
console.log("[PlantUML] footer script running; language‑plantuml count =", $('.language-plantuml').length);

which always returns zero even i added to README.md for example a plantuml section as described

@startuml
Alice -> Bob: Hello!
@enduml

which will be rendered also as normal code section. whats missing so it will be actually be picekd up as language-plantuml

Gitea Version

1.24.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

native go in folder

Database

None

Originally created by @rejuce on GitHub (Jul 11, 2025). ### Description i followed the guide in Customizing Gitea, to add markdown support for plantUML / digaram generation i added the scripts to the assets, and modofied footer.tmpl as described i verfied the assets are reachable and the footer.tmpl is refelcted in frontend. i added an additonal check console.log("[PlantUML] footer script running; language‑plantuml count =", $('.language-plantuml').length); which always returns zero even i added to README.md for example a plantuml section as described ```plantuml @startuml Alice -> Bob: Hello! @enduml ``` which will be rendered also as normal code section. whats missing so it will be actually be picekd up as language-plantuml ### Gitea Version 1.24.2 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? native go in folder ### Database None
GiteaMirror added the type/bugissue/workaround labels 2025-11-02 11:21:52 -06:00
Author
Owner

@rejuce commented on GitHub (Jul 11, 2025):

any time later on in browser shell
document.querySelectorAll('pre > code.language-plantuml').length
yiels 1 for example

while at the time the footer script is executed code.language-plantuml')lenght = 0

@rejuce commented on GitHub (Jul 11, 2025): any time later on in browser shell document.querySelectorAll('pre > code.language-plantuml').length yiels 1 for example while at the time the footer script is executed code.language-plantuml')lenght = 0
Author
Owner

@aboutrax commented on GitHub (Aug 20, 2025):

in my case, I have resolved this problem by:

  1. cloning plantuml-code-highlight inside $GITEA_CUSTOM/public/assets/
  2. create footer.tmpl inside $GITEA_CUSTOM/templates/custom
<script>
  $(async () => {
    if (!$('.language-plantuml').length) return;
    await Promise.all([
      $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/deflate.js'),
      $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/encode.js'),
      $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/plantuml_codeblock_parse.js'),
    ]);
    // Replace call with address to your plantuml server
    parsePlantumlCodeBlocks("https://www.plantuml.com/plantuml");
  });
</script>

you must ensure https://your-gitea-server.com/assets/plantuml-code-highlight/{deflate.js,encode.js,plantuml_codeblock_parse.js} return the file content
3. change ownership to git user and permission

chown git:git $GITEA_CUSTOM/templates/custom/footer.tmpl
chmod 770 $GITEA_CUSTOM/templates/custom/footer.tmpl
chown -R git:git $GITEA_CUSTOM/public

After these, I have restarted the docker container. My current version is 1.24.5.

@aboutrax commented on GitHub (Aug 20, 2025): in my case, I have resolved this problem by: 1. cloning [plantuml-code-highlight](https://gitea.com/davidsvantesson/plantuml-code-highlight) inside `$GITEA_CUSTOM/public/assets/` 2. create `footer.tmpl` inside `$GITEA_CUSTOM/templates/custom` ```js <script> $(async () => { if (!$('.language-plantuml').length) return; await Promise.all([ $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/deflate.js'), $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/encode.js'), $.getScript('https://your-gitea-server.com/assets/plantuml-code-highlight/plantuml_codeblock_parse.js'), ]); // Replace call with address to your plantuml server parsePlantumlCodeBlocks("https://www.plantuml.com/plantuml"); }); </script> ``` you must ensure `https://your-gitea-server.com/assets/plantuml-code-highlight/{deflate.js,encode.js,plantuml_codeblock_parse.js}` return the file content 3. change ownership to `git` user and permission ```sh chown git:git $GITEA_CUSTOM/templates/custom/footer.tmpl chmod 770 $GITEA_CUSTOM/templates/custom/footer.tmpl chown -R git:git $GITEA_CUSTOM/public ``` After these, I have restarted the docker container. My current version is `1.24.5`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14746