@@ -666,10 +666,12 @@ symbol = do
666666-- parses inline code, between n `s and n `s
667667code = try $ do
668668 starts <- many1 (char '`')
669− let num = length starts
670− result <- many1Till anyChar (try (count num (char '`')))
671− -- get rid of any internal newlines
672− return $ Code $ removeLeadingTrailingSpace $ joinWithSep " " $ lines result
669+ skipSpaces
670+ result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|>
671+ (char '\n' >> return " "))
672+ (try (skipSpaces >> count (length starts) (char '`') >>
673+ notFollowedBy (char '`')))
674+ return $ Code $ removeLeadingTrailingSpace $ concat result
673675
674676mathWord = many1 ((noneOf " \t\n\\$") <|>
675677 (try (char '\\') >>~ notFollowedBy (char '$')))