git.iko.soy/typeable/pandoc
on master help sign in
Implemented Ext_markdown_attribute.

This adds markdown=1 to block tags.

commit78d3a0fb9d3f862d5e2b61bd45434f7af9cd9f18 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 11 Aug 2012, 15:04 (14 years ago) parent9591fc9
3 files changed+17−1
README+6 src/Text/Pandoc/Options.hs+1 src/Text/Pandoc/Readers/Markdown.hs+10−1
README+6
@@ -2207,6 +2207,12 @@ Causes anything between `\\(` and `\\)` to be interpreted as inline
22072207TeX math, and anything between `\\[` and `\\]` to be interpreted
22082208as display TeX math.
22092209
2210+**Extension: `markdown_attribute`**\
2211+Causes the attribute `markdown=1` to be added to all block-level
2212+HTML tags that might contain markdown. In pandoc, material inside
2213+block-level tags is interpreted a markdown by default, but in some
2214+other implementations, the `markdown=1` tag is needed.
2215+
22102216Producing slide shows with Pandoc
22112217=================================
22122218
src/Text/Pandoc/Options.hs+1
@@ -64,6 +64,7 @@ data Extension = Ext_footnotes
6464 | Ext_delimited_code_blocks
6565 | Ext_inline_code_attributes
6666 | Ext_markdown_in_html_blocks
67+ | Ext_markdown_attribute
6768 | Ext_escaped_line_breaks
6869 | Ext_autolink_code_spans
6970 | Ext_fancy_lists
src/Text/Pandoc/Readers/Markdown.hs+10−1
@@ -736,10 +736,19 @@ rawTeXBlock = do
736736 spaces
737737 return $ return result
738738
739+addMarkdownAttribute :: (Tag String, String) -> Parser [Char] ParserState String
740+addMarkdownAttribute (t,s) = do
741+ (guardDisabled Ext_markdown_attribute >> return s)
742+ <|> case t of
743+ TagOpen x attrs
744+ | "markdown" `elem` map fst attrs -> return s
745+ | otherwise -> return $ renderTags [TagOpen x (("markdown","1"):attrs)]
746+ _ -> return s
747+
739748rawHtmlBlocks :: Parser [Char] ParserState String
740749rawHtmlBlocks = do
741750 htmlBlocks <- many1 $ do blk <- rawVerbatimBlock <|>
742− liftM snd (htmlTag isBlockTag)
751+ (htmlTag isBlockTag >>= addMarkdownAttribute)
743752 sps <- do sp1 <- many spaceChar
744753 sp2 <- option "" (blankline >> return "\n")
745754 sp3 <- many spaceChar