Markdown reader: inline math must have nonspace before final $
.
Closes #1313.
This commit is contained in:
parent
fd11a5a5eb
commit
2e80613451
3 changed files with 12 additions and 4 deletions
|
@ -464,11 +464,13 @@ mathInlineWith :: String -> String -> Parser [Char] st String
|
||||||
mathInlineWith op cl = try $ do
|
mathInlineWith op cl = try $ do
|
||||||
string op
|
string op
|
||||||
notFollowedBy space
|
notFollowedBy space
|
||||||
words' <- many1Till (count 1 (noneOf "\n\\")
|
words' <- many1Till (count 1 (noneOf " \t\n\\")
|
||||||
<|> (char '\\' >> anyChar >>= \c -> return ['\\',c])
|
<|> (char '\\' >> anyChar >>= \c -> return ['\\',c])
|
||||||
<|> count 1 newline <* notFollowedBy' blankline
|
<|> do (blankline <* notFollowedBy' blankline) <|>
|
||||||
*> return " ")
|
(oneOf " \t" <* skipMany (oneOf " \t"))
|
||||||
(try $ string cl)
|
notFollowedBy (char '$')
|
||||||
|
return " "
|
||||||
|
) (try $ string cl)
|
||||||
notFollowedBy digit -- to prevent capture of $5
|
notFollowedBy digit -- to prevent capture of $5
|
||||||
return $ concat words'
|
return $ concat words'
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
,Header 3 ("my-header",[],[]) [Str "my",Space,Str "header"]
|
,Header 3 ("my-header",[],[]) [Str "my",Space,Str "header"]
|
||||||
,Header 2 ("in-math",[],[]) [Str "$",Space,Str "in",Space,Str "math"]
|
,Header 2 ("in-math",[],[]) [Str "$",Space,Str "in",Space,Str "math"]
|
||||||
,Para [Math InlineMath "\\$2 + \\$3"]
|
,Para [Math InlineMath "\\$2 + \\$3"]
|
||||||
|
,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "math:"]
|
||||||
|
,Para [Str "$PATH",Space,Str "90",Space,Str "$PATH"]
|
||||||
,Header 2 ("commented-out-list-item",[],[]) [Str "Commented-out",Space,Str "list",Space,Str "item"]
|
,Header 2 ("commented-out-list-item",[],[]) [Str "Commented-out",Space,Str "list",Space,Str "item"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "one",Space,RawInline (Format "html") "<!--\n- two\n-->"]]
|
[[Plain [Str "one",Space,RawInline (Format "html") "<!--\n- two\n-->"]]
|
||||||
|
|
|
@ -58,6 +58,10 @@
|
||||||
|
|
||||||
$\$2 + \$3$
|
$\$2 + \$3$
|
||||||
|
|
||||||
|
This should not be math:
|
||||||
|
|
||||||
|
$PATH 90 $PATH
|
||||||
|
|
||||||
## Commented-out list item
|
## Commented-out list item
|
||||||
|
|
||||||
- one
|
- one
|
||||||
|
|
Loading…
Reference in a new issue