markdown
Version:
A sensible Markdown parser for javascript
50 lines (49 loc) • 2.24 kB
JSON
["html", ["p", "These should all get escaped:"],
["p", "Backslash: \\"],
["p", "Backtick: `"],
["p", "Asterisk: *"],
["p", "Underscore: _"],
["p", "Left brace: {"],
["p", "Right brace: }"],
["p", "Left bracket: ["],
["p", "Right bracket: ]"],
["p", "Left paren: ("],
["p", "Right paren: )"],
["p", "Greater-than: >"],
["p", "Hash: #"],
["p", "Period: ."],
["p", "Bang: !"],
["p", "Plus: +"],
["p", "Minus: -"],
["p", "These should not, because they occur within a code block:"],
["pre", ["code", "Backslash: \\\\\u000a\u000aBacktick: \\`\u000a\u000aAsterisk: \\*\u000a\u000aUnderscore: \\_\u000a\u000aLeft brace: \\{\u000a\u000aRight brace: \\}\u000a\u000aLeft bracket: \\[\u000a\u000aRight bracket: \\]\u000a\u000aLeft paren: \\(\u000a\u000aRight paren: \\)\u000a\u000aGreater-than: \\>\u000a\u000aHash: \\#\u000a\u000aPeriod: \\.\u000a\u000aBang: \\!\u000a\u000aPlus: \\+\u000a\u000aMinus: \\-\u000a"]],
["p", "Nor should these, which occur in code spans:"],
["p", "Backslash: ", ["code", "\\\\"]],
["p", "Backtick: ", ["code", "\\`"]],
["p", "Asterisk: ", ["code", "\\*"]],
["p", "Underscore: ", ["code", "\\_"]],
["p", "Left brace: ", ["code", "\\{"]],
["p", "Right brace: ", ["code", "\\}"]],
["p", "Left bracket: ", ["code", "\\["]],
["p", "Right bracket: ", ["code", "\\]"]],
["p", "Left paren: ", ["code", "\\("]],
["p", "Right paren: ", ["code", "\\)"]],
["p", "Greater-than: ", ["code", "\\>"]],
["p", "Hash: ", ["code", "\\#"]],
["p", "Period: ", ["code", "\\."]],
["p", "Bang: ", ["code", "\\!"]],
["p", "Plus: ", ["code", "\\+"]],
["p", "Minus: ", ["code", "\\-"]],
["p", "These should get escaped, even though they're matching pairs for\u000aother Markdown constructs:"],
["p", "*asterisks*"],
["p", "_underscores_"],
["p", "`backticks`"],
["p", "This is a code span with a literal backslash-backtick sequence: ", ["code", "\\`"]],
["p", "This is a tag with unescaped backticks ", ["span", {
"attr": "`ticks`"
},
"bar"], "."],
["p", "This is a tag with backslashes ", ["span", {
"attr": "\\\\backslashes\\\\"
},
"bar"], "."]]