aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/sanitizer.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-04-24 14:22:36 +0100
committerGitHub <noreply@github.com>2020-04-24 14:22:36 +0100
commit812cfd0ad9bb85b13ce77f611b3c80dad371d1ef (patch)
treeff3972334966400b18e079c9f488c01cc840a682 /modules/markup/sanitizer.go
parentd3fc9c08c81d8a24ccaaacdb0e6eb0b2619691cf (diff)
downloadgitea-812cfd0ad9bb85b13ce77f611b3c80dad371d1ef.tar.gz
gitea-812cfd0ad9bb85b13ce77f611b3c80dad371d1ef.zip
Use markdown frontmatter to provide Table of contents, language and frontmatter rendering (#11047)
* Add control for the rendering of the frontmatter * Add control to include a TOC * Add control to set language - allows control of ToC header and CJK glyph choice. Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r--modules/markup/sanitizer.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index b5c6dc25f4..95c6eb0dc4 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -56,6 +56,9 @@ func ReplaceSanitizer() {
// Allow classes for task lists
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list`)).OnElements("ul")
+ // Allow icons
+ sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i", "span")
+
// Allow generally safe attributes
generalSafeAttrs := []string{"abbr", "accept", "accept-charset",
"accesskey", "action", "align", "alt",