backslash_escapes.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <p>These should all get escaped:</p>
  2. <p>Backslash: \</p>
  3. <p>Backtick: `</p>
  4. <p>Asterisk: *</p>
  5. <p>Underscore: _</p>
  6. <p>Left brace: {</p>
  7. <p>Right brace: }</p>
  8. <p>Left bracket: [</p>
  9. <p>Right bracket: ]</p>
  10. <p>Left paren: (</p>
  11. <p>Right paren: )</p>
  12. <p>Greater-than: ></p>
  13. <p>Hash: #</p>
  14. <p>Period: .</p>
  15. <p>Bang: !</p>
  16. <p>Plus: +</p>
  17. <p>Minus: -</p>
  18. <p>These should not, because they occur within a code block:</p>
  19. <pre><code>Backslash: \\
  20. Backtick: \`
  21. Asterisk: \*
  22. Underscore: \_
  23. Left brace: \{
  24. Right brace: \}
  25. Left bracket: \[
  26. Right bracket: \]
  27. Left paren: \(
  28. Right paren: \)
  29. Greater-than: \&gt;
  30. Hash: \#
  31. Period: \.
  32. Bang: \!
  33. Plus: \+
  34. Minus: \-
  35. </code></pre>
  36. <p>Nor should these, which occur in code spans:</p>
  37. <p>Backslash: <code>\\</code></p>
  38. <p>Backtick: <code>\`</code></p>
  39. <p>Asterisk: <code>\*</code></p>
  40. <p>Underscore: <code>\_</code></p>
  41. <p>Left brace: <code>\{</code></p>
  42. <p>Right brace: <code>\}</code></p>
  43. <p>Left bracket: <code>\[</code></p>
  44. <p>Right bracket: <code>\]</code></p>
  45. <p>Left paren: <code>\(</code></p>
  46. <p>Right paren: <code>\)</code></p>
  47. <p>Greater-than: <code>\&gt;</code></p>
  48. <p>Hash: <code>\#</code></p>
  49. <p>Period: <code>\.</code></p>
  50. <p>Bang: <code>\!</code></p>
  51. <p>Plus: <code>\+</code></p>
  52. <p>Minus: <code>\-</code></p>
  53. <p>These should get escaped, even though they&#39;re matching pairs for
  54. other Markdown constructs:</p>
  55. <p>*asterisks*</p>
  56. <p>_underscores_</p>
  57. <p>`backticks`</p>
  58. <p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
  59. <p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
  60. <p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>