diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-23 11:51:44 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-23 11:51:44 +0200 |
commit | 57cc9a391c18977f229d7a5e15d0e9bcb861b684 (patch) | |
tree | dc582e16dfb9d9095ed8bc69ae301af3e6d5299e /src/Text | |
parent | da7d9ef295de3d51db97c4ff57104ae7d6e57e86 (diff) | |
download | pandoc-57cc9a391c18977f229d7a5e15d0e9bcb861b684.tar.gz |
Markdown writer: make sure `plain`, `markdown_github`, etc. work for raw.
Previously only `markdown` worked.
Note: currently a raw block labeled `markdown_github` will
be printed for any `markdown` format.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 8433f648f..6c7e662bf 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -433,8 +433,10 @@ blockToMarkdown' opts (LineBlock lns) = return $ (vcat $ map (hang 2 (text "| ")) mdLines) <> blankline else blockToMarkdown opts $ linesToPara lns blockToMarkdown' opts b@(RawBlock f str) - | f == "markdown" = return $ text str <> text "\n" - | f == "html" && isEnabled Ext_raw_html opts = do + | f `elem` ["markdown", "markdown_github", "markdown_phpextra", + "markdown_mmd", "markdown_strict"] + = return $ text str <> text "\n" + | f `elem` ["html", "html5", "html4"] && isEnabled Ext_raw_html opts = do plain <- asks envPlain return $ if plain then empty @@ -1053,10 +1055,12 @@ inlineToMarkdown opts (Math DisplayMath str) = (texMathToInlines DisplayMath str >>= inlineListToMarkdown opts) inlineToMarkdown opts il@(RawInline f str) = do plain <- asks envPlain - if not plain && - ( f == "markdown" || + if (plain && f == "plain") || (not plain && + ( f `elem` ["markdown", "markdown_github", "markdown_phpextra", + "markdown_mmd", "markdown_strict"] || (isEnabled Ext_raw_tex opts && (f == "latex" || f == "tex")) || - (isEnabled Ext_raw_html opts && f == "html") ) + (isEnabled Ext_raw_html opts && f `elem` ["html", "html4", "html5"]) + )) then return $ text str else do report $ InlineNotRendered il |