@@ -163,13 +163,23 @@ mathChars = concat <$>
163163 <|> (\c -> ['\\',c]) <$> (try $ char '\\' *> anyChar)
164164 )
165165
166+quoted' :: (Inlines -> Inlines) -> LP String -> LP () -> LP Inlines
167+quoted' f starter ender = do
168+ startchs <- starter
169+ try ((f . mconcat) <$> manyTill inline ender) <|> lit startchs
170+
166171double_quote :: LP Inlines
167−double_quote = (doubleQuoted . mconcat) <$>
168− (try $ string "``" *> manyTill inline (try $ string "''"))
172+double_quote =
173+ ( quoted' doubleQuoted (try $ string "``") (void $ try $ string "''")
174+ <|> quoted' doubleQuoted (string "“") (void $ char '”')
175+ <|> quoted' doubleQuoted (string "\"") (void $ char '"')
176+ )
169177
170178single_quote :: LP Inlines
171−single_quote = (singleQuoted . mconcat) <$>
172− (try $ char '`' *> manyTill inline (try $ char '\'' >> notFollowedBy letter))
179+single_quote =
180+ ( quoted' singleQuoted (string "`") (try $ char '\'' >> notFollowedBy letter)
181+ <|> quoted' singleQuoted (string "‘") (try $ char '’' >> notFollowedBy letter)
182+ )
173183
174184inline :: LP Inlines
175185inline = (mempty <$ comment)
@@ -181,10 +191,10 @@ inline = (mempty <$ comment)
181191 ((char '-') *> option (str "–") (str "—" <$ char '-')))
182192 <|> double_quote
183193 <|> single_quote
184− <|> (str "“" <$ try (string "``")) -- nb. {``} won't be caught by double_quote
185194 <|> (str "”" <$ try (string "''"))
186− <|> (str "‘" <$ char '`') -- nb. {`} won't be caught by single_quote
195+ <|> (str "”" <$ char '”')
187196 <|> (str "’" <$ char '\'')
197+ <|> (str "’" <$ char '’')
188198 <|> (str "\160" <$ char '~')
189199 <|> (mathDisplay $ string "$$" *> mathChars <* string "$$")
190200 <|> (mathInline $ char '$' *> mathChars <* char '$')
@@ -755,7 +765,7 @@ inlineText :: LP Inlines
755765inlineText = str <$> many1 inlineChar
756766
757767inlineChar :: LP Char
758−inlineChar = noneOf "\\$%^_&~#{}^'`-[] \t\n"
768+inlineChar = noneOf "\\$%^_&~#{}^'`\"‘’“”-[] \t\n"
759769
760770environment :: LP Blocks
761771environment = do