You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RENDER_COMMAND = pandoc -f markdown -t html --katex
91
91
```
92
92
93
-
You must define `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` in each section.
93
+
You must define `ELEMENT`and `ALLOW_ATTR` in each section.
94
94
95
95
To define multiple entries, add a unique alphanumeric suffix (e.g., `[markup.sanitizer.1]` and `[markup.sanitizer.something]`).
96
96
97
+
To apply a sanitisation rules only for a specify external renderer they must use the renderer name, e.g. `[markup.sanitizer.asciidoc.rule-1]`, `[markup.sanitizer.<renderer>.rule-1]`.
98
+
99
+
**Note**: If the rule is defined above the renderer ini section or the name does not match a renderer it is applied to every renderer.
100
+
97
101
Once your configuration changes have been made, restart Gitea to have changes take effect.
98
102
99
103
**Note**: Prior to Gitea 1.12 there was a single `markup.sanitiser` section with keys that were redefined for multiple rules, however,
100
104
there were significant problems with this method of configuration necessitating configuration through multiple sections.
101
105
106
+
### Example: Office DOCX
107
+
108
+
Display Office DOCX files with [`pandoc`](https://pandoc.org/):
109
+
```ini
110
+
[markup.docx]
111
+
ENABLED = true
112
+
FILE_EXTENSIONS = .docx
113
+
RENDER_COMMAND = "pandoc --from docx --to html --self-contained --template /path/to/basic.html"
114
+
115
+
[markup.sanitizer.docx.img]
116
+
ALLOW_DATA_URI_IMAGES = true
117
+
```
118
+
119
+
The template file has the following content:
120
+
```
121
+
$body$
122
+
```
123
+
124
+
### Example: Jupyter Notebook
125
+
126
+
Display Jupyter Notebook files with [`nbconvert`](https://github.com/jupyter/nbconvert):
127
+
```ini
128
+
[markup.jupyter]
129
+
ENABLED = true
130
+
FILE_EXTENSIONS = .ipynb
131
+
RENDER_COMMAND = "jupyter-nbconvert --stdin --stdout --to html --template basic"
132
+
133
+
[markup.sanitizer.jupyter.img]
134
+
ALLOW_DATA_URI_IMAGES = true
135
+
```
136
+
102
137
## Customizing CSS
103
138
The external renderer is specified in the .ini in the format `[markup.XXXXX]` and the HTML supplied by your external renderer will be wrapped in a `<div>` with classes `markup` and `XXXXX`. The `markup` class provides out of the box styling (as does `markdown` if `XXXXX` is `markdown`). Otherwise you can use these classes to specifically target the contents of your rendered HTML.
0 commit comments