diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-08-06 22:13:24 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-08-06 22:14:35 -0700 |
commit | 8a101cffe36f4d6301ff45fd1b491bad1fcf1244 (patch) | |
tree | 30613e2563ded117b6aa0bb5f0c08d872edf3517 /src/Text/Pandoc | |
parent | dc071f807dcc0cfc2f6d9860a7c0878db6aded0c (diff) | |
download | pandoc-8a101cffe36f4d6301ff45fd1b491bad1fcf1244.tar.gz |
Support hard_line_breaks markdown extension.
* Added Ext_hard_line_breaks.
* Added section in README on non-pandoc extensions.
* Exported pandocExtensions and strictExtensions in Text.Pandoc.Options.
Closes #514.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 41 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 46200d8f3..5fe92c1fd 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -29,6 +29,8 @@ Data structures and functions for representing parser and writer options. -} module Text.Pandoc.Options ( Extension(..) + , pandocExtensions + , strictExtensions , ReaderOptions(..) , HTMLMathMethod (..) , CiteMethod (..) @@ -74,8 +76,47 @@ data Extension = Ext_footnotes | Ext_strikeout | Ext_superscript | Ext_subscript + | Ext_hard_line_breaks deriving (Show, Read, Enum, Eq, Ord, Bounded) +pandocExtensions :: Set Extension +pandocExtensions = Set.fromList + [ Ext_footnotes + , Ext_inline_notes + , Ext_pandoc_title_blocks + , Ext_table_captions + -- , Ext_image_captions + , Ext_simple_tables + , Ext_multiline_tables + , Ext_grid_tables + , Ext_pipe_tables + , Ext_citations + , Ext_raw_tex + , Ext_tex_math + , Ext_latex_macros + , Ext_delimited_code_blocks + , Ext_inline_code_attributes + , Ext_markdown_in_html_blocks + , Ext_escaped_line_breaks + , Ext_autolink_code_spans + , Ext_fancy_lists + , Ext_startnum + , Ext_definition_lists + , Ext_example_lists + -- , Ext_header_identifiers + , Ext_all_symbols_escapable + , Ext_intraword_underscores + , Ext_blank_before_blockquote + , Ext_blank_before_header + -- , Ext_significant_bullets + , Ext_strikeout + , Ext_superscript + , Ext_subscript + ] + +strictExtensions :: Set Extension +strictExtensions = Set.empty + data ReaderOptions = ReaderOptions{ readerExtensions :: Set Extension -- ^ Syntax extensions , readerSmart :: Bool -- ^ Smart punctuation diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 795935860..030e677c8 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1321,7 +1321,8 @@ endline = try $ do when (stateParserContext st == ListItemState) $ do notFollowedBy' bulletListStart notFollowedBy' anyOrderedListStart - return $ return B.space + (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak)) + <|> (return $ return B.space) -- -- links |