allow \~ to escape as ~

This commit is contained in:
athom 2013-10-01 15:15:55 +08:00
parent ca82b8db3a
commit 4c11f72496
3 changed files with 13 additions and 1 deletions

View File

@ -549,7 +549,7 @@ func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int {
}
// '\\' backslash escape
var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>")
var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~")
func escape(p *parser, out *bytes.Buffer, data []byte, offset int) int {
data = data[offset:]

View File

@ -32,6 +32,8 @@
<p>Minus: -</p>
<p>Tilde: ~</p>
<p>These should not, because they occur within a code block:</p>
<pre><code>Backslash: \\
@ -65,6 +67,8 @@ Bang: \!
Plus: \+
Minus: \-
Tilde: \~
</code></pre>
<p>Nor should these, which occur in code spans:</p>
@ -101,6 +105,8 @@ Minus: \-
<p>Minus: <code>\-</code></p>
<p>Tilde: <code>\~</code></p>
<p>These should get escaped, even though they're matching pairs for
other Markdown constructs:</p>

View File

@ -32,6 +32,8 @@ Plus: \+
Minus: \-
Tilde: \~
These should not, because they occur within a code block:
@ -68,6 +70,8 @@ These should not, because they occur within a code block:
Minus: \-
Tilde: \~
Nor should these, which occur in code spans:
@ -103,6 +107,8 @@ Plus: `\+`
Minus: `\-`
Tilde: `\~`
These should get escaped, even though they're matching pairs for
other Markdown constructs: