aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/sanitizer.go3
-rw-r--r--modules/markup/sanitizer_test.go5
2 files changed, 8 insertions, 0 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index 9f97f1d5b1..48c08831f1 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -96,6 +96,9 @@ func createDefaultPolicy() *bluemonday.Policy {
// Allow classes for task lists
policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list-item`)).OnElements("li")
+ // Allow classes for org mode list item status.
+ policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(unchecked|checked|indeterminate)$`)).OnElements("li")
+
// Allow icons
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i")
diff --git a/modules/markup/sanitizer_test.go b/modules/markup/sanitizer_test.go
index 4d85cbf9f3..0bc63ff0a7 100644
--- a/modules/markup/sanitizer_test.go
+++ b/modules/markup/sanitizer_test.go
@@ -53,6 +53,11 @@ func Test_Sanitizer(t *testing.T) {
`<p style="bad-color: red">Hello World</p>`, `<p>Hello World</p>`,
`<code style="bad-color: red">Hello World</code>`, `<code>Hello World</code>`,
+ // Org mode status of list items.
+ `<li class="checked"></li>`, `<li class="checked"></li>`,
+ `<li class="unchecked"></li>`, `<li class="unchecked"></li>`,
+ `<li class="indeterminate"></li>`, `<li class="indeterminate"></li>`,
+
// URLs
`<a href="cbthunderlink://somebase64string)">my custom URL scheme</a>`, `<a href="cbthunderlink://somebase64string)" rel="nofollow">my custom URL scheme</a>`,
`<a href="matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join">my custom URL scheme</a>`, `<a href="matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join" rel="nofollow">my custom URL scheme</a>`,