git.iko.soy/typeable/pandoc
on master help sign in
Changed nomenclature, delimited -> fenced code blocks.
commitb985d334064da3df9c340175d75f259cf9f1d4d2 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 21 Aug 2012, 19:21 (14 years ago) parent7b34dd8
4 files changed+15−15
README+6−6 src/Text/Pandoc/Options.hs+2−2 src/Text/Pandoc/Readers/Markdown.hs+4−4 src/Text/Pandoc/Writers/Markdown.hs+3−3
README+6−6
@@ -22,7 +22,7 @@ slide shows), [ConTeXt], [RTF], [DocBook XML], [OpenDocument XML],
2222[PDF] output on systems where LaTeX is installed.
2323
2424Pandoc'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,
2626superscript, subscript, strikeout, title blocks, automatic tables of
2727contents, embedded LaTeX math, citations, and markdown inside HTML block
2828elements. (These enhancements, described below under
@@ -971,12 +971,12 @@ of the verbatim text, and is removed in the output.
971971Note: blank lines in the verbatim text need not begin with four spaces.
972972
973973
974−### Delimited code blocks ###
974+### Fenced code blocks ###
975975
976−**Extension: `delimited_code_blocks`**
976+**Extension: `fenced_code_blocks`**
977977
978978In 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
980980tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
981981backticks that must be at least as long as the starting row. Everything
982982between 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:
987987 }
988988 ~~~~~~~
989989
990−Like regular code blocks, delimited code blocks must be separated
990+Like regular code blocks, fenced code blocks must be separated
991991from surrounding text by blank lines.
992992
993993If the code itself contains a row of tildes or backticks, just use a longer
@@ -1745,7 +1745,7 @@ work in verbatim contexts:
17451745**Extension: `inline_code_attributes`**
17461746
17471747Attributes can be attached to verbatim text, just as with
1748−[delimited code blocks](#delimited-code-blocks):
1748+[fenced code blocks](#fenced-code-blocks):
17491749
17501750 `<$>`{.haskell}
17511751
src/Text/Pandoc/Options.hs+2−2
@@ -64,7 +64,7 @@ data Extension =
6464 | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\]
6565 | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]
6666 | 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
6868 | Ext_inline_code_attributes -- ^ Allow attributes on inline code
6969 | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
7070 | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown
@@ -104,7 +104,7 @@ pandocExtensions = Set.fromList
104104 , Ext_raw_html
105105 , Ext_tex_math_dollars
106106 , Ext_latex_macros
107− , Ext_delimited_code_blocks
107+ , Ext_fenced_code_blocks
108108 , Ext_inline_code_attributes
109109 , Ext_markdown_in_html_blocks
110110 , Ext_escaped_line_breaks
src/Text/Pandoc/Readers/Markdown.hs+4−4
@@ -306,7 +306,7 @@ parseBlocks :: Parser [Char] ParserState (F Blocks)
306306parseBlocks = mconcat <$> manyTill block eof
307307
308308block :: Parser [Char] ParserState (F Blocks)
309−block = choice [ codeBlockDelimited
309+block = choice [ codeBlockFenced
310310 , guardEnabled Ext_latex_macros *> (mempty <$ macro)
311311 , header
312312 , rawTeXBlock
@@ -435,9 +435,9 @@ keyValAttr = try $ do
435435 <|> many nonspaceChar
436436 return ("",[],[(key,val)])
437437
438−codeBlockDelimited :: Parser [Char] ParserState (F Blocks)
439−codeBlockDelimited = try $ do
440− guardEnabled Ext_delimited_code_blocks
438+codeBlockFenced :: Parser [Char] ParserState (F Blocks)
439+codeBlockFenced = try $ do
440+ guardEnabled Ext_fenced_code_blocks
441441 (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing
442442 contents <- manyTill anyLine (blockDelimiter (== c) (Just size))
443443 blanklines
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -292,8 +292,8 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str)
292292 isEnabled Ext_literate_haskell opts =
293293 return $ prefixed "> " (text str) <> blankline
294294blockToMarkdown opts (CodeBlock attribs str) = return $
295− if isEnabled Ext_delimited_code_blocks opts && attribs /= nullAttr
296− then -- use delimited code block
295+ if isEnabled Ext_fenced_code_blocks opts && attribs /= nullAttr
296+ then -- use fenced code block
297297 (tildes <> space <> attrs <> cr <> text str <>
298298 cr <> tildes) <> blankline
299299 else nest (writerTabStop opts) (text str) <> blankline
@@ -468,7 +468,7 @@ blockListToMarkdown opts blocks =
468468 -- insert comment between list and indented code block, or the
469469 -- code block will be treated as a list continuation paragraph
470470 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)
472472 && isListBlock b =
473473 b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
474474 fixBlocks rest