summaryrefslogtreecommitdiffstats
path: root/modules/markup/sanitizer.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-13 02:05:50 +0100
committerGitHub <noreply@github.com>2020-12-13 09:05:50 +0800
commit41e8b834afbd0c98a8ab4549a90a6bce0ec7096f (patch)
tree67e3a2de682b8884af5befeaa47b1924aa83fbd3 /modules/markup/sanitizer.go
parent287b594803105ba517680aa50be478648d434035 (diff)
downloadgitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.tar.gz
gitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.zip
Markdown task list improvements (#13952)
* Markdown task list improvements - Remove `.ui` class and wrappers to prevent fomantic from messing with it. - Change rendered HTML to match GitHub. - Add custom styling for the checkboxes. * fix unittest Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r--modules/markup/sanitizer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index ba73650bdf..9214a75fb3 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -43,7 +43,7 @@ func ReplaceSanitizer() {
// Checkboxes
sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")
- sanitizer.policy.AllowAttrs("checked", "disabled", "readonly").OnElements("input")
+ sanitizer.policy.AllowAttrs("checked", "disabled").OnElements("input")
// Custom URL-Schemes
sanitizer.policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)
@@ -66,8 +66,8 @@ func ReplaceSanitizer() {
// Allow classes for emojis
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`emoji`)).OnElements("img")
- // Allow icons, checkboxes, emojis, and chroma syntax on span
- sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(ui checkbox)|(ui checked checkbox)|(emoji))$|^([a-z][a-z0-9]{0,2})$`)).OnElements("span")
+ // Allow icons, emojis, and chroma syntax on span
+ sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji))$|^([a-z][a-z0-9]{0,2})$`)).OnElements("span")
// Allow generally safe attributes
generalSafeAttrs := []string{"abbr", "accept", "accept-charset",