diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 8 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 77b134aaa..0cf514b86 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -64,7 +64,7 @@ data Extension = | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\] | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\] | Ext_latex_macros -- ^ Parse LaTeX macro definitions (for math only) - | Ext_delimited_code_blocks -- ^ Parse delimited code blocks + | Ext_fenced_code_blocks -- ^ Parse fenced code blocks | Ext_inline_code_attributes -- ^ Allow attributes on inline code | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown @@ -104,7 +104,7 @@ pandocExtensions = Set.fromList , Ext_raw_html , Ext_tex_math_dollars , Ext_latex_macros - , Ext_delimited_code_blocks + , Ext_fenced_code_blocks , Ext_inline_code_attributes , Ext_markdown_in_html_blocks , Ext_escaped_line_breaks diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 792c0269a..551abd357 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -306,7 +306,7 @@ parseBlocks :: Parser [Char] ParserState (F Blocks) parseBlocks = mconcat <$> manyTill block eof block :: Parser [Char] ParserState (F Blocks) -block = choice [ codeBlockDelimited +block = choice [ codeBlockFenced , guardEnabled Ext_latex_macros *> (mempty <$ macro) , header , rawTeXBlock @@ -435,9 +435,9 @@ keyValAttr = try $ do <|> many nonspaceChar return ("",[],[(key,val)]) -codeBlockDelimited :: Parser [Char] ParserState (F Blocks) -codeBlockDelimited = try $ do - guardEnabled Ext_delimited_code_blocks +codeBlockFenced :: Parser [Char] ParserState (F Blocks) +codeBlockFenced = try $ do + guardEnabled Ext_fenced_code_blocks (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing contents <- manyTill anyLine (blockDelimiter (== c) (Just size)) blanklines diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 1e381b461..425a63c90 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -292,8 +292,8 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str) isEnabled Ext_literate_haskell opts = return $ prefixed "> " (text str) <> blankline blockToMarkdown opts (CodeBlock attribs str) = return $ - if isEnabled Ext_delimited_code_blocks opts && attribs /= nullAttr - then -- use delimited code block + if isEnabled Ext_fenced_code_blocks opts && attribs /= nullAttr + then -- use fenced code block (tildes <> space <> attrs <> cr <> text str <> cr <> tildes) <> blankline else nest (writerTabStop opts) (text str) <> blankline @@ -468,7 +468,7 @@ blockListToMarkdown opts blocks = -- insert comment between list and indented code block, or the -- code block will be treated as a list continuation paragraph where fixBlocks (b : CodeBlock attr x : rest) - | (not (isEnabled Ext_delimited_code_blocks opts) || attr == nullAttr) + | (not (isEnabled Ext_fenced_code_blocks opts) || attr == nullAttr) && isListBlock b = b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x : fixBlocks rest |