@@ -376,11 +376,17 @@ preformatted = try $ do
376 spacesStr _ = False
376 spacesStr _ = False
377 if F.all spacesStr contents
377 if F.all spacesStr contents
378 then return mempty
378 then return mempty
379− else return $ B.para $ walk strToCode contents
379+ else return $ B.para $ encode contents
381−strToCode :: Inline -> Inline
381+encode :: Inlines -> Inlines
382+encode = B.fromList . normalizeCode . B.toList . walk strToCode
382−strToCode (Str s) = Code ("",[],[]) s
383+ where strToCode (Str s) = Code ("",[],[]) s
384+ strToCode Space = Code ("",[],[]) " "
383−strToCode x = x
385+ strToCode x = x
386+ normalizeCode [] = []
387+ normalizeCode (Code a1 x : Code a2 y : zs) | a1 == a2 =
388+ normalizeCode $ (Code a1 (x ++ y)) : zs
389+ normalizeCode (x:xs) = x : normalizeCode xs
385header :: MWParser Blocks
391header :: MWParser Blocks
386header = try $ do
392header = try $ do
@@ -545,8 +551,8 @@ inlineTag = do
545 TagOpen "del" _ -> B.strikeout <$> inlinesInTags "del"
551 TagOpen "del" _ -> B.strikeout <$> inlinesInTags "del"
546 TagOpen "sub" _ -> B.subscript <$> inlinesInTags "sub"
552 TagOpen "sub" _ -> B.subscript <$> inlinesInTags "sub"
547 TagOpen "sup" _ -> B.superscript <$> inlinesInTags "sup"
553 TagOpen "sup" _ -> B.superscript <$> inlinesInTags "sup"
548− TagOpen "code" _ -> walk strToCode <$> inlinesInTags "code"
554+ TagOpen "code" _ -> encode <$> inlinesInTags "code"
549− TagOpen "tt" _ -> walk strToCode <$> inlinesInTags "tt"
555+ TagOpen "tt" _ -> encode <$> inlinesInTags "tt"
550 TagOpen "hask" _ -> B.codeWith ("",["haskell"],[]) <$> charsInTags "hask"
556 TagOpen "hask" _ -> B.codeWith ("",["haskell"],[]) <$> charsInTags "hask"
551 _ -> B.rawInline "html" . snd <$> htmlTag (~== tag)
557 _ -> B.rawInline "html" . snd <$> htmlTag (~== tag)