@@ -379,16 +379,13 @@ example = try $ do
379379 contents <- manyTill anyChar $ try (optional blankline >> string "}}}")
380380 return $ return $ B.codeBlock contents
381381
382−-- Trim up to one newline from the beginning and the end,
383−-- in case opening and/or closing tags are on separate lines.
384−chop :: String -> String
385−chop = lchop . rchop
386−
382+-- Trim up to one newline from the beginning of the string.
387383lchop :: String -> String
388384lchop s = case s of
389385 '\n':ss -> ss
390386 _ -> s
391387
388+-- Trim up to one newline from the end of the string.
392389rchop :: String -> String
393390rchop = reverse . lchop . reverse
394391
@@ -410,7 +407,7 @@ literalTag = do
410407 where
411408 -- FIXME: Emacs Muse inserts <literal> without style into all output formats, but we assume HTML
412409 format (_, _, kvs) = fromMaybe "html" $ lookup "style" kvs
413− rawBlock (attrs, content) = B.rawBlock (format attrs) $ chop content
410+ rawBlock (attrs, content) = B.rawBlock (format attrs) $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop content
414411
415412-- <center> tag is ignored
416413centerTag :: PandocMonad m => MuseParser m (F Blocks)