From 28cad165179378369fcf4d25656ea28357026baa Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 18 Jul 2019 22:30:05 -0700 Subject: Markdown writer: prefer using raw_attribute when enabled. The `raw_attribute` will be used to mark raw bits, even HTML and LaTeX, and even when `raw_html` and `raw_tex` are enabled, as they are by default. To get the old behavior, disable `raw_attribute` in the writer. Closes #4311. --- src/Text/Pandoc/Writers/Markdown.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 50fba2dba..ade350565 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -467,6 +467,7 @@ blockToMarkdown' opts b@(RawBlock f str) = do let renderEmpty = mempty <$ report (BlockNotRendered b) case () of _ | plain -> renderEmpty + | isEnabled Ext_raw_attribute opts -> rawAttribBlock | f `elem` ["markdown", "markdown_github", "markdown_phpextra", "markdown_mmd", "markdown_strict"] -> return $ text str <> text "\n" @@ -484,7 +485,6 @@ blockToMarkdown' opts b@(RawBlock f str) = do text str <> text "\n" | isEnabled Ext_raw_attribute opts -> rawAttribBlock | otherwise -> renderEmpty - | isEnabled Ext_raw_attribute opts -> rawAttribBlock | otherwise -> renderEmpty blockToMarkdown' opts HorizontalRule = do return $ blankline <> text (replicate (writerColumns opts) '-') <> blankline @@ -1152,6 +1152,7 @@ inlineToMarkdown opts il@(RawInline f str) = do | f `elem` ["markdown", "markdown_github", "markdown_phpextra", "markdown_mmd", "markdown_strict"] -> return $ text str + | isEnabled Ext_raw_attribute opts -> rawAttribInline | f `elem` ["html", "html5", "html4"] -> case () of _ | isEnabled Ext_raw_html opts -> return $ text str @@ -1162,7 +1163,6 @@ inlineToMarkdown opts il@(RawInline f str) = do _ | isEnabled Ext_raw_tex opts -> return $ text str | isEnabled Ext_raw_attribute opts -> rawAttribInline | otherwise -> renderEmpty - | isEnabled Ext_raw_attribute opts -> rawAttribInline | otherwise -> renderEmpty inlineToMarkdown opts (LineBreak) = do plain <- asks envPlain -- cgit v1.2.3