Skip to content

Commit 58e779a

Browse files
committed
Update documentation
Signed-off-by: Alexander Scheel <[email protected]>
1 parent 9588d2c commit 58e779a

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

custom/conf/app.ini.sample

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,10 @@ SHOW_FOOTER_VERSION = true
963963
; Show template execution time in the footer
964964
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
965965

966-
[markup.sanitizer]
967-
; The following keys can be used multiple times to define sanitation policy rules.
966+
[markup.sanitizer.1]
967+
; The following keys can appear once to define a sanitation policy rule.
968+
; This section can appear with an incremenented number to define multiple rules.
969+
; e.g., [markup.sanitizer.1] -> [markup.sanitizer.2]
968970
;ELEMENT = span
969971
;ALLOW_ATTR = class
970972
;REGEXP = ^(info|warning|error)$

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ Two special environment variables are passed to the render command:
646646
Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
647647

648648
```ini
649-
[markup.sanitizer]
649+
[markup.sanitizer.1]
650650
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
651651
; with "inline" or "display" classes depending on context.
652652
ELEMENT = span
@@ -658,7 +658,11 @@ REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
658658
- `ALLOW_ATTR`: The attribute this policy allows. Must be non-empty.
659659
- `REGEXP`: A regex to match the contents of the attribute against. Must be present but may be empty for unconditional whitelisting of this attribute.
660660

661-
You may redefine `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` multiple times; each time all three are defined is a single policy entry.
661+
You must define `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` in each numbered section.
662+
663+
To define multiple entries, increment the number in the section (e.g., `[markup.sanitizer.1]` and `[markup.sanitizer.2]`).
664+
665+
**Note**: The above section numbering policy is new; previously the section was `[markup.sanitizer]` and keys could be redefined.
662666

663667
## Time (`time`)
664668

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ IS_INPUT_FILE = false
7373
If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizier. The example below will support [KaTeX](https://katex.org/) output from [`pandoc`](https://pandoc.org/).
7474

7575
```ini
76-
[markup.sanitizer]
76+
[markup.sanitizer.1]
7777
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
7878
; with "inline" or "display" classes depending on context.
7979
ELEMENT = span
@@ -86,6 +86,10 @@ FILE_EXTENSIONS = .md,.markdown
8686
RENDER_COMMAND = pandoc -f markdown -t html --katex
8787
```
8888

89-
You may redefine `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` multiple times; each time all three are defined is a single policy entry. All three must be defined, but `REGEXP` may be blank to allow unconditional whitelisting of that attribute.
89+
You must define `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` in each numbered section.
90+
91+
To define multiple entries, increment the number in the section (e.g., `[markup.sanitizer.1]` and `[markup.sanitizer.2]`).
9092

9193
Once your configuration changes have been made, restart Gitea to have changes take effect.
94+
95+
**Note**: The above section numbering policy is new; previously the section was `[markup.sanitizer]` and keys could be redefined.

0 commit comments

Comments
 (0)