@@ -47,7 +47,7 @@ import Text.Pandoc.Readers.HTML ( rawHtmlBlock, anyHtmlBlockTag,
4747 htmlBlockElement, htmlComment, unsanitaryURI )
4848import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
4949import Text.ParserCombinators.Parsec
50−import Control.Monad (when, liftM, unless, guard)
50+import Control.Monad (when, liftM, guard)
5151import Text.TeXMath.Macros (applyMacros, Macro, pMacroDefinition)
5252
5353-- | Read markdown from an input string and return a Pandoc document.
@@ -121,7 +121,7 @@ inlinesInBalancedBrackets :: GenParser Char ParserState Inline
121121inlinesInBalancedBrackets parser = try $ do
122122 char '['
123123 result <- manyTill ( (do lookAhead $ try $ do (Str res) <- parser
124− unless (res == "[") pzero
124+ guard (res == "[")
125125 bal <- inlinesInBalancedBrackets parser
126126 return $ [Str "["] ++ bal ++ [Str "]"])
127127 <|> (count 1 parser))
@@ -1138,7 +1138,9 @@ strChar = noneOf (specialChars ++ " \t\n")
11381138
11391139str :: GenParser Char ParserState Inline
11401140str = do
1141− result <- many1 strChar
1141+ a <- strChar
1142+ as <- many (strChar <|> (try $ char '_' >>~ lookAhead strChar))
1143+ let result = a:as
11421144 state <- getState
11431145 let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)
11441146 if stateSmart state