-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Explain the problem.
The way pandoc handles spacing after opening math delimiters and before closing math delimiters is inconsistent. For opening delimiters, a newline after the delimiter will render the inline content invalid; however, a newline before a closing delimiter still renders the content as inline math.
Here is an example showing the newline after the opening delimiter -- Opening
Here is an example showing the newline before the closing delimiter -- Closing
I believe the inconsistency is because of the follow two lines in the code, where one tests whether the opening is followed by space, and the other tests whether a spaceChar is followed by $. However, I do not know haskell, nor have I tested any potential changes. However, if this is the intended behavior, I believe the documentation should be updated to mention the difference in space handling.
pandoc/src/Text/Pandoc/Parsing/Math.hs
Line 35 in 48badd2
| when (op == "$") $ notFollowedBy space |
pandoc/src/Text/Pandoc/Parsing/Math.hs
Line 46 in 48badd2
| <|> (T.pack <$> many1 spaceChar <* notFollowedBy (char '$')) |
Pandoc version?
v3.8.2.1 macOS 26