@@ -42,6 +42,7 @@ import Text.Pandoc.Pretty
42import Control.Monad.State
42import Control.Monad.State
43import qualified Data.Set as Set
43import qualified Data.Set as Set
44import Text.Pandoc.Writers.HTML (writeHtmlString)
44import Text.Pandoc.Writers.HTML (writeHtmlString)
45+import Text.HTML.TagSoup (renderTags, parseTags, isTagText, Tag(..))
46type Notes = [[Block]]
47type Notes = [[Block]]
47type Refs = [([Inline], Target)]
48type Refs = [([Inline], Target)]
@@ -230,8 +231,15 @@ blockToMarkdown opts (Para inlines) = do
230 then text "\x200B" -- zero-width space, a hack
231 then text "\x200B" -- zero-width space, a hack
231 else empty
232 else empty
232 return $ esc <> contents <> blankline
233 return $ esc <> contents <> blankline
233−blockToMarkdown _ (RawBlock f str)
234+blockToMarkdown opts (RawBlock f str)
239+ else return $ if isEnabled Ext_markdown_attribute opts
240+ then text (addMarkdownAttribute str) <> text "\n"
241+ else text str <> text "\n"
234− | f == "html" || f == "latex" || f == "tex" || f == "markdown" = do
242+ | f == "latex" || f == "tex" || f == "markdown" = do
235 st <- get
243 st <- get
236 if stPlain st
244 if stPlain st
237 then return empty
245 then return empty
@@ -321,6 +329,15 @@ blockToMarkdown opts (DefinitionList items) = do
321 contents <- mapM (definitionListItemToMarkdown opts) items
329 contents <- mapM (definitionListItemToMarkdown opts) items
322 return $ cat contents <> blankline
330 return $ cat contents <> blankline
332+addMarkdownAttribute :: String -> String
333+addMarkdownAttribute s =
334+ case span isTagText $ reverse $ parseTags s of
335+ (xs,(TagOpen t attrs:rest)) ->
336+ renderTags $ reverse rest ++ (TagOpen t attrs' : reverse xs)
337+ where attrs' = ("markdown","1"):[(x,y) | (x,y) <- attrs,
324pipeTable :: Bool -> [Alignment] -> [Doc] -> [[Doc]] -> State WriterState Doc
341pipeTable :: Bool -> [Alignment] -> [Doc] -> [[Doc]] -> State WriterState Doc
325pipeTable headless aligns rawHeaders rawRows = do
342pipeTable headless aligns rawHeaders rawRows = do
326 let torow cs = nowrap $ text "|" <>
343 let torow cs = nowrap $ text "|" <>