@@ -416,8 +416,12 @@ lexLine :: PandocMonad m => ManLexer m ManTokens
416416lexLine = do
417417 lnparts <- mconcat <$> many1 linePart
418418 eofline
419− return $ singleTok $ MLine lnparts
420− where
419+ go lnparts
420+ where -- return empty line if we only have empty strings;
421+ -- this can happen if the line just contains \f[C], for example.
422+ go [] = return mempty
423+ go (RoffStr ("",_):xs) = go xs
424+ go xs = return $ singleTok $ MLine xs
421425
422426linePart :: PandocMonad m => ManLexer m [LinePart]
423427linePart = macroArg <|> esc <|> escStar <|>
@@ -647,15 +651,11 @@ parseCodeBlock = try $ do
647651 mmacro "nf"
648652 toks <- many (mline <|> memptyLine)
649653 mmacro "fi"
650− return $ codeBlock (removeFinalNewline $
651− intercalate "\n" . catMaybes $
654+ return $ codeBlock (intercalate "\n" . catMaybes $
652655 extractText <$> toks)
653656
654657 where
655658
656− removeFinalNewline [] = []
657− removeFinalNewline xs = if last xs == '\n' then init xs else xs
658−
659659 extractText :: ManToken -> Maybe String
660660 extractText (MLine ss) = Just $ linePartsToString ss
661661 extractText MEmptyLine = Just ""