Plantuml not rendering in Readme only in Issues and Wiki #8712

Closed
opened 2025-11-02 08:15:17 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @lukaskwkw on GitHub (Mar 16, 2022).

Gitea Version

1.16.4

Git Version

2.30.2

Operating System

Windows 11

How are you running Gitea?

Docker image

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

PlantUML rendering is only working in Issues & Wiki. Not in README.md files.

I.e. using code in README.md

```plantuml
@startuml
Bob -> Alice : hello
@enduml
```

will generate <code> block with language-plantuml class but won't render any content in if body

{{if .RequireHighlightJS}}
nothing here
{{end}}

I was able to workaround this by adding PageIsViewCode condition into if statement from docs example:
https://docs.gitea.io/en-us/customizing-gitea/#example-plantuml

{{if or .PageIsViewCode .RequireHighlightJS}}

It might be similar to https://github.com/go-gitea/gitea/issues/12307

Screenshots

with single RequireHighlightJS condition
obraz
with addtional PageIsViewCode condition
obraz

Originally created by @lukaskwkw on GitHub (Mar 16, 2022). ### Gitea Version 1.16.4 ### Git Version 2.30.2 ### Operating System Windows 11 ### How are you running Gitea? Docker image ### Database PostgreSQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description PlantUML rendering is only working in Issues & Wiki. Not in README.md files. I.e. using code in README.md ` ```plantuml` `@startuml` `Bob -> Alice : hello` `@enduml` ` ``` ` will generate `<code>` block with ` language-plantuml` class but won't render any content in if body ```go {{if .RequireHighlightJS}} nothing here {{end}} ``` I was able to workaround this by adding `PageIsViewCode ` condition into if statement from docs example: https://docs.gitea.io/en-us/customizing-gitea/#example-plantuml ```go {{if or .PageIsViewCode .RequireHighlightJS}} ``` It might be similar to https://github.com/go-gitea/gitea/issues/12307 ### Screenshots with single `RequireHighlightJS` condition ![obraz](https://user-images.githubusercontent.com/12010980/158662468-fc9a2039-9427-4808-9d3a-7345f6936b7b.png) with addtional `PageIsViewCode ` condition ![obraz](https://user-images.githubusercontent.com/12010980/158662784-cc3752ff-15b0-4e4c-a41a-2bd1958ac57c.png)
GiteaMirror added the type/bug label 2025-11-02 08:15:17 -06:00
Author
Owner

@silverwind commented on GitHub (Mar 16, 2022):

We should probably remove RequireHighlightJS and instead suggest to always just call parsePlantumlCodeBlocks. We're not even using higlight.js anymore.

@silverwind commented on GitHub (Mar 16, 2022): We should probably remove `RequireHighlightJS` and instead suggest to always just call `parsePlantumlCodeBlocks`. We're not even using higlight.js anymore.
Author
Owner

@zeripath commented on GitHub (Mar 17, 2022):

We should probably remove RequireHighlightJS and instead suggest to always just call parsePlantumlCodeBlocks. We're not even using higlight.js anymore.

Yeah I suspect we should just drop the RequireHighlightJS things from our templates.

@lukaskwkw you should be fine to just remove the requirement on the RequireHighlightJS from your pages - an alternative option might be to also detect IsMarkup in addition to RequireHightlightJs and perhaps we should migrate all places that use RequireHighlightJS to IsMarkup instead.

@zeripath commented on GitHub (Mar 17, 2022): > We should probably remove `RequireHighlightJS` and instead suggest to always just call `parsePlantumlCodeBlocks`. We're not even using higlight.js anymore. Yeah I suspect we should just drop the RequireHighlightJS things from our templates. @lukaskwkw you should be fine to just remove the requirement on the RequireHighlightJS from your pages - an alternative option might be to also detect IsMarkup in addition to RequireHightlightJs and perhaps we should migrate all places that use RequireHighlightJS to IsMarkup instead.
Author
Owner

@lunny commented on GitHub (Mar 19, 2022):

Looks like RequireHighlightJS could be removed, no standard template use that now.

@lunny commented on GitHub (Mar 19, 2022): Looks like `RequireHighlightJS` could be removed, no standard template use that now.
Author
Owner

@lunny commented on GitHub (Mar 19, 2022):

IsMarkup is still not accurate. We need to detect all markdown sections which has plantuml code blocks.

@lunny commented on GitHub (Mar 19, 2022): `IsMarkup` is still not accurate. We need to detect all markdown sections which has `plantuml` code blocks.
Author
Owner

@silverwind commented on GitHub (Mar 21, 2022):

I think JS should just execute document.querySelectorAll('language-plantuml') only, no need to hand-hold it via template variables. Scripts will need to lazy-loaded by JS that way.

@silverwind commented on GitHub (Mar 21, 2022): I think JS should just execute `document.querySelectorAll('language-plantuml')` only, no need to hand-hold it via template variables. Scripts will need to lazy-loaded by JS that way.
Author
Owner

@zeripath commented on GitHub (Mar 23, 2022):

@silverwind do you want to propose a documentation update PR?

@zeripath commented on GitHub (Mar 23, 2022): @silverwind do you want to propose a documentation update PR?
Author
Owner

@silverwind commented on GitHub (Mar 23, 2022):

Yes, once I figure out something that works.

@silverwind commented on GitHub (Mar 23, 2022): Yes, once I figure out something that works.
Author
Owner

@wxiaoguang commented on GitHub (May 5, 2022):

@lukaskwkw try this one (the example works for 1.16.x)

And please help to report or fix potential problems in it.

@wxiaoguang commented on GitHub (May 5, 2022): @lukaskwkw try this one (the example works for 1.16.x) * #19615 And please help to report or fix potential problems in it.
Author
Owner

@lunny commented on GitHub (May 5, 2022):

Since it's a break change, maybe we don't need to back port to v1.16

@lunny commented on GitHub (May 5, 2022): Since it's a break change, maybe we don't need to back port to v1.16
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8712