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.
This commit is contained in:
parent
dc071f807d
commit
8a101cffe3
4 changed files with 55 additions and 3 deletions
10
README
10
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
|
||||
=================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue