mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Fix markdown math brackets render problem (#31420)
Close #31371, support `($ ... $)` like GitHub Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		@@ -45,6 +45,10 @@ func isPunctuation(b byte) bool {
 | 
			
		||||
	return b == '.' || b == '!' || b == '?' || b == ',' || b == ';' || b == ':'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func isBracket(b byte) bool {
 | 
			
		||||
	return b == ')'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func isAlphanumeric(b byte) bool {
 | 
			
		||||
	return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9')
 | 
			
		||||
}
 | 
			
		||||
@@ -84,7 +88,7 @@ func (parser *inlineParser) Parse(parent ast.Node, block text.Reader, pc parser.
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		suceedingCharacter := line[pos]
 | 
			
		||||
		if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') {
 | 
			
		||||
		if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') && !isBracket(suceedingCharacter) {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
		if line[ender-1] != '\\' {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user