Skip to content

Commit

Permalink
Added lists_without_preceding_blankline extension.
Browse files Browse the repository at this point in the history
* Added `Ext_lists_without_preceding_blankline` to
  `Extension` in `Options`.  Added this option to
  `githubMarkdownExtensions`.
* Made markdown reader sensitive to this.
* Closes #972.
  • Loading branch information
jgm committed Sep 7, 2013
1 parent 91550dd commit 5afd373
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,10 @@ in pandoc, but may be enabled by adding `+EXTENSION` to the format
name, where `EXTENSION` is the name of the extension. Thus, for
example, `markdown+hard_line_breaks` is markdown with hard line breaks.

**Extension: `lists_without_preceding_blankline`**\
Allow a list to occur right after a paragraph, with no intervening
blank space.

**Extension: `hard_line_breaks`**\
Causes all newlines within a paragraph to be interpreted as hard line
breaks instead of spaces.
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Pandoc/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ data Extension =
| Ext_link_attributes -- ^ MMD style reference link attributes
| Ext_autolink_bare_uris -- ^ Make all absolute URIs into links
| Ext_fancy_lists -- ^ Enable fancy list numbers and delimiters
| Ext_lists_without_preceding_blankline -- ^ Allow lists without preceding blank
| Ext_startnum -- ^ Make start number of ordered list significant
| Ext_definition_lists -- ^ Definition lists as in pandoc, mmd, php
| Ext_example_lists -- ^ Markdown-style numbered examples
Expand Down Expand Up @@ -169,6 +170,7 @@ githubMarkdownExtensions = Set.fromList
, Ext_intraword_underscores
, Ext_strikeout
, Ext_hard_line_breaks
, Ext_lists_without_preceding_blankline
]

multimarkdownExtensions :: Set Extension
Expand Down
1 change: 1 addition & 0 deletions src/Text/Pandoc/Readers/Markdown.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,7 @@ endline :: MarkdownParser (F Inlines)
endline = try $ do
newline
notFollowedBy blankline
guardDisabled Ext_lists_without_preceding_blankline <|> notFollowedBy listStart
guardEnabled Ext_blank_before_blockquote <|> notFollowedBy emailBlockQuoteStart
guardEnabled Ext_blank_before_header <|> notFollowedBy (char '#') -- atx header
-- parse potential list-starts differently if in a list:
Expand Down

0 comments on commit 5afd373

Please sign in to comment.