mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -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",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user