git.iko.soy/typeable/pandoc
on master help sign in
Added Ext_raw_html extension.

Closes #556 -- you can now specify markdown-raw_html as your input format. (Read: markdown minus raw_html.)

commit27304513f660cc158d73ec5684a01491fa1fed99 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 12 Aug 2012, 22:04 (14 years ago) parent6f24fdb
3 files changed+15−5
README+5−1 src/Text/Pandoc/Options.hs+4−1 src/Text/Pandoc/Readers/Markdown.hs+6−3
README+5−1
@@ -1854,9 +1854,13 @@ HTML, Slidy, DZSlides, S5, EPUB
18541854Raw HTML
18551855--------
18561856
1857+**Extenion: `raw_html`**
1858+
18571859Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
18581860(except verbatim contexts, where `<`, `>`, and `&` are interpreted
1859−literally).
1861+literally). (Techncially this is not an extension, since standard
1862+markdown allows it, but it has been made an extension so that it can
1863+be disabled if desired.)
18601864
18611865The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
18621866DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
src/Text/Pandoc/Options.hs+4−1
@@ -58,6 +58,7 @@ data Extension = Ext_footnotes
5858 | Ext_pipe_tables
5959 | Ext_citations
6060 | Ext_raw_tex
61+ | Ext_raw_html
6162 | Ext_tex_math_dollars
6263 | Ext_tex_math_single_backslash
6364 | Ext_tex_math_double_backslash
@@ -97,6 +98,7 @@ pandocExtensions = Set.fromList
9798 , Ext_pipe_tables
9899 , Ext_citations
99100 , Ext_raw_tex
101+ , Ext_raw_html
100102 , Ext_tex_math_dollars
101103 , Ext_latex_macros
102104 , Ext_delimited_code_blocks
@@ -119,7 +121,8 @@ pandocExtensions = Set.fromList
119121 ]
120122
121123strictExtensions :: Set Extension
122−strictExtensions = Set.empty
124+strictExtensions = Set.fromList
125+ [ Ext_raw_html ]
123126
124127data ReaderOptions = ReaderOptions{
125128 readerExtensions :: Set Extension -- ^ Syntax extensions
src/Text/Pandoc/Readers/Markdown.hs+6−3
@@ -729,9 +729,11 @@ htmlElement :: Parser [Char] ParserState String
729729htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
730730
731731htmlBlock :: Parser [Char] ParserState (F Blocks)
732−htmlBlock = return . B.rawBlock "html" <$>
733− ((guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
734− <|> htmlBlock')
732+htmlBlock = do
733+ guardEnabled Ext_raw_html
734+ res <- (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
735+ <|> htmlBlock'
736+ return $ return $ B.rawBlock "html" res
735737
736738htmlBlock' :: Parser [Char] ParserState String
737739htmlBlock' = try $ do
@@ -1507,6 +1509,7 @@ inBrackets parser = do
15071509
15081510rawHtmlInline :: Parser [Char] ParserState (F Inlines)
15091511rawHtmlInline = do
1512+ guardEnabled Ext_raw_html
15101513 mdInHtml <- option False $
15111514 guardEnabled Ext_markdown_in_html_blocks >> return True
15121515 (_,result) <- if mdInHtml