mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-04 17:35:21 +02:00
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8246
closes #8076
(cherry picked from commit 7ab27a7a7f
)
Co-authored-by: Bente Groh <mail@bentegroh.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8283
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
parent
ca07340093
commit
a4f6c07306
10 changed files with 67 additions and 59 deletions
|
@ -108,6 +108,9 @@ func createDefaultPolicy() *bluemonday.Policy {
|
|||
// Allow classes for emojis
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^emoji$`)).OnElements("img")
|
||||
|
||||
// Allow attributes for images
|
||||
policy.AllowAttrs("loading").Matching(regexp.MustCompile(`^lazy$`)).OnElements("img")
|
||||
|
||||
// Allow icons, emojis, chroma syntax and keyword markup on span
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji)|(language-math display)|(language-math inline))$|^([a-z][a-z0-9]{0,2})$|^` + keywordClass + `$`)).OnElements("span")
|
||||
policy.AllowAttrs("data-alias").Matching(regexp.MustCompile(`^[a-zA-Z0-9-_+]+$`)).OnElements("span")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue