diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-07-17 15:38:56 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-07-17 15:38:56 -0700 |
commit | 6c2e76ac617e5972db5d118525e7f6f59f43caac (patch) | |
tree | 12a19510a326ebb389ebfc80ec1543ee546090db | |
parent | 7d75b913bd45c41abefbc055163cf455c4b37b65 (diff) | |
download | pandoc-6c2e76ac617e5972db5d118525e7f6f59f43caac.tar.gz |
Added `ignore_line_breaks` markdown extension.
This causes intra-paragraph line breaks to be ignored,
rather than being treated as hard line breaks or spaces.
This is useful for some East Asian languages, where spaces
aren't used between words, but text is separated into lines
for readability.
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Options.hs | 1 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 1 |
3 files changed, 8 insertions, 0 deletions
@@ -2416,6 +2416,12 @@ example, `markdown+hard_line_breaks` is markdown with hard line breaks. Causes all newlines within a paragraph to be interpreted as hard line breaks instead of spaces. +**Extension: `ignore_line_breaks`**\ +Causes newlines within a paragraph to be ignored, rather than being +treated as spaces or as hard line breaks. This option is intended for +use with East Asian languages where spaces are not used between words, +but text is divided into lines for readability. + **Extension: `tex_math_single_backslash`**\ Causes anything between `\(` and `\)` to be interpreted as inline TeX math, and anything between `\[` and `\]` to be interpreted diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index c9a5e27da..61a85cf6e 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -92,6 +92,7 @@ data Extension = | Ext_superscript -- ^ Superscript using ^this^ syntax | Ext_subscript -- ^ Subscript using ~this~ syntax | Ext_hard_line_breaks -- ^ All newlines become hard line breaks + | Ext_ignore_line_breaks -- ^ Newlines in paragraphs are ignored | Ext_literate_haskell -- ^ Enable literate Haskell conventions | Ext_abbreviations -- ^ PHP markdown extra abbreviation definitions | Ext_auto_identifiers -- ^ Automatic identifiers for headers diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index a3500fbcf..1aa392162 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1566,6 +1566,7 @@ endline = try $ do notFollowedBy' bulletListStart notFollowedBy' anyOrderedListStart (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak)) + <|> (guardEnabled Ext_ignore_line_breaks >> return mempty) <|> (return $ return B.space) -- |