git.iko.soy/typeable/pandoc
on master help sign in
Support hard_line_breaks markdown extension.
8a101cfJohn MacFarlane
@@ -2171,6 +2171,16 @@ document with an appropriate header:
2171
2171
2172The bibliography will be inserted after this header.
2172The bibliography will be inserted after this header.
2173
2173
2174+Non-pandoc extensions
2175+=====================
2176+
2177+The following markdown syntax extensions are not enabled by default
2178+in pandoc, but can be enabled using the `-e` (`--enable`) option:
2179+
2180+**Extension: `hard_line_breaks`**\
2181+Causes all newlines within a paragraph to be interpreted as hard line
2182+breaks instead of spaces.
2183+
2174
2184
2175Producing slide shows with Pandoc
2185Producing slide shows with Pandoc
2176=================================
2186=================================
src/Text/Pandoc/Options.hs+41
@@ -29,6 +29,8 @@ Data structures and functions for representing parser and writer
29options.
29options.
30-}
30-}
31module Text.Pandoc.Options ( Extension(..)
31module Text.Pandoc.Options ( Extension(..)
32+ , pandocExtensions
33+ , strictExtensions
32 , ReaderOptions(..)
34 , ReaderOptions(..)
33 , HTMLMathMethod (..)
35 , HTMLMathMethod (..)
34 , CiteMethod (..)
36 , CiteMethod (..)
@@ -74,8 +76,47 @@ data Extension = Ext_footnotes
74 | Ext_strikeout
76 | Ext_strikeout
75 | Ext_superscript
77 | Ext_superscript
76 | Ext_subscript
78 | Ext_subscript
79+ | Ext_hard_line_breaks
77 deriving (Show, Read, Enum, Eq, Ord, Bounded)
80 deriving (Show, Read, Enum, Eq, Ord, Bounded)
78
81
82+pandocExtensions :: Set Extension
83+pandocExtensions = Set.fromList
84+ [ Ext_footnotes
85+ , Ext_inline_notes
86+ , Ext_pandoc_title_blocks
87+ , Ext_table_captions
88+ -- , Ext_image_captions
89+ , Ext_simple_tables
90+ , Ext_multiline_tables
91+ , Ext_grid_tables
92+ , Ext_pipe_tables
93+ , Ext_citations
94+ , Ext_raw_tex
95+ , Ext_tex_math
96+ , Ext_latex_macros
97+ , Ext_delimited_code_blocks
98+ , Ext_inline_code_attributes
99+ , Ext_markdown_in_html_blocks
100+ , Ext_escaped_line_breaks
101+ , Ext_autolink_code_spans
102+ , Ext_fancy_lists
103+ , Ext_startnum
104+ , Ext_definition_lists
105+ , Ext_example_lists
106+ -- , Ext_header_identifiers
107+ , Ext_all_symbols_escapable
108+ , Ext_intraword_underscores
109+ , Ext_blank_before_blockquote
110+ , Ext_blank_before_header
111+ -- , Ext_significant_bullets
112+ , Ext_strikeout
113+ , Ext_superscript
114+ , Ext_subscript
115+ ]
116+
117+strictExtensions :: Set Extension
118+strictExtensions = Set.empty
119+
79data ReaderOptions = ReaderOptions{
120data ReaderOptions = ReaderOptions{
80 readerExtensions :: Set Extension -- ^ Syntax extensions
121 readerExtensions :: Set Extension -- ^ Syntax extensions
81 , readerSmart :: Bool -- ^ Smart punctuation
122 , readerSmart :: Bool -- ^ Smart punctuation
src/Text/Pandoc/Readers/Markdown.hs+2−1
@@ -1321,7 +1321,8 @@ endline = try $ do
1321 when (stateParserContext st == ListItemState) $ do
1321 when (stateParserContext st == ListItemState) $ do
1322 notFollowedBy' bulletListStart
1322 notFollowedBy' bulletListStart
1323 notFollowedBy' anyOrderedListStart
1323 notFollowedBy' anyOrderedListStart
1324+ (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak))
1324− return $ return B.space
1325+ <|> (return $ return B.space)
1325
1326
1326--
1327--
1327-- links
1328-- links
src/pandoc.hs+2−2
@@ -964,8 +964,8 @@ main = do
964 else takeDirectory (head sources)
964 else takeDirectory (head sources)
965
965
966 let defaultExts = if strict
966 let defaultExts = if strict
967− then Set.empty
967+ then strictExtensions
968− else Set.fromList [minBound..maxBound]
968+ else pandocExtensions
969
969
970 let extensions = foldl (\acc (inc,ext) -> if inc
970 let extensions = foldl (\acc (inc,ext) -> if inc
971 then Set.insert ext acc
971 then Set.insert ext acc