mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Add attention blocks within quote blocks for Note and Warning (#21711)
				
					
				
			For each quote block, the first `**Note**` or `**Warning**` gets an icon prepended to it and its text is colored accordingly. GitHub does this (community/community#16925). [Initially requested on Discord.](https://discord.com/channels/322538954119184384/322538954119184384/1038816475638661181) ### Before  ### After  Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		@@ -58,6 +58,13 @@ func createDefaultPolicy() *bluemonday.Policy {
 | 
			
		||||
	// For color preview
 | 
			
		||||
	policy.AllowAttrs("class").Matching(regexp.MustCompile(`^color-preview$`)).OnElements("span")
 | 
			
		||||
 | 
			
		||||
	// For attention
 | 
			
		||||
	policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-\w+$`)).OnElements("strong")
 | 
			
		||||
	policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-icon attention-\w+$`)).OnElements("span", "strong")
 | 
			
		||||
	policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-\w+$`)).OnElements("svg")
 | 
			
		||||
	policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg")
 | 
			
		||||
	policy.AllowAttrs("fill-rule", "d").OnElements("path")
 | 
			
		||||
 | 
			
		||||
	// For Chroma markdown plugin
 | 
			
		||||
	policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(chroma )?language-[\w-]+( display)?( is-loading)?$`)).OnElements("code")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user