git.iko.soy/typeable/pandoc
on master help sign in
Changed nomenclature, delimited -> fenced code blocks.
b985d33John MacFarlane
README+6−6
@@ -22,7 +22,7 @@ slide shows), [ConTeXt], [RTF], [DocBook XML], [OpenDocument XML],
22[PDF] output on systems where LaTeX is installed.
22[PDF] output on systems where LaTeX is installed.
23
23
24Pandoc's enhanced version of markdown includes syntax for footnotes,
24Pandoc's enhanced version of markdown includes syntax for footnotes,
25−tables, flexible ordered lists, definition lists, delimited code blocks,
25+tables, flexible ordered lists, definition lists, fenced code blocks,
26superscript, subscript, strikeout, title blocks, automatic tables of
26superscript, subscript, strikeout, title blocks, automatic tables of
27contents, embedded LaTeX math, citations, and markdown inside HTML block
27contents, embedded LaTeX math, citations, and markdown inside HTML block
28elements. (These enhancements, described below under
28elements. (These enhancements, described below under
@@ -971,12 +971,12 @@ of the verbatim text, and is removed in the output.
971Note: blank lines in the verbatim text need not begin with four spaces.
971Note: blank lines in the verbatim text need not begin with four spaces.
972
972
973
973
974−### Delimited code blocks ###
974+### Fenced code blocks ###
975
975
976−**Extension: `delimited_code_blocks`**
976+**Extension: `fenced_code_blocks`**
977
977
978In addition to standard indented code blocks, Pandoc supports
978In addition to standard indented code blocks, Pandoc supports
979−*delimited* code blocks. These begin with a row of three or more
979+*fenced* code blocks. These begin with a row of three or more
980tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
980tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
981backticks that must be at least as long as the starting row. Everything
981backticks that must be at least as long as the starting row. Everything
982between these lines is treated as code. No indentation is necessary:
982between these lines is treated as code. No indentation is necessary:
@@ -987,7 +987,7 @@ between these lines is treated as code. No indentation is necessary:
987 }
987 }
988 ~~~~~~~
988 ~~~~~~~
989
989
990−Like regular code blocks, delimited code blocks must be separated
990+Like regular code blocks, fenced code blocks must be separated
991from surrounding text by blank lines.
991from surrounding text by blank lines.
992
992
993If the code itself contains a row of tildes or backticks, just use a longer
993If the code itself contains a row of tildes or backticks, just use a longer
@@ -1745,7 +1745,7 @@ work in verbatim contexts:
1745**Extension: `inline_code_attributes`**
1745**Extension: `inline_code_attributes`**
1746
1746
1747Attributes can be attached to verbatim text, just as with
1747Attributes can be attached to verbatim text, just as with
1748−[delimited code blocks](#delimited-code-blocks):
1748+[fenced code blocks](#fenced-code-blocks):
1749
1749
1750 `<$>`{.haskell}
1750 `<$>`{.haskell}
1751
1751
src/Text/Pandoc/Options.hs+2−2
@@ -64,7 +64,7 @@ data Extension =
64 | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\]
64 | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\]
65 | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]
65 | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]
66 | Ext_latex_macros -- ^ Parse LaTeX macro definitions (for math only)
66 | Ext_latex_macros -- ^ Parse LaTeX macro definitions (for math only)
67− | Ext_delimited_code_blocks -- ^ Parse delimited code blocks
67+ | Ext_fenced_code_blocks -- ^ Parse fenced code blocks
68 | Ext_inline_code_attributes -- ^ Allow attributes on inline code
68 | Ext_inline_code_attributes -- ^ Allow attributes on inline code
69 | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
69 | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
70 | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown
70 | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown
@@ -104,7 +104,7 @@ pandocExtensions = Set.fromList
104 , Ext_raw_html
104 , Ext_raw_html
105 , Ext_tex_math_dollars
105 , Ext_tex_math_dollars
106 , Ext_latex_macros
106 , Ext_latex_macros
107− , Ext_delimited_code_blocks
107+ , Ext_fenced_code_blocks
108 , Ext_inline_code_attributes
108 , Ext_inline_code_attributes
109 , Ext_markdown_in_html_blocks
109 , Ext_markdown_in_html_blocks
110 , Ext_escaped_line_breaks
110 , Ext_escaped_line_breaks
src/Text/Pandoc/Readers/Markdown.hs+4−4
@@ -306,7 +306,7 @@ parseBlocks :: Parser [Char] ParserState (F Blocks)
306parseBlocks = mconcat <$> manyTill block eof
306parseBlocks = mconcat <$> manyTill block eof
307
307
308block :: Parser [Char] ParserState (F Blocks)
308block :: Parser [Char] ParserState (F Blocks)
309−block = choice [ codeBlockDelimited
309+block = choice [ codeBlockFenced
310 , guardEnabled Ext_latex_macros *> (mempty <$ macro)
310 , guardEnabled Ext_latex_macros *> (mempty <$ macro)
311 , header
311 , header
312 , rawTeXBlock
312 , rawTeXBlock
@@ -435,9 +435,9 @@ keyValAttr = try $ do
435 <|> many nonspaceChar
435 <|> many nonspaceChar
436 return ("",[],[(key,val)])
436 return ("",[],[(key,val)])
437
437
438−codeBlockDelimited :: Parser [Char] ParserState (F Blocks)
438+codeBlockFenced :: Parser [Char] ParserState (F Blocks)
439−codeBlockDelimited = try $ do
439+codeBlockFenced = try $ do
440− guardEnabled Ext_delimited_code_blocks
440+ guardEnabled Ext_fenced_code_blocks
441 (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing
441 (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing
442 contents <- manyTill anyLine (blockDelimiter (== c) (Just size))
442 contents <- manyTill anyLine (blockDelimiter (== c) (Just size))
443 blanklines
443 blanklines
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -292,8 +292,8 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str)
292 isEnabled Ext_literate_haskell opts =
292 isEnabled Ext_literate_haskell opts =
293 return $ prefixed "> " (text str) <> blankline
293 return $ prefixed "> " (text str) <> blankline
294blockToMarkdown opts (CodeBlock attribs str) = return $
294blockToMarkdown opts (CodeBlock attribs str) = return $
295− if isEnabled Ext_delimited_code_blocks opts && attribs /= nullAttr
295+ if isEnabled Ext_fenced_code_blocks opts && attribs /= nullAttr
296− then -- use delimited code block
296+ then -- use fenced code block
297 (tildes <> space <> attrs <> cr <> text str <>
297 (tildes <> space <> attrs <> cr <> text str <>
298 cr <> tildes) <> blankline
298 cr <> tildes) <> blankline
299 else nest (writerTabStop opts) (text str) <> blankline
299 else nest (writerTabStop opts) (text str) <> blankline
@@ -468,7 +468,7 @@ blockListToMarkdown opts blocks =
468 -- insert comment between list and indented code block, or the
468 -- insert comment between list and indented code block, or the
469 -- code block will be treated as a list continuation paragraph
469 -- code block will be treated as a list continuation paragraph
470 where fixBlocks (b : CodeBlock attr x : rest)
470 where fixBlocks (b : CodeBlock attr x : rest)
471− | (not (isEnabled Ext_delimited_code_blocks opts) || attr == nullAttr)
471+ | (not (isEnabled Ext_fenced_code_blocks opts) || attr == nullAttr)
472 && isListBlock b =
472 && isListBlock b =
473 b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
473 b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
474 fixBlocks rest
474 fixBlocks rest