diff --git a/README b/README index 6701d6e6c..4d495f38c 100644 --- a/README +++ b/README @@ -2171,6 +2171,16 @@ document with an appropriate header: The bibliography will be inserted after this header. +Non-pandoc extensions +===================== + +The following markdown syntax extensions are not enabled by default +in pandoc, but can be enabled using the `-e` (`--enable`) option: + +**Extension: `hard_line_breaks`**\ +Causes all newlines within a paragraph to be interpreted as hard line +breaks instead of spaces. + Producing slide shows with Pandoc ================================= 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 diff --git a/src/pandoc.hs b/src/pandoc.hs index 549378ef0..50dfb59f3 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -964,8 +964,8 @@ main = do else takeDirectory (head sources) let defaultExts = if strict - then Set.empty - else Set.fromList [minBound..maxBound] + then strictExtensions + else pandocExtensions let extensions = foldl (\acc (inc,ext) -> if inc then Set.insert ext acc