git.iko.soy/typeable/pandoc
on master help sign in
Added Ext_raw_html extension.
2730451John MacFarlane
README+5−1
@@ -1854,9 +1854,13 @@ HTML, Slidy, DZSlides, S5, EPUB
1854Raw HTML
1854Raw HTML
1855--------
1855--------
1856
1856
1857+**Extenion: `raw_html`**
1858+
1857Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
1859Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
1858(except verbatim contexts, where `<`, `>`, and `&` are interpreted
1860(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.)
1860
1864
1861The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
1865The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
1862DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
1866DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
src/Text/Pandoc/Options.hs+4−1
@@ -58,6 +58,7 @@ data Extension = Ext_footnotes
58 | Ext_pipe_tables
58 | Ext_pipe_tables
59 | Ext_citations
59 | Ext_citations
60 | Ext_raw_tex
60 | Ext_raw_tex
61+ | Ext_raw_html
61 | Ext_tex_math_dollars
62 | Ext_tex_math_dollars
62 | Ext_tex_math_single_backslash
63 | Ext_tex_math_single_backslash
63 | Ext_tex_math_double_backslash
64 | Ext_tex_math_double_backslash
@@ -97,6 +98,7 @@ pandocExtensions = Set.fromList
97 , Ext_pipe_tables
98 , Ext_pipe_tables
98 , Ext_citations
99 , Ext_citations
99 , Ext_raw_tex
100 , Ext_raw_tex
101+ , Ext_raw_html
100 , Ext_tex_math_dollars
102 , Ext_tex_math_dollars
101 , Ext_latex_macros
103 , Ext_latex_macros
102 , Ext_delimited_code_blocks
104 , Ext_delimited_code_blocks
@@ -119,7 +121,8 @@ pandocExtensions = Set.fromList
119 ]
121 ]
120
122
121strictExtensions :: Set Extension
123strictExtensions :: Set Extension
122−strictExtensions = Set.empty
124+strictExtensions = Set.fromList
125+ [ Ext_raw_html ]
123
126
124data ReaderOptions = ReaderOptions{
127data ReaderOptions = ReaderOptions{
125 readerExtensions :: Set Extension -- ^ Syntax extensions
128 readerExtensions :: Set Extension -- ^ Syntax extensions
src/Text/Pandoc/Readers/Markdown.hs+6−3
@@ -729,9 +729,11 @@ htmlElement :: Parser [Char] ParserState String
729htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
729htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
730
730
731htmlBlock :: Parser [Char] ParserState (F Blocks)
731htmlBlock :: Parser [Char] ParserState (F Blocks)
732−htmlBlock = return . B.rawBlock "html" <$>
732+htmlBlock = do
733+ guardEnabled Ext_raw_html
733− ((guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
734+ res <- (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
734− <|> htmlBlock')
735+ <|> htmlBlock'
736+ return $ return $ B.rawBlock "html" res
735
737
736htmlBlock' :: Parser [Char] ParserState String
738htmlBlock' :: Parser [Char] ParserState String
737htmlBlock' = try $ do
739htmlBlock' = try $ do
@@ -1507,6 +1509,7 @@ inBrackets parser = do
1507
1509
1508rawHtmlInline :: Parser [Char] ParserState (F Inlines)
1510rawHtmlInline :: Parser [Char] ParserState (F Inlines)
1509rawHtmlInline = do
1511rawHtmlInline = do
1512+ guardEnabled Ext_raw_html
1510 mdInHtml <- option False $
1513 mdInHtml <- option False $
1511 guardEnabled Ext_markdown_in_html_blocks >> return True
1514 guardEnabled Ext_markdown_in_html_blocks >> return True
1512 (_,result) <- if mdInHtml
1515 (_,result) <- if mdInHtml