@@ -481,7 +481,7 @@ str = do
481481 -- followed by parens, parens content is unconditionally word acronym
482482 fullStr <- option baseStr $ try $ do
483483 guard $ all isUpper baseStr
484− acro <- enclosed (char '(') (char ')') anyChar
484+ acro <- enclosed (char '(') (char ')') anyChar'
485485 return $ concat [baseStr, " (", acro, ")"]
486486 updateLastStrPos
487487 return $ B.str fullStr
@@ -528,8 +528,8 @@ link = try $ do
528528image :: Parser [Char] ParserState Inlines
529529image = try $ do
530530 char '!' >> notFollowedBy space
531− src <- manyTill anyChar (lookAhead $ oneOf "!(")
532− alt <- option "" (try $ (char '(' >> manyTill anyChar (char ')')))
531+ src <- manyTill anyChar' (lookAhead $ oneOf "!(")
532+ alt <- option "" (try $ (char '(' >> manyTill anyChar' (char ')')))
533533 char '!'
534534 return $ B.image src alt (B.str alt)
535535
@@ -537,12 +537,14 @@ escapedInline :: Parser [Char] ParserState Inlines
537537escapedInline = escapedEqs <|> escapedTag
538538
539539escapedEqs :: Parser [Char] ParserState Inlines
540−escapedEqs = B.str <$> (try $ string "==" *> manyTill anyChar (try $ string "=="))
540+escapedEqs = B.str <$>
541+ (try $ string "==" *> manyTill anyChar' (try $ string "=="))
541542
542543-- | literal text escaped btw <notextile> tags
543544escapedTag :: Parser [Char] ParserState Inlines
544545escapedTag = B.str <$>
545− (try $ string "<notextile>" *> manyTill anyChar (try $ string "</notextile>"))
546+ (try $ string "<notextile>" *>
547+ manyTill anyChar' (try $ string "</notextile>"))
546548
547549-- | Any special symbol defined in wordBoundaries
548550symbol :: Parser [Char] ParserState Inlines
@@ -552,13 +554,18 @@ symbol = B.str . singleton <$> (oneOf wordBoundaries <|> oneOf markupChars)
552554code :: Parser [Char] ParserState Inlines
553555code = code1 <|> code2
554556
557+-- any character except a newline before a blank line
558+anyChar' :: Parser [Char] ParserState Char
559+anyChar' =
560+ satisfy (/='\n') <|> (try $ char '\n' <* notFollowedBy blankline)
561+
555562code1 :: Parser [Char] ParserState Inlines
556−code1 = B.code <$> surrounded (char '@') anyChar
563+code1 = B.code <$> surrounded (char '@') anyChar'
557564
558565code2 :: Parser [Char] ParserState Inlines
559566code2 = do
560567 htmlTag (tagOpen (=="tt") null)
561− B.code <$> manyTill anyChar (try $ htmlTag $ tagClose (=="tt"))
568+ B.code <$> manyTill anyChar' (try $ htmlTag $ tagClose (=="tt"))
562569
563570-- | Html / CSS attributes
564571attributes :: Parser [Char] ParserState Attr
@@ -570,7 +577,7 @@ attribute = classIdAttr <|> styleAttr <|> langAttr
570577classIdAttr :: Parser [Char] ParserState (Attr -> Attr)
571578classIdAttr = try $ do -- (class class #id)
572579 char '('
573− ws <- words `fmap` manyTill anyChar (char ')')
580+ ws <- words `fmap` manyTill anyChar' (char ')')
574581 case reverse ws of
575582 [] -> return $ \(_,_,keyvals) -> ("",[],keyvals)
576583 (('#':ident'):classes') -> return $ \(_,_,keyvals) ->
@@ -580,7 +587,7 @@ classIdAttr = try $ do -- (class class #id)
580587
581588styleAttr :: Parser [Char] ParserState (Attr -> Attr)
582589styleAttr = do
583− style <- try $ enclosed (char '{') (char '}') anyChar
590+ style <- try $ enclosed (char '{') (char '}') anyChar'
584591 return $ \(id',classes,keyvals) -> (id',classes,("style",style):keyvals)
585592
586593langAttr :: Parser [Char] ParserState (Attr -> Attr)
@@ -592,13 +599,15 @@ langAttr = do
592599surrounded :: Parser [Char] st t -- ^ surrounding parser
593600 -> Parser [Char] st a -- ^ content parser (to be used repeatedly)
594601 -> Parser [Char] st [a]
595−surrounded border = enclosed (border *> notFollowedBy (oneOf " \t\n\r")) (try border)
602+surrounded border =
603+ enclosed (border *> notFollowedBy (oneOf " \t\n\r")) (try border)
596604
597605
598606simpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
599607 -> (Inlines -> Inlines) -- ^ Inline constructor
600608 -> Parser [Char] ParserState Inlines -- ^ content parser (to be used repeatedly)
601−simpleInline border construct = groupedSimpleInline border construct <|> ungroupedSimpleInline border construct
609+simpleInline border construct = groupedSimpleInline border construct
610+ <|> ungroupedSimpleInline border construct
602611
603612ungroupedSimpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
604613 -> (Inlines -> Inlines) -- ^ Inline constructor