diff options
author | Giteabot <teabot@gitea.io> | 2024-06-20 17:45:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 17:45:08 +0800 |
commit | 7fbcc58062c5cad5c4c8674915ea0fffa659b51d (patch) | |
tree | a3d23ce189eef6b7639014396842b5293b84d9c1 /modules/markup/markdown/math/inline_parser.go | |
parent | 05f32114d18f1e51782a567dc698de8dce4f2044 (diff) | |
download | gitea-7fbcc58062c5cad5c4c8674915ea0fffa659b51d.tar.gz gitea-7fbcc58062c5cad5c4c8674915ea0fffa659b51d.zip |
Fix markdown math brackets render problem (#31420) (#31430)
Backport #31420 by charles7668
Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/markup/markdown/math/inline_parser.go')
-rw-r--r-- | modules/markup/markdown/math/inline_parser.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/markup/markdown/math/inline_parser.go b/modules/markup/markdown/math/inline_parser.go index 862234e69b..614cf329af 100644 --- a/modules/markup/markdown/math/inline_parser.go +++ b/modules/markup/markdown/math/inline_parser.go @@ -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] != '\\' { |