git.iko.soy/typeable/pandoc
on master help sign in
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.

commit57cc9a391c18977f229d7a5e15d0e9bcb861b684 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 23 Jun 2017, 11:51 (9 years ago) parentda7d9ef
1 file changed+9−5
src/Text/Pandoc/Writers/Markdown.hs+9−5
src/Text/Pandoc/Writers/Markdown.hs+9−5
@@ -433,8 +433,10 @@ blockToMarkdown' opts (LineBlock lns) =
433433 return $ (vcat $ map (hang 2 (text "| ")) mdLines) <> blankline
434434 else blockToMarkdown opts $ linesToPara lns
435435blockToMarkdown' opts b@(RawBlock f str)
436− | f == "markdown" = return $ text str <> text "\n"
437− | f == "html" && isEnabled Ext_raw_html opts = do
436+ | f `elem` ["markdown", "markdown_github", "markdown_phpextra",
437+ "markdown_mmd", "markdown_strict"]
438+ = return $ text str <> text "\n"
439+ | f `elem` ["html", "html5", "html4"] && isEnabled Ext_raw_html opts = do
438440 plain <- asks envPlain
439441 return $ if plain
440442 then empty
@@ -1053,10 +1055,12 @@ inlineToMarkdown opts (Math DisplayMath str) =
10531055 (texMathToInlines DisplayMath str >>= inlineListToMarkdown opts)
10541056inlineToMarkdown opts il@(RawInline f str) = do
10551057 plain <- asks envPlain
1056− if not plain &&
1057− ( f == "markdown" ||
1058+ if (plain && f == "plain") || (not plain &&
1059+ ( f `elem` ["markdown", "markdown_github", "markdown_phpextra",
1060+ "markdown_mmd", "markdown_strict"] ||
10581061 (isEnabled Ext_raw_tex opts && (f == "latex" || f == "tex")) ||
1059− (isEnabled Ext_raw_html opts && f == "html") )
1062+ (isEnabled Ext_raw_html opts && f `elem` ["html", "html4", "html5"])
1063+ ))
10601064 then return $ text str
10611065 else do
10621066 report $ InlineNotRendered il