aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-10-22 23:41:55 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2016-10-22 23:41:55 +0200
commit696dfbc993691933f01241bbb7f2f379f45b99a5 (patch)
tree68889a4093ab6ba018a8e6b8e20bc1abc492d134 /src
parentd2a6533d6e3385f5c7ff2e6b48e4c3aa8fae0ff0 (diff)
downloadpandoc-696dfbc993691933f01241bbb7f2f379f45b99a5.tar.gz
Added `angle_brackets_escapable` extension.
This is needed because github flavored Markdown has a slightly different set of escapable symbols than original Markdown; it includes angle brackets. Closes #2846.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Options.hs4
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 575250b9e..6c7dde488 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -101,6 +101,7 @@ data Extension =
-- space between items, and disallow laziness
| Ext_example_lists -- ^ Markdown-style numbered examples
| Ext_all_symbols_escapable -- ^ Make all non-alphanumerics escapable
+ | Ext_angle_brackets_escapable -- ^ Make < and > escapable
| Ext_intraword_underscores -- ^ Treat underscore inside word as literal
| Ext_blank_before_blockquote -- ^ Require blank line before a blockquote
| Ext_blank_before_header -- ^ Require blank line before a header
@@ -204,7 +205,8 @@ phpMarkdownExtraExtensions = Set.fromList
githubMarkdownExtensions :: Set Extension
githubMarkdownExtensions = Set.fromList
- [ Ext_pipe_tables
+ [ Ext_angle_brackets_escapable
+ , Ext_pipe_tables
, Ext_raw_html
, Ext_fenced_code_blocks
, Ext_auto_identifiers
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 68bc936b1..2337b733a 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1507,6 +1507,8 @@ escapedChar' :: MarkdownParser Char
escapedChar' = try $ do
char '\\'
(guardEnabled Ext_all_symbols_escapable >> satisfy (not . isAlphaNum))
+ <|> (guardEnabled Ext_angle_brackets_escapable >>
+ oneOf "\\`*_{}[]()>#+-.!~\"<>")
<|> oneOf "\\`*_{}[]()>#+-.!~\""
escapedChar :: MarkdownParser (F Inlines)