Markdown writer: better escaping of <
and >
.
If `all_symbols_escapable` is set, we backslash escape these. Otherwise we use entities as before.
This commit is contained in:
parent
8cbc28415e
commit
b8afec05e0
2 changed files with 10 additions and 6 deletions
|
@ -280,8 +280,12 @@ escapeString :: WriterOptions -> String -> String
|
|||
escapeString _ [] = []
|
||||
escapeString opts (c:cs) =
|
||||
case c of
|
||||
'<' -> "<" ++ escapeString opts cs
|
||||
'>' -> ">" ++ escapeString opts cs
|
||||
'<' | isEnabled Ext_all_symbols_escapable opts ->
|
||||
'\\' : '<' : escapeString opts cs
|
||||
| otherwise -> "<" ++ escapeString opts cs
|
||||
'>' | isEnabled Ext_all_symbols_escapable opts ->
|
||||
'\\' : '>' : escapeString opts cs
|
||||
| otherwise -> ">" ++ escapeString opts cs
|
||||
_ | c `elem` ['\\','`','*','_','[',']','#'] ->
|
||||
'\\':c:escapeString opts cs
|
||||
'^' | isEnabled Ext_superscript opts -> '\\':'^':escapeString opts cs
|
||||
|
|
|
@ -80,7 +80,7 @@ E-mail style:
|
|||
>
|
||||
> > nested
|
||||
|
||||
This should not be a block quote: 2 > 1.
|
||||
This should not be a block quote: 2 \> 1.
|
||||
|
||||
And a following paragraph.
|
||||
|
||||
|
@ -580,9 +580,9 @@ AT&T is another way to write it.
|
|||
|
||||
This & that.
|
||||
|
||||
4 < 5.
|
||||
4 \< 5.
|
||||
|
||||
6 > 5.
|
||||
6 \> 5.
|
||||
|
||||
Backslash: \\
|
||||
|
||||
|
@ -604,7 +604,7 @@ Left paren: (
|
|||
|
||||
Right paren: )
|
||||
|
||||
Greater-than: >
|
||||
Greater-than: \>
|
||||
|
||||
Hash: \#
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue