jgm / commonmark-hs

Pure Haskell commonmark parsing library, designed to be flexible and extensible

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inline math can end with newline

ollpu opened this issue · comments

The parsing for inline math properly rejects newlines at the start, i.e.

$
not math$

is not recognized as math.

However, at the end only ASCII spaces are rejected:

else if T.all (==' ') (T.takeEnd 1 contents)
-- don't allow math to end with SPACE + $
then mzero

So this is recognized:

$is math
$

I wouldn't expect there to be a difference going by the phrasing here:

In inline math, the opening `$` must not be followed by
a whitespace, and the closing `$` must not be
preceeded by whitespace.