diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs
index f702a6e33..db9e214b0 100644
--- a/Text/Pandoc/Readers/Markdown.hs
+++ b/Text/Pandoc/Readers/Markdown.hs
@@ -873,8 +873,9 @@ math = try $ do
failIfStrict
char '$'
notFollowedBy space
- words' <- sepBy1 mathWord (many1 space)
+ words' <- sepBy1 mathWord (many1 (spaceChar <|> (newline >>~ notFollowedBy' blankline)))
char '$'
+ notFollowedBy digit
return $ Math $ joinWithSep " " words'
emph :: GenParser Char ParserState Inline
diff --git a/tests/testsuite.native b/tests/testsuite.native
index 4ecc51438..564faf0d8 100644
--- a/tests/testsuite.native
+++ b/tests/testsuite.native
@@ -294,6 +294,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, BulletList
[ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
, [ Plain [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"] ]
+ , [ Plain [Str "Shoes",Space,Str "(",Str "$",Str "20)",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5)",Str "."] ]
, [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."] ] ]
, Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
, Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"]
diff --git a/tests/testsuite.txt b/tests/testsuite.txt
index dc5340021..d55a93a4e 100644
--- a/tests/testsuite.txt
+++ b/tests/testsuite.txt
@@ -482,6 +482,7 @@ These shouldn't be math:
- To get the famous equation, write `$e = mc^2$`.
- $22,000 is a *lot* of money. So is $34,000.
(It worked if "lot" is emphasized.)
+- Shoes ($20) and socks ($5).
- Escaped `$`: $73 *this should be emphasized* 23\$.
Here's a LaTeX table:
diff --git a/tests/writer.docbook b/tests/writer.docbook
index e8f963b58..424141cc9 100644
--- a/tests/writer.docbook
+++ b/tests/writer.docbook
@@ -902,6 +902,11 @@ These should not be escaped: \$ \\ \> \[ \{
worked if lot
is emphasized.)
+
+
+ Shoes ($20) and socks ($5).
+
+
Escaped $: $73
diff --git a/tests/writer.html b/tests/writer.html
index 819917c57..38eaf6a2a 100644
--- a/tests/writer.html
+++ b/tests/writer.html
@@ -796,6 +796,8 @@ Blah
>lot of money. So is $34,000. (It worked if “lot” is emphasized.)Shoes ($20) and socks ($5).Escaped $: $73