Fix markdown parsing bug for math in bracketed spans and links.

This affects math with unbalanced brackets (e.g. `$(0,1]$`)
inside links, images, bracketed spans.

Closes #7623.
This commit is contained in:
John MacFarlane 2021-10-13 08:59:37 -07:00
parent afc16f2f4b
commit 49c4e1d014
2 changed files with 13 additions and 0 deletions

View file

@ -198,6 +198,7 @@ inlinesInBalancedBrackets =
go openBrackets =
(() <$ (escapedChar <|>
code <|>
math <|>
rawHtmlInline <|>
rawLaTeXInline') >> go openBrackets)
<|>

12
test/command/7623.md Normal file
View file

@ -0,0 +1,12 @@
```
% pandoc -t native
[link $(0,1]$](url)
^D
[ Para
[ Link
( "" , [] , [] )
[ Str "link" , Space , Math InlineMath "(0,1]" ]
( "url" , "" )
]
]
```