git.iko.soy/typeable/pandoc
on master help sign in
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.

commit696dfbc993691933f01241bbb7f2f379f45b99a5 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 22 Oct 2016, 23:41 (10 years ago) parentd2a6533
3 files changed+12−2
MANUAL.txt+7−1 src/Text/Pandoc/Options.hs+3−1 src/Text/Pandoc/Readers/Markdown.hs+2
MANUAL.txt+7−1
@@ -3332,6 +3332,12 @@ in pandoc, but may be enabled by adding `+EXTENSION` to the format
33323332name, where `EXTENSION` is the name of the extension. Thus, for
33333333example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
33343334
3335+#### Extension: `angle_brackets_escapable` ####
3336+
3337+Allow `<` and `>` to be backslash-escaped, as they can be in
3338+GitHub flavored Markdown but not original Markdown. This is
3339+implied by pandoc's default `all_symbols_escapable`.
3340+
33353341#### Extension: `lists_without_preceding_blankline` ####
33363342
33373343Allow a list to occur right after a paragraph, with no intervening
@@ -3475,7 +3481,7 @@ variants are supported:
34753481: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
34763482 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
34773483 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
3478− `shortcut_reference_links`.
3484+ `shortcut_reference_links`, `angle_brackets_escapable`.
34793485
34803486`markdown_mmd` (MultiMarkdown)
34813487: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
src/Text/Pandoc/Options.hs+3−1
@@ -101,6 +101,7 @@ data Extension =
101101 -- space between items, and disallow laziness
102102 | Ext_example_lists -- ^ Markdown-style numbered examples
103103 | Ext_all_symbols_escapable -- ^ Make all non-alphanumerics escapable
104+ | Ext_angle_brackets_escapable -- ^ Make < and > escapable
104105 | Ext_intraword_underscores -- ^ Treat underscore inside word as literal
105106 | Ext_blank_before_blockquote -- ^ Require blank line before a blockquote
106107 | Ext_blank_before_header -- ^ Require blank line before a header
@@ -204,7 +205,8 @@ phpMarkdownExtraExtensions = Set.fromList
204205
205206githubMarkdownExtensions :: Set Extension
206207githubMarkdownExtensions = Set.fromList
207− [ Ext_pipe_tables
208+ [ Ext_angle_brackets_escapable
209+ , Ext_pipe_tables
208210 , Ext_raw_html
209211 , Ext_fenced_code_blocks
210212 , Ext_auto_identifiers
src/Text/Pandoc/Readers/Markdown.hs+2
@@ -1507,6 +1507,8 @@ escapedChar' :: MarkdownParser Char
15071507escapedChar' = try $ do
15081508 char '\\'
15091509 (guardEnabled Ext_all_symbols_escapable >> satisfy (not . isAlphaNum))
1510+ <|> (guardEnabled Ext_angle_brackets_escapable >>
1511+ oneOf "\\`*_{}[]()>#+-.!~\"<>")
15101512 <|> oneOf "\\`*_{}[]()>#+-.!~\""
15111513
15121514escapedChar :: MarkdownParser (F Inlines)