diff --git a/src/muya/lib/parser/marked/README.md b/src/muya/lib/parser/marked/README.md index 0b72ee34..a7341330 100644 --- a/src/muya/lib/parser/marked/README.md +++ b/src/muya/lib/parser/marked/README.md @@ -1,6 +1,6 @@ # Marked -This folder contains a patched [Marked.js](https://github.com/markedjs/marked/) version based on `v0.7.0` commit [16a6495326b2fe7623840d4054b0deba5afbc00a](https://github.com/markedjs/marked/commit/16a6495326b2fe7623840d4054b0deba5afbc00a). +This folder contains a patched [Marked.js](https://github.com/markedjs/marked/) version based on `v0.8.2` and bug fixes from `v1.2.5`, no breaking changes from `v1.0.0` are included. ## Changes diff --git a/src/muya/lib/parser/marked/blockRules.js b/src/muya/lib/parser/marked/blockRules.js index a9a26333..cf5e9b73 100644 --- a/src/muya/lib/parser/marked/blockRules.js +++ b/src/muya/lib/parser/marked/blockRules.js @@ -9,17 +9,17 @@ import { edit, noop } from './utils' export const block = { newline: /^\n+/, code: /^( {4}[^\n]+\n*)+/, - fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, + fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, - heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/, + heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, html: '^ {0,3}(?:' + // optional indentation '<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' + // (1) '|comment[^\\n]*(\\n+|$)' + // (2) - '|<\\?[\\s\\S]*?\\?>\\n*' + // (3) - '|\\n*' + // (4) - '|\\n*' + // (5) + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' + // (3) + '|\\n*|$)' + // (4) + '|\\n*|$)' + // (5) '|)[\\s\\S]*?(?:\\n{2,}|$)' + // (6) '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' + // (7) open tag '|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' + // (7) closing tag @@ -68,7 +68,7 @@ block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul' -block._comment = // +block._comment = /|$)/ block.html = edit(block.html, 'i') .replace('comment', block._comment) .replace('tag', block._tag) @@ -77,10 +77,10 @@ block.html = edit(block.html, 'i') block.paragraph = edit(block._paragraph) .replace('hr', block.hr) - .replace('heading', ' {0,3}#{1,6} +') + .replace('heading', ' {0,3}#{1,6} ') .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs .replace('blockquote', ' {0,3}>') - .replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt .replace('html', ')|<(?:script|pre|style|!--)') .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks @@ -101,10 +101,36 @@ export const normal = Object.assign({}, block) */ export const gfm = Object.assign({}, normal, { - nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, - table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ + nptable: '^ *([^|\\n ].*\\|.*)\\n' + // Header + ' {0,3}([-:]+ *\\|[-| :]*)' + // Align + '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)', // Cells + table: '^ *\\|(.+)\\n' + // Header + ' {0,3}\\|?( *[-:]+[-| :]*)' + // Align + '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells }) +gfm.nptable = edit(gfm.nptable) + .replace('hr', block.hr) + .replace('heading', ' {0,3}#{1,6} ') + .replace('blockquote', ' {0,3}>') + .replace('code', ' {4}[^\\n]') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') + .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt + .replace('html', ')|<(?:script|pre|style|!--)') + .replace('tag', block._tag) // tables can be interrupted by type (6) html blocks + .getRegex() + +gfm.table = edit(gfm.table) + .replace('hr', block.hr) + .replace('heading', ' {0,3}#{1,6} ') + .replace('blockquote', ' {0,3}>') + .replace('code', ' {4}[^\\n]') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') + .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt + .replace('html', ')|<(?:script|pre|style|!--)') + .replace('tag', block._tag) // tables can be interrupted by type (6) html blocks + .getRegex() + /** * Pedantic grammar (original John Gruber's loose markdown specification) */ @@ -121,7 +147,7 @@ export const pedantic = Object.assign({}, normal, { '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') .getRegex(), def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/, + heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: noop, // fences not supported paragraph: edit(normal._paragraph) .replace('hr', block.hr) diff --git a/src/muya/lib/parser/marked/inlineLexer.js b/src/muya/lib/parser/marked/inlineLexer.js index 4afeed0d..d2140528 100644 --- a/src/muya/lib/parser/marked/inlineLexer.js +++ b/src/muya/lib/parser/marked/inlineLexer.js @@ -1,7 +1,7 @@ import Renderer from './renderer' import { normal, breaks, gfm, pedantic } from './inlineRules' import defaultOptions from './options' -import { escape, findClosingBracket, getUniqueId } from './utils' +import { escape, findClosingBracket, getUniqueId, rtrim } from './utils' import { validateEmphasize, lowerPriority } from '../utils' /** @@ -107,42 +107,65 @@ InlineLexer.prototype.output = function (src) { src = src.substring(cap[0].length) lastChar = cap[0].charAt(cap[0].length - 1) - out += this.options.sanitize - ? this.options.sanitizer + out += this.renderer.html(this.options.sanitize + ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) - : escape(cap[0]) - : cap[0] + : escape(cap[0])) + : cap[0]) continue } // link cap = this.rules.link.exec(src) if (cap && lowerPriority(src, cap[0].length, this.highPriorityLinkRules)) { - const lastParenIndex = findClosingBracket(cap[2], '()') - if (lastParenIndex > -1) { - const start = cap[0].indexOf('!') === 0 ? 5 : 4 - const linkLen = start + cap[1].length + lastParenIndex - cap[2] = cap[2].substring(0, lastParenIndex) - cap[0] = cap[0].substring(0, linkLen).trim() - cap[3] = '' + const trimmedUrl = cap[2].trim() + if (!this.options.pedantic && trimmedUrl.startsWith('<')) { + // commonmark requires matching angle brackets + if (!trimmedUrl.endsWith('>')) { + return + } + + // ending angle bracket cannot be escaped + const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\') + if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { + return + } + } else { + // find closing parenthesis + const lastParenIndex = findClosingBracket(cap[2], '()') + if (lastParenIndex > -1) { + const start = cap[0].indexOf('!') === 0 ? 5 : 4 + const linkLen = start + cap[1].length + lastParenIndex + cap[2] = cap[2].substring(0, lastParenIndex) + cap[0] = cap[0].substring(0, linkLen).trim() + cap[3] = '' + } } src = src.substring(cap[0].length) lastChar = cap[0].charAt(cap[0].length - 1) - this.inLink = true href = cap[2] if (this.options.pedantic) { + // split pedantic href and title link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href) if (link) { href = link[1] title = link[3] - } else { - title = '' } } else { title = cap[3] ? cap[3].slice(1, -1) : '' } - href = href.trim().replace(/^<([\s\S]*)>$/, '$1') + href = href.trim() + if (href.startsWith('<')) { + if (this.options.pedantic && !trimmedUrl.endsWith('>')) { + // pedantic allows starting angle bracket without ending angle bracket + href = href.slice(1) + } else { + href = href.slice(1, -1) + } + } + + this.inLink = true out += this.outputLink(cap, { href: this.escapes(href), title: this.escapes(title) @@ -234,7 +257,15 @@ InlineLexer.prototype.output = function (src) { if (cap) { src = src.substring(cap[0].length) lastChar = cap[0].charAt(cap[0].length - 1) - out += this.renderer.codespan(escape(cap[2].trim(), true)) + + let text = cap[2].replace(/\n/g, ' ') + const hasNonSpaceChars = /[^ ]/.test(text) + const hasSpaceCharsOnBothEnds = text.startsWith(' ') && text.endsWith(' ') + if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { + text = text.substring(1, text.length - 1) + } + text = escape(text, true) + out += this.renderer.codespan(text) continue } @@ -252,7 +283,7 @@ InlineLexer.prototype.output = function (src) { if (cap) { src = src.substring(cap[0].length) lastChar = cap[0].charAt(cap[0].length - 1) - out += this.renderer.del(this.output(cap[1])) + out += this.renderer.del(this.output(cap[2])) continue } @@ -329,10 +360,11 @@ InlineLexer.prototype.escapes = function (text) { InlineLexer.prototype.outputLink = function (cap, link) { const href = link.href const title = link.title ? escape(link.title) : null + const text = cap[1].replace(/\\([\[\]])/g, '$1') // eslint-disable-line no-useless-escape return cap[0].charAt(0) !== '!' - ? this.renderer.link(href, title, this.output(cap[1])) - : this.renderer.image(href, title, escape(cap[1])) + ? this.renderer.link(href, title, this.output(text)) + : this.renderer.image(href, title, escape(text)) } /** diff --git a/src/muya/lib/parser/marked/inlineRules.js b/src/muya/lib/parser/marked/inlineRules.js index 5eb11530..cc0de116 100644 --- a/src/muya/lib/parser/marked/inlineRules.js +++ b/src/muya/lib/parser/marked/inlineRules.js @@ -30,7 +30,7 @@ const inline = { // patched // allow inline math "$" and superscript ("?=[\\?@\\[^_{|}~' +// without , to work around example 393 +inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~' + +inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex() + inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex() inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g @@ -62,12 +66,12 @@ inline.autolink = edit(inline.autolink) inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/ inline.tag = edit(inline.tag) - .replace('comment', block._comment) + .replace('comment', inline._comment) .replace('attribute', inline._attribute) .getRegex() -inline._label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/ -inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/ // eslint-disable-line no-control-regex +inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/ +inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/ // eslint-disable-line no-control-regex inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/ inline.link = edit(inline.link) @@ -110,13 +114,13 @@ export const gfm = Object.assign({}, normal, { _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, - del: /^~+(?=\S)([\s\S]*?\S)~+/, + del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, // ------------------------ // patched // allow inline math "$" and emoji ":" and superscrpt "^" ("?=[\\ { + const matchIndentInNode = node.match(/^\s+/) + if (matchIndentInNode === null) { + return node + } + + const [indentInNode] = matchIndentInNode + + if (indentInNode.length >= indentToCode.length) { + return node.slice(indentToCode.length) + } + + return node + }) + .join('\n') +} + export default Lexer diff --git a/src/muya/lib/parser/marked/slugger.js b/src/muya/lib/parser/marked/slugger.js index 35ec425c..e254328a 100644 --- a/src/muya/lib/parser/marked/slugger.js +++ b/src/muya/lib/parser/marked/slugger.js @@ -14,6 +14,9 @@ Slugger.prototype.slug = function (value) { let slug = value .toLowerCase() .trim() + // remove html tags + .replace(/<[!\/a-z].*?>/ig, '') // eslint-disable-line no-useless-escape + // remove unwanted chars .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '') .replace(/\s/g, '-') diff --git a/src/muya/lib/parser/marked/textRenderer.js b/src/muya/lib/parser/marked/textRenderer.js index 48eea575..3948cb24 100644 --- a/src/muya/lib/parser/marked/textRenderer.js +++ b/src/muya/lib/parser/marked/textRenderer.js @@ -15,6 +15,10 @@ TextRenderer.prototype.text = function (text) { return text } +TextRenderer.prototype.html = function (html) { + return html +} + TextRenderer.prototype.inlineMath = function (math, displayMode) { return math } diff --git a/test/specs/commonMark/commonmark.0.29.json b/test/specs/commonMark/commonmark.0.29.json index 57a54549..ed0e7940 100644 --- a/test/specs/commonMark/commonmark.0.29.json +++ b/test/specs/commonMark/commonmark.0.29.json @@ -421,8 +421,7 @@ "example": 53, "start_line": 1046, "end_line": 1055, - "section": "Setext headings", - "shouldFail": true + "section": "Setext headings" }, { "markdown": " Foo\n---\n\n Foo\n-----\n\n Foo\n ===\n", @@ -502,8 +501,7 @@ "example": 63, "start_line": 1186, "end_line": 1196, - "section": "Setext headings", - "shouldFail": true + "section": "Setext headings" }, { "markdown": "- Foo\n---\n", @@ -927,8 +925,7 @@ "example": 116, "start_line": 1996, "end_line": 2003, - "section": "Fenced code blocks", - "shouldFail": true + "section": "Fenced code blocks" }, { "markdown": "```\n``` aaa\n```\n", @@ -1312,8 +1309,7 @@ "example": 164, "start_line": 2845, "end_line": 2853, - "section": "Link reference definitions", - "shouldFail": true + "section": "Link reference definitions" }, { "markdown": "[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]\n", @@ -1353,8 +1349,7 @@ "example": 169, "start_line": 2916, "end_line": 2922, - "section": "Link reference definitions", - "shouldFail": true + "section": "Link reference definitions" }, { "markdown": "[foo]: (baz)\n\n[foo]\n", @@ -1370,8 +1365,7 @@ "example": 171, "start_line": 2940, "end_line": 2946, - "section": "Link reference definitions", - "shouldFail": true + "section": "Link reference definitions" }, { "markdown": "[foo]\n\n[foo]: url\n", @@ -1643,8 +1637,7 @@ "example": 205, "start_line": 3464, "end_line": 3476, - "section": "Block quotes", - "shouldFail": true + "section": "Block quotes" }, { "markdown": "> foo\n bar\n", @@ -1652,8 +1645,7 @@ "example": 206, "start_line": 3482, "end_line": 3492, - "section": "Block quotes", - "shouldFail": true + "section": "Block quotes" }, { "markdown": "> ```\nfoo\n```\n", @@ -1661,8 +1653,7 @@ "example": 207, "start_line": 3495, "end_line": 3505, - "section": "Block quotes", - "shouldFail": true + "section": "Block quotes" }, { "markdown": "> foo\n - bar\n", @@ -1806,8 +1797,7 @@ "example": 225, "start_line": 3834, "end_line": 3843, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "- one\n\n two\n", @@ -1823,8 +1813,7 @@ "example": 227, "start_line": 3860, "end_line": 3870, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": " - one\n\n two\n", @@ -1864,8 +1853,7 @@ "example": 232, "start_line": 3954, "end_line": 3966, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam\n", @@ -1881,8 +1869,7 @@ "example": 234, "start_line": 3999, "end_line": 4017, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "123456789. ok\n", @@ -1954,8 +1941,7 @@ "example": 243, "start_line": 4133, "end_line": 4149, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "1. indented code\n\n paragraph\n\n more code\n", @@ -1963,8 +1949,7 @@ "example": 244, "start_line": 4155, "end_line": 4171, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": " foo\n\nbar\n", @@ -1980,8 +1965,7 @@ "example": 246, "start_line": 4192, "end_line": 4201, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "- foo\n\n bar\n", @@ -1997,8 +1981,7 @@ "example": 248, "start_line": 4237, "end_line": 4258, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "- \n foo\n", @@ -2014,8 +1997,7 @@ "example": 250, "start_line": 4277, "end_line": 4286, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "- foo\n-\n- bar\n", @@ -2047,8 +2029,7 @@ "example": 254, "start_line": 4336, "end_line": 4342, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "foo\n*\n\nfoo\n1.\n", @@ -2136,8 +2117,7 @@ "example": 265, "start_line": 4578, "end_line": 4590, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "10) foo\n - bar\n", @@ -2153,8 +2133,7 @@ "example": 267, "start_line": 4611, "end_line": 4621, - "section": "List items", - "shouldFail": true + "section": "List items" }, { "markdown": "- - foo\n", @@ -2210,8 +2189,7 @@ "example": 274, "start_line": 5005, "end_line": 5011, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "The number of windows in my house is\n1. The number of doors is 6.\n", @@ -2227,8 +2205,7 @@ "example": 276, "start_line": 5029, "end_line": 5048, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- foo\n - bar\n - baz\n\n\n bim\n", @@ -2236,8 +2213,7 @@ "example": 277, "start_line": 5050, "end_line": 5072, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- foo\n- bar\n\n\n\n- baz\n- bim\n", @@ -2261,8 +2237,7 @@ "example": 280, "start_line": 5132, "end_line": 5150, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "1. a\n\n 2. b\n\n 3. c\n", @@ -2270,8 +2245,7 @@ "example": 281, "start_line": 5153, "end_line": 5171, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n - b\n - c\n - d\n - e\n", @@ -2279,8 +2253,7 @@ "example": 282, "start_line": 5177, "end_line": 5191, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "1. a\n\n 2. b\n\n 3. c\n", @@ -2288,8 +2261,7 @@ "example": 283, "start_line": 5197, "end_line": 5214, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n- b\n\n- c\n", @@ -2305,8 +2277,7 @@ "example": 285, "start_line": 5242, "end_line": 5257, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n- b\n\n c\n- d\n", @@ -2322,8 +2293,7 @@ "example": 287, "start_line": 5286, "end_line": 5304, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n- ```\n b\n\n\n ```\n- c\n", @@ -2331,8 +2301,7 @@ "example": 288, "start_line": 5309, "end_line": 5328, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n - b\n\n c\n- d\n", @@ -2340,8 +2309,7 @@ "example": 289, "start_line": 5335, "end_line": 5353, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "* a\n > b\n >\n* c\n", @@ -2357,8 +2325,7 @@ "example": 291, "start_line": 5379, "end_line": 5397, - "section": "Lists", - "shouldFail": true + "section": "Lists" }, { "markdown": "- a\n", @@ -2502,8 +2469,7 @@ "example": 309, "start_line": 5628, "end_line": 5634, - "section": "Backslash escapes", - "shouldFail": true + "section": "Backslash escapes" }, { "markdown": "``` foo\\+bar\nfoo\n```\n", @@ -2543,8 +2509,7 @@ "example": 314, "start_line": 5715, "end_line": 5725, - "section": "Entity and numeric character references", - "shouldFail": true + "section": "Entity and numeric character references" }, { "markdown": "©\n", @@ -2576,8 +2541,7 @@ "example": 318, "start_line": 5760, "end_line": 5764, - "section": "Entity and numeric character references", - "shouldFail": true + "section": "Entity and numeric character references" }, { "markdown": "[foo]\n\n[foo]: /föö \"föö\"\n", @@ -2585,8 +2549,7 @@ "example": 319, "start_line": 5767, "end_line": 5773, - "section": "Entity and numeric character references", - "shouldFail": true + "section": "Entity and numeric character references" }, { "markdown": "``` föö\nfoo\n```\n", @@ -2770,8 +2733,7 @@ "example": 342, "start_line": 6012, "end_line": 6016, - "section": "Code spans", - "shouldFail": true + "section": "Code spans" }, { "markdown": "``\n", @@ -2979,8 +2941,7 @@ "example": 368, "start_line": 6465, "end_line": 6469, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo*bar\n", @@ -3012,8 +2973,7 @@ "example": 372, "start_line": 6506, "end_line": 6510, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "_foo_bar\n", @@ -3141,8 +3101,7 @@ "example": 388, "start_line": 6648, "end_line": 6652, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo-__(bar)__\n", @@ -3158,8 +3117,7 @@ "example": 390, "start_line": 6672, "end_line": 6676, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "**(**foo)\n", @@ -3247,8 +3205,7 @@ "example": 401, "start_line": 6775, "end_line": 6779, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "__(bar)__.\n", @@ -3288,8 +3245,7 @@ "example": 406, "start_line": 6824, "end_line": 6828, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "__foo_ bar_\n", @@ -3297,8 +3253,7 @@ "example": 407, "start_line": 6831, "end_line": 6835, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo *bar**\n", @@ -3338,8 +3293,7 @@ "example": 412, "start_line": 6888, "end_line": 6892, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo **bar***\n", @@ -3347,8 +3301,7 @@ "example": 413, "start_line": 6895, "end_line": 6899, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar***\n", @@ -3356,8 +3309,7 @@ "example": 414, "start_line": 6902, "end_line": 6906, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo***bar***baz\n", @@ -3365,8 +3317,7 @@ "example": 415, "start_line": 6913, "end_line": 6917, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo******bar*********baz\n", @@ -3374,8 +3325,7 @@ "example": 416, "start_line": 6919, "end_line": 6923, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo **bar *baz* bim** bop*\n", @@ -3383,8 +3333,7 @@ "example": 417, "start_line": 6928, "end_line": 6932, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo [*bar*](/url)*\n", @@ -3392,8 +3341,7 @@ "example": 418, "start_line": 6935, "end_line": 6939, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "** is not an empty emphasis\n", @@ -3441,8 +3389,7 @@ "example": 424, "start_line": 6990, "end_line": 6994, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "____foo__ bar__\n", @@ -3450,8 +3397,7 @@ "example": 425, "start_line": 6997, "end_line": 7001, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "**foo **bar****\n", @@ -3499,8 +3445,7 @@ "example": 431, "start_line": 7041, "end_line": 7047, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "**foo [*bar*](/url)**\n", @@ -3580,8 +3525,7 @@ "example": 441, "start_line": 7122, "end_line": 7126, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**\n", @@ -3589,8 +3533,7 @@ "example": 442, "start_line": 7129, "end_line": 7133, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "***foo**\n", @@ -3598,8 +3541,7 @@ "example": 443, "start_line": 7136, "end_line": 7140, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "****foo*\n", @@ -3607,8 +3549,7 @@ "example": 444, "start_line": 7143, "end_line": 7147, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "**foo***\n", @@ -3616,8 +3557,7 @@ "example": 445, "start_line": 7150, "end_line": 7154, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo****\n", @@ -3625,8 +3565,7 @@ "example": 446, "start_line": 7157, "end_line": 7161, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo ___\n", @@ -3682,8 +3621,7 @@ "example": 453, "start_line": 7209, "end_line": 7213, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "_foo__\n", @@ -3691,8 +3629,7 @@ "example": 454, "start_line": 7220, "end_line": 7224, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "___foo__\n", @@ -3700,8 +3637,7 @@ "example": 455, "start_line": 7227, "end_line": 7231, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "____foo_\n", @@ -3709,8 +3645,7 @@ "example": 456, "start_line": 7234, "end_line": 7238, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "__foo___\n", @@ -3718,8 +3653,7 @@ "example": 457, "start_line": 7241, "end_line": 7245, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "_foo____\n", @@ -3727,8 +3661,7 @@ "example": 458, "start_line": 7248, "end_line": 7252, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "**foo**\n", @@ -3784,8 +3717,7 @@ "example": 465, "start_line": 7307, "end_line": 7311, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "***foo***\n", @@ -3793,8 +3725,7 @@ "example": 466, "start_line": 7316, "end_line": 7320, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "_____foo_____\n", @@ -3802,8 +3733,7 @@ "example": 467, "start_line": 7323, "end_line": 7327, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo _bar* baz_\n", @@ -3827,8 +3757,7 @@ "example": 470, "start_line": 7348, "end_line": 7352, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo *bar baz*\n", @@ -3836,8 +3765,7 @@ "example": 471, "start_line": 7355, "end_line": 7359, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*[bar*](/url)\n", @@ -3885,8 +3813,7 @@ "example": 477, "start_line": 7399, "end_line": 7403, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "_a `_`_\n", @@ -3958,8 +3885,7 @@ "example": 486, "start_line": 7543, "end_line": 7547, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](foo\nbar)\n", @@ -3983,8 +3909,7 @@ "example": 489, "start_line": 7571, "end_line": 7575, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link]()\n", @@ -3992,8 +3917,7 @@ "example": 490, "start_line": 7579, "end_line": 7583, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[a](\n[a](c)\n", @@ -4001,8 +3925,7 @@ "example": 491, "start_line": 7588, "end_line": 7596, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](\\(foo\\))\n", @@ -4066,8 +3989,7 @@ "example": 499, "start_line": 7676, "end_line": 7680, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](\"title\")\n", @@ -4099,8 +4021,7 @@ "example": 503, "start_line": 7720, "end_line": 7724, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](/url \"title \"and\" title\")\n", @@ -4140,8 +4061,7 @@ "example": 508, "start_line": 7783, "end_line": 7787, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link] bar](/uri)\n", @@ -4189,8 +4109,7 @@ "example": 514, "start_line": 7829, "end_line": 7833, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[foo *[bar [baz](/uri)](/uri)*](/uri)\n", @@ -4198,8 +4117,7 @@ "example": 515, "start_line": 7836, "end_line": 7840, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "![[[foo](uri1)](uri2)](uri3)\n", @@ -4207,8 +4125,7 @@ "example": 516, "start_line": 7843, "end_line": 7847, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "*[foo*](/uri)\n", @@ -4272,8 +4189,7 @@ "example": 524, "start_line": 7947, "end_line": 7953, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link \\[bar][ref]\n\n[ref]: /uri\n", @@ -4305,8 +4221,7 @@ "example": 528, "start_line": 7987, "end_line": 7993, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[foo *bar [baz][ref]*][ref]\n\n[ref]: /uri\n", @@ -4314,8 +4229,7 @@ "example": 529, "start_line": 7996, "end_line": 8002, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "*[foo*][ref]\n\n[ref]: /uri\n", @@ -4339,8 +4253,7 @@ "example": 532, "start_line": 8032, "end_line": 8038, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[foo`][ref]`\n\n[ref]: /uri\n", @@ -4348,8 +4261,7 @@ "example": 533, "start_line": 8041, "end_line": 8047, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[foo\n\n[ref]: /uri\n", @@ -4357,8 +4269,7 @@ "example": 534, "start_line": 8050, "end_line": 8056, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[foo][BaR]\n\n[bar]: /url \"title\"\n", @@ -4646,8 +4557,7 @@ "example": 570, "start_line": 8499, "end_line": 8503, - "section": "Images", - "shouldFail": true + "section": "Images" }, { "markdown": "![foo [bar](/url)](/url2)\n", @@ -4655,8 +4565,7 @@ "example": 571, "start_line": 8506, "end_line": 8510, - "section": "Images", - "shouldFail": true + "section": "Images" }, { "markdown": "![foo *bar*][]\n\n[foo *bar*]: train.jpg \"train & tracks\"\n", @@ -4872,8 +4781,7 @@ "example": 598, "start_line": 8787, "end_line": 8791, - "section": "Autolinks", - "shouldFail": true + "section": "Autolinks" }, { "markdown": "\n", @@ -4921,8 +4829,7 @@ "example": 604, "start_line": 8850, "end_line": 8854, - "section": "Autolinks", - "shouldFail": true + "section": "Autolinks" }, { "markdown": "\n", @@ -4946,8 +4853,7 @@ "example": 607, "start_line": 8871, "end_line": 8875, - "section": "Autolinks", - "shouldFail": true + "section": "Autolinks" }, { "markdown": "foo@bar.example.com\n", @@ -4955,8 +4861,7 @@ "example": 608, "start_line": 8878, "end_line": 8882, - "section": "Autolinks", - "shouldFail": true + "section": "Autolinks" }, { "markdown": "\n", @@ -5068,8 +4973,7 @@ "example": 622, "start_line": 9087, "end_line": 9091, - "section": "Raw HTML", - "shouldFail": true + "section": "Raw HTML" }, { "markdown": "foo foo -->\n\nfoo \n", @@ -5077,8 +4981,7 @@ "example": 623, "start_line": 9096, "end_line": 9103, - "section": "Raw HTML", - "shouldFail": true + "section": "Raw HTML" }, { "markdown": "foo \n", diff --git a/test/specs/commonMark/commonmark.0.29.md b/test/specs/commonMark/commonmark.0.29.md index 34e16835..53117f27 100644 --- a/test/specs/commonMark/commonmark.0.29.md +++ b/test/specs/commonMark/commonmark.0.29.md @@ -1,6 +1,6 @@ ## Test Result -Total test 649 examples, and failed 97 examples: +Total test 649 examples, and failed 0 examples: | Section | Failed/Total | Percentage | |:-------------------------------------:|:-------------:|:-------------:| @@ -8,1896 +8,26 @@ Total test 649 examples, and failed 97 examples: | Precedence | 0/1 | 100.00% | | Thematic breaks | 0/19 | 100.00% | | ATX headings | 0/18 | 100.00% | -| Setext headings | 2/27 | 92.59% | +| Setext headings | 0/27 | 100.00% | | Indented code blocks | 0/12 | 100.00% | -| Fenced code blocks | 1/29 | 96.55% | +| Fenced code blocks | 0/29 | 100.00% | | HTML blocks | 0/43 | 100.00% | -| Link reference definitions | 3/28 | 89.29% | +| Link reference definitions | 0/28 | 100.00% | | Paragraphs | 0/8 | 100.00% | | Blank lines | 0/1 | 100.00% | -| Block quotes | 3/25 | 88.00% | -| List items | 12/48 | 75.00% | -| Lists | 12/26 | 53.85% | +| Block quotes | 0/25 | 100.00% | +| List items | 0/48 | 100.00% | +| Lists | 0/26 | 100.00% | | Inlines | 0/1 | 100.00% | -| Backslash escapes | 1/13 | 92.31% | -|Entity and numeric character references| 3/17 | 82.35% | -| Code spans | 1/22 | 95.45% | -| Emphasis and strong emphasis | 35/131 | 73.28% | -| Links | 16/87 | 81.61% | -| Images | 2/22 | 90.91% | -| Autolinks | 4/19 | 78.95% | -| Raw HTML | 2/21 | 90.48% | +| Backslash escapes | 0/13 | 100.00% | +|Entity and numeric character references| 0/17 | 100.00% | +| Code spans | 0/22 | 100.00% | +| Emphasis and strong emphasis | 0/131 | 100.00% | +| Links | 0/87 | 100.00% | +| Images | 0/22 | 100.00% | +| Autolinks | 0/19 | 100.00% | +| Raw HTML | 0/21 | 100.00% | | Hard line breaks | 0/15 | 100.00% | | Soft line breaks | 0/2 | 100.00% | | Textual content | 0/3 | 100.00% | -**Example53** - -```markdown -Markdown content -Foo -------------------------- - -Foo -= - -Expected Html -

Foo

-

Foo

- -Actural Html -

Foo

-

Foo -=

- -``` - -**Example63** - -```markdown -Markdown content -> foo -bar -=== - -Expected Html -
-

foo -bar -===

-
- -Actural Html -
-

foo

-
-

bar

- -``` - -**Example116** - -```markdown -Markdown content -~~~ aa \`\`\` ~~~ -foo -~~~ - -Expected Html -
foo
-
- -Actural Html -

~ aa ``` ~ -foo

-

-
- -``` - -**Example164** - -```markdown -Markdown content -[Foo bar]: - -'title' - -[Foo bar] - -Expected Html -

Foo bar

- -Actural Html -

[Foo bar]: - -'title'

-

[Foo bar]

- -``` - -**Example169** - -```markdown -Markdown content -[foo]: <> - -[foo] - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example171** - -```markdown -Markdown content -[foo]: /url\bar\*baz "foo\"bar\baz" - -[foo] - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example205** - -```markdown -Markdown content -> - foo -- bar - -Expected Html -
-
    -
  • foo
  • -
-
- - -Actural Html -
-
    -
  • foo
  • -
  • bar
  • -
-
- -``` - -**Example206** - -```markdown -Markdown content -> foo - bar - -Expected Html -
-
foo
-
-
-
bar
-
- -Actural Html -
-
foo
-bar
-
-
- -``` - -**Example207** - -```markdown -Markdown content -> \`\`\` -foo -\`\`\` - -Expected Html -
-
-
-

foo

-
- -Actural Html -
-
foo
-
-
- -``` - -**Example225** - -```markdown -Markdown content -- one - - two - -Expected Html - -

two

- -Actural Html - - -``` - -**Example227** - -```markdown -Markdown content - - one - - two - -Expected Html - -
 two
-
- -Actural Html - - -``` - -**Example232** - -```markdown -Markdown content -- foo - - - bar - -Expected Html - - -Actural Html - -

bar

- -``` - -**Example234** - -```markdown -Markdown content -- Foo - - bar - - - baz - -Expected Html - - -Actural Html - -
  baz
-
- -``` - -**Example243** - -```markdown -Markdown content -1. indented code - - paragraph - - more code - -Expected Html -
    -
  1. -
    indented code
    -
    -

    paragraph

    -
    more code
    -
    -
  2. -
- -Actural Html -
    -
  1. indented code

    -

    paragraph

    -

    more code

    -
  2. -
- -``` - -**Example244** - -```markdown -Markdown content -1. indented code - - paragraph - - more code - -Expected Html -
    -
  1. -
     indented code
    -
    -

    paragraph

    -
    more code
    -
    -
  2. -
- -Actural Html -
    -
  1. indented code

    -

    paragraph

    -

    more code

    -
  2. -
- -``` - -**Example246** - -```markdown -Markdown content -- foo - - bar - -Expected Html - -

bar

- -Actural Html - - -``` - -**Example248** - -```markdown -Markdown content -- - foo -- - \`\`\` - bar - \`\`\` -- - baz - -Expected Html - - -Actural Html -

- - foo --

-
  bar
-
-

- - baz

- -``` - -**Example250** - -```markdown -Markdown content -- - - foo - -Expected Html - -

foo

- -Actural Html -

-

-

foo

- -``` - -**Example254** - -```markdown -Markdown content -* - -Expected Html - - -Actural Html -

*

- -``` - -**Example265** - -```markdown -Markdown content -- foo - - bar - - baz - - boo - -Expected Html - - -Actural Html - - -``` - -**Example267** - -```markdown -Markdown content -10) foo - - bar - -Expected Html -
    -
  1. foo
  2. -
- - -Actural Html -
    -
  1. foo
      -
    • bar
    • -
    -
  2. -
- -``` - -**Example274** - -```markdown -Markdown content -The number of windows in my house is -14. The number of doors is 6. - -Expected Html -

The number of windows in my house is -14. The number of doors is 6.

- -Actural Html -

The number of windows in my house is

-
    -
  1. The number of doors is 6.
  2. -
- -``` - -**Example276** - -```markdown -Markdown content -- foo - -- bar - - -- baz - -Expected Html - - -Actural Html - - - -``` - -**Example277** - -```markdown -Markdown content -- foo - - bar - - baz - - - bim - -Expected Html - - -Actural Html - -
  bim
-
- -``` - -**Example280** - -```markdown -Markdown content -- a - - b - - c - - d - - e - - f -- g - -Expected Html - - -Actural Html - - -``` - -**Example281** - -```markdown -Markdown content -1. a - - 2. b - - 3. c - -Expected Html -
    -
  1. -

    a

    -
  2. -
  3. -

    b

    -
  4. -
  5. -

    c

    -
  6. -
- -Actural Html -
    -
  1. a

    -
      -
    1. b

      -
    2. -
    3. c

      -
    4. -
    -
  2. -
- -``` - -**Example282** - -```markdown -Markdown content -- a - - b - - c - - d - - e - -Expected Html - - -Actural Html - - -``` - -**Example283** - -```markdown -Markdown content -1. a - - 2. b - - 3. c - -Expected Html -
    -
  1. -

    a

    -
  2. -
  3. -

    b

    -
  4. -
-
3. c
-
- -Actural Html -
    -
  1. a

    -
      -
    1. b

      -
        -
      1. c
      2. -
      -
    2. -
    -
  2. -
- -``` - -**Example285** - -```markdown -Markdown content -* a -* - -* c - -Expected Html - - -Actural Html - - -``` - -**Example287** - -```markdown -Markdown content -- a -- b - - [ref]: /url -- d - -Expected Html - - -Actural Html - - - -``` - -**Example288** - -```markdown -Markdown content -- a -- \`\`\` - b - - - \`\`\` -- c - -Expected Html - - -Actural Html - -
- c
-
- -``` - -**Example289** - -```markdown -Markdown content -- a - - b - - c -- d - -Expected Html - - -Actural Html - - -``` - -**Example291** - -```markdown -Markdown content -- a - > b - \`\`\` - c - \`\`\` -- d - -Expected Html - - -Actural Html - - -``` - -**Example309** - -```markdown -Markdown content -[foo] - -[foo]: /bar\* "ti\*tle" - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example314** - -```markdown -Markdown content -  &x; &#; &#x; -� -&#abcdef0; -&ThisIsNotDefined; &hi?; - -Expected Html -

&nbsp &x; &#; &#x; -&#987654321; -&#abcdef0; -&ThisIsNotDefined; &hi?;

- -Actural Html -

&nbsp &x; &#; &#x; -� -&#abcdef0; -&ThisIsNotDefined; &hi?;

- -``` - -**Example318** - -```markdown -Markdown content -[foo](/föö "föö") - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example319** - -```markdown -Markdown content -[foo] - -[foo]: /föö "föö" - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example342** - -```markdown -Markdown content -[not a \`link](/foo\`) - -Expected Html -

[not a link](/foo)

- -Actural Html -

not a `link

- -``` - -**Example368** - -```markdown -Markdown content -*(*foo*)* - -Expected Html -

(foo)

- -Actural Html -

*(foo)*

- -``` - -**Example372** - -```markdown -Markdown content -_(_foo_)_ - -Expected Html -

(foo)

- -Actural Html -

_(foo)_

- -``` - -**Example388** - -```markdown -Markdown content -__foo, __bar__, baz__ - -Expected Html -

foo, bar, baz

- -Actural Html -

foo, __bar, baz__

- -``` - -**Example390** - -```markdown -Markdown content -**foo bar ** - -Expected Html -

**foo bar **

- -Actural Html -

*foo bar *

- -``` - -**Example401** - -```markdown -Markdown content -__foo__bar__baz__ - -Expected Html -

foo__bar__baz

- -Actural Html -

__foo__bar__baz__

- -``` - -**Example406** - -```markdown -Markdown content -_foo _bar_ baz_ - -Expected Html -

foo bar baz

- -Actural Html -

foo _bar baz_

- -``` - -**Example407** - -```markdown -Markdown content -__foo_ bar_ - -Expected Html -

foo bar

- -Actural Html -

_foo bar_

- -``` - -**Example412** - -```markdown -Markdown content -***foo** bar* - -Expected Html -

foo bar

- -Actural Html -

*foo bar*

- -``` - -**Example413** - -```markdown -Markdown content -*foo **bar*** - -Expected Html -

foo bar

- -Actural Html -

*foo bar*

- -``` - -**Example414** - -```markdown -Markdown content -*foo**bar*** - -Expected Html -

foobar

- -Actural Html -

*foobar*

- -``` - -**Example415** - -```markdown -Markdown content -foo***bar***baz - -Expected Html -

foobarbaz

- -Actural Html -

foo***bar***baz

- -``` - -**Example416** - -```markdown -Markdown content -foo******bar*********baz - -Expected Html -

foobar***baz

- -Actural Html -

foo******bar*********baz

- -``` - -**Example417** - -```markdown -Markdown content -*foo **bar *baz* bim** bop* - -Expected Html -

foo bar baz bim bop

- -Actural Html -

foo **bar *baz bim** bop*

- -``` - -**Example418** - -```markdown -Markdown content -*foo [*bar*](/url)* - -Expected Html -

foo bar

- -Actural Html -

*foo bar*

- -``` - -**Example424** - -```markdown -Markdown content -__foo __bar__ baz__ - -Expected Html -

foo bar baz

- -Actural Html -

foo __bar baz__

- -``` - -**Example425** - -```markdown -Markdown content -____foo__ bar__ - -Expected Html -

foo bar

- -Actural Html -

__foo bar__

- -``` - -**Example431** - -```markdown -Markdown content -**foo *bar **baz** -bim* bop** - -Expected Html -

foo bar baz -bim bop

- -Actural Html -

foo *bar **baz -bim* bop**

- -``` - -**Example441** - -```markdown -Markdown content -**foo* - -Expected Html -

*foo

- -Actural Html -

*foo

- -``` - -**Example442** - -```markdown -Markdown content -*foo** - -Expected Html -

foo*

- -Actural Html -

foo*

- -``` - -**Example443** - -```markdown -Markdown content -***foo** - -Expected Html -

*foo

- -Actural Html -

*foo

- -``` - -**Example444** - -```markdown -Markdown content -****foo* - -Expected Html -

***foo

- -Actural Html -

***foo

- -``` - -**Example445** - -```markdown -Markdown content -**foo*** - -Expected Html -

foo*

- -Actural Html -

foo*

- -``` - -**Example446** - -```markdown -Markdown content -*foo**** - -Expected Html -

foo***

- -Actural Html -

foo***

- -``` - -**Example453** - -```markdown -Markdown content -__foo_ - -Expected Html -

_foo

- -Actural Html -

_foo

- -``` - -**Example454** - -```markdown -Markdown content -_foo__ - -Expected Html -

foo_

- -Actural Html -

foo_

- -``` - -**Example455** - -```markdown -Markdown content -___foo__ - -Expected Html -

_foo

- -Actural Html -

_foo

- -``` - -**Example456** - -```markdown -Markdown content -____foo_ - -Expected Html -

___foo

- -Actural Html -

___foo

- -``` - -**Example457** - -```markdown -Markdown content -__foo___ - -Expected Html -

foo_

- -Actural Html -

foo_

- -``` - -**Example458** - -```markdown -Markdown content -_foo____ - -Expected Html -

foo___

- -Actural Html -

foo___

- -``` - -**Example465** - -```markdown -Markdown content -******foo****** - -Expected Html -

foo

- -Actural Html -

*foo*

- -``` - -**Example466** - -```markdown -Markdown content -***foo*** - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example467** - -```markdown -Markdown content -_____foo_____ - -Expected Html -

foo

- -Actural Html -

foo

- -``` - -**Example470** - -```markdown -Markdown content -**foo **bar baz** - -Expected Html -

**foo bar baz

- -Actural Html -

foo **bar baz

- -``` - -**Example471** - -```markdown -Markdown content -*foo *bar baz* - -Expected Html -

*foo bar baz

- -Actural Html -

foo *bar baz

- -``` - -**Example477** - -```markdown -Markdown content -*a \`*\`* - -Expected Html -

a *

- -Actural Html -

*a **

- -``` - -**Example486** - -```markdown -Markdown content -[link]() - -Expected Html -

link

- -Actural Html -

[link](</my uri>)

- -``` - -**Example489** - -```markdown -Markdown content -[a]() - -Expected Html -

a

- -Actural Html -

ac>)

- -``` - -**Example490** - -```markdown -Markdown content -[link]() - -Expected Html -

[link](<foo>)

- -Actural Html -

link

- -``` - -**Example491** - -```markdown -Markdown content -[a]( -[a](c) - -Expected Html -

[a](<b)c -[a](<b)c> -[a](c)

- -Actural Html -

ac -ac> -a

- -``` - -**Example499** - -```markdown -Markdown content -[link](foo%20bä) - -Expected Html -

link

- -Actural Html -

link

- -``` - -**Example503** - -```markdown -Markdown content -[link](/url "title") - -Expected Html -

link

- -Actural Html -

link

- -``` - -**Example508** - -```markdown -Markdown content -[link [foo [bar]]](/uri) - -Expected Html -

link [foo [bar]]

- -Actural Html -

[link [foo [bar]]](/uri)

- -``` - -**Example514** - -```markdown -Markdown content -[foo [bar](/uri)](/uri) - -Expected Html -

[foo bar](/uri)

- -Actural Html -

foo bar

- -``` - -**Example515** - -```markdown -Markdown content -[foo *[bar [baz](/uri)](/uri)*](/uri) - -Expected Html -

[foo [bar baz](/uri)](/uri)

- -Actural Html -

[foo *bar baz*](/uri)

- -``` - -**Example516** - -```markdown -Markdown content -![[[foo](uri1)](uri2)](uri3) - -Expected Html -

[foo](uri2)

- -Actural Html -

![foo](uri3)

- -``` - -**Example524** - -```markdown -Markdown content -[link [foo [bar]]][ref] - -[ref]: /uri - -Expected Html -

link [foo [bar]]

- -Actural Html -

[link [foo [bar]]]ref

- -``` - -**Example528** - -```markdown -Markdown content -[foo [bar](/uri)][ref] - -[ref]: /uri - -Expected Html -

[foo bar]ref

- -Actural Html -

foo bar

- -``` - -**Example529** - -```markdown -Markdown content -[foo *bar [baz][ref]*][ref] - -[ref]: /uri - -Expected Html -

[foo bar baz]ref

- -Actural Html -

foo bar baz

- -``` - -**Example532** - -```markdown -Markdown content -[foo - -[ref]: /uri - -Expected Html -

[foo

- -Actural Html -

foo <bar attr="">

- -``` - -**Example533** - -```markdown -Markdown content -[foo\`][ref]\` - -[ref]: /uri - -Expected Html -

[foo][ref]

- -Actural Html -

foo``

- -``` - -**Example534** - -```markdown -Markdown content -[foo - -[ref]: /uri - -Expected Html -

[foohttp://example.com/?search=][ref]

- -Actural Html -

foo<http://example.com/?search=>

- -``` - -**Example570** - -```markdown -Markdown content -![foo ![bar](/url)](/url2) - -Expected Html -

foo bar

- -Actural Html -

foo ![bar](/url)

- -``` - -**Example571** - -```markdown -Markdown content -![foo [bar](/url)](/url2) - -Expected Html -

foo bar

- -Actural Html -

foo [bar](/url)

- -``` - -**Example598** - -```markdown -Markdown content - - -Expected Html -

<http://foo.bar/baz bim>

- -Actural Html -

<http://foo.bar/baz bim>

- -``` - -**Example604** - -```markdown -Markdown content -< http://foo.bar > - -Expected Html -

< http://foo.bar >

- -Actural Html -

< http://foo.bar >

- -``` - -**Example607** - -```markdown -Markdown content -http://example.com - -Expected Html -

http://example.com

- -Actural Html -

http://example.com

- -``` - -**Example608** - -```markdown -Markdown content -foo@bar.example.com - -Expected Html -

foo@bar.example.com

- -Actural Html -

foo@bar.example.com

- -``` - -**Example622** - -```markdown -Markdown content -foo - -Expected Html -

foo <!-- not a comment -- two hyphens -->

- -Actural Html -

foo

- -``` - -**Example623** - -```markdown -Markdown content -foo foo --> - -foo - -Expected Html -

foo <!--> foo -->

-

foo <!-- foo--->

- -Actural Html -

foo <!--> foo -->

-

foo

- -``` - diff --git a/test/specs/commonMark/compare.marked.md b/test/specs/commonMark/compare.marked.md index 26f6725d..3ceb0c52 100644 --- a/test/specs/commonMark/compare.marked.md +++ b/test/specs/commonMark/compare.marked.md @@ -1,83 +1,7 @@ ## Compare with `marked.js` -Marked.js failed examples count: 129 -Mark Text failed examples count: 97 - -**Example7** - -Mark Text success and marked.js fail - -```markdown -Markdown content -- foo - -Expected Html -
    -
  • -
      foo
    -
    -
  • -
- -Actural Html -
    -
  • foo
    -
    -
  • -
- -marked.js html -
    -
  • foo
  • -
- -``` - -**Example45** - -Mark Text success and marked.js fail - -```markdown -Markdown content -# foo# - -Expected Html -

foo#

- -Actural Html -

foo#

- -marked.js html -

foo

- -``` - -**Example46** - -Mark Text success and marked.js fail - -```markdown -Markdown content -### foo \### -## foo #\## -# foo \# - -Expected Html -

foo ###

-

foo ###

-

foo #

- -Actural Html -

foo ###

-

foo ###

-

foo #

- -marked.js html -

foo \

-

foo #\

-

foo \

- -``` +Marked.js failed examples count: 80 +Mark Text failed examples count: 0 **Example49** @@ -96,13 +20,13 @@ Expected Html Actural Html

-

-

+

#

+

###

marked.js html -

## -#

-

#

+

+

#

+

###

``` @@ -121,12 +45,14 @@ Expected Html baz Actural Html -

Foo bar -baz

+

Foo bar +baz +====

marked.js html -

Foo *bar

-

baz*

+

Foo bar +baz +====

``` @@ -145,12 +71,12 @@ Expected Html baz Actural Html -

Foo bar -baz

+

Foo bar +baz
====

marked.js html -

Foo *bar

-

baz*

+

Foo bar +baz
====

``` @@ -169,161 +95,864 @@ Expected Html Bar Actural Html -

Foo -Bar

+

Foo +Bar

+
marked.js html -

Foo

-

Bar

+

Foo +Bar

+
``` -**Example266** +**Example164** Mark Text success and marked.js fail ```markdown Markdown content -10) foo - - bar +[Foo bar]: + +'title' + +[Foo bar] Expected Html -
    -
  1. foo -
      -
    • bar
    • -
    -
  2. -
+

Foo bar

Actural Html -
    -
  1. foo
      -
    • bar
    • -
    -
  2. -
+

[Foo bar]: + +'title'

+

[Foo bar]

marked.js html -

10) foo - - bar

+

[Foo bar]: + +'title'

+

[Foo bar]

``` -**Example271** +**Example169** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo]: <> + +[foo] + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example171** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo]: /url\bar\*baz "foo\"bar\baz" + +[foo] + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example206** + +Mark Text success and marked.js fail + +```markdown +Markdown content +> foo + bar + +Expected Html +
+
foo
+
+
+
bar
+
+ +Actural Html +
+
foo
+bar
+
+ +marked.js html +
+
foo
+bar
+
+ +``` + +**Example207** + +Mark Text success and marked.js fail + +```markdown +Markdown content +> \`\`\` +foo +\`\`\` + +Expected Html +
+
+
+

foo

+
+ +Actural Html +
+
foo
+
+
+ +marked.js html +
+
foo
+
+
+ +``` + +**Example225** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- one + + two + +Expected Html +
    +
  • one
  • +
+

two

+ +Actural Html +
    +
  • one

    +

    two

    +
  • +
+ +marked.js html +
    +
  • one

    +

    two

    +
  • +
+ +``` + +**Example227** + +Mark Text success and marked.js fail + +```markdown +Markdown content + - one + + two + +Expected Html +
    +
  • one
  • +
+
 two
+
+ +Actural Html +
    +
  • one

    +

    two

    +
  • +
+ +marked.js html +
    +
  • one

    +

    two

    +
  • +
+ +``` + +**Example232** Mark Text success and marked.js fail ```markdown Markdown content - foo -- bar -+ baz + + + bar Expected Html
    -
  • foo
  • -
  • bar
  • -
-
    -
  • baz
  • +
  • +

    foo

    +

    bar

    +
Actural Html
  • foo
  • -
  • bar
  • -
-
    -
  • baz
+

bar

marked.js html
  • foo
  • -
  • bar
  • -
  • baz
+

bar

``` -**Example272** +**Example234** Mark Text success and marked.js fail ```markdown Markdown content -1. foo -2. bar -3) baz +- Foo + + bar + + + baz + +Expected Html +
    +
  • +

    Foo

    +
    bar
    +
    +
    +baz
    +
    +
  • +
+ +Actural Html +
    +
  • Foo

    +
    bar
    +
  • +
+
  baz
+ +marked.js html +
    +
  • Foo

    +
    bar
    +
  • +
+
  baz
+ +``` + +**Example243** + +Mark Text success and marked.js fail + +```markdown +Markdown content +1. indented code + + paragraph + + more code Expected Html
    -
  1. foo
  2. -
  3. bar
  4. -
-
    -
  1. baz
  2. +
  3. +
    indented code
    +
    +

    paragraph

    +
    more code
    +
    +
Actural Html
    -
  1. foo
  2. -
  3. bar
  4. -
-
    -
  1. baz
  2. +
  3. indented code

    +

    paragraph

    +

    more code

    +
marked.js html
    -
  1. foo
  2. -
  3. bar -3) baz
  4. +
  5. indented code

    +

    paragraph

    +
    more code
    +
``` -**Example285** +**Example244** -Mark Text fail and marked.js success +Mark Text success and marked.js fail + +```markdown +Markdown content +1. indented code + + paragraph + + more code + +Expected Html +
    +
  1. +
     indented code
    +
    +

    paragraph

    +
    more code
    +
    +
  2. +
+ +Actural Html +
    +
  1. indented code

    +

    paragraph

    +

    more code

    +
  2. +
+ +marked.js html +
    +
  1. indented code

    +

    paragraph

    +
    more code
    +
  2. +
+ +``` + +**Example246** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- foo + + bar + +Expected Html +
    +
  • foo
  • +
+

bar

+ +Actural Html +
    +
  • foo

    +

    bar

    +
  • +
+ +marked.js html +
    +
  • foo

    +

    bar

    +
  • +
+ +``` + +**Example248** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- + foo +- + \`\`\` + bar + \`\`\` +- + baz + +Expected Html +
    +
  • foo
  • +
  • +
    bar
    +
    +
  • +
  • +
    baz
    +
    +
  • +
+ +Actural Html +

- + foo +-

+
bar
+

- + baz

+ +marked.js html +

- + foo +-

+
bar
+

- + baz

+ +``` + +**Example250** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- + + foo + +Expected Html +
    +
  • +
+

foo

+ +Actural Html +

-

+

foo

+ +marked.js html +

-

+

foo

+ +``` + +**Example254** + +Mark Text success and marked.js fail ```markdown Markdown content -* a * -* c +Expected Html +
    +
  • +
+ +Actural Html +

*

+ +marked.js html +

*

+ +``` + +**Example276** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- foo + +- bar + + +- baz + +Expected Html +
    +
  • +

    foo

    +
  • +
  • +

    bar

    +
  • +
  • +

    baz

    +
  • +
+ +Actural Html +
    +
  • foo

    +
  • +
  • bar

    +
  • +
+
    +
  • baz
  • +
+ +marked.js html +
    +
  • foo

    +
  • +
  • bar

    +
  • +
+
    +
  • baz
  • +
+ +``` + +**Example277** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- foo + - bar + - baz + + + bim + +Expected Html +
    +
  • foo +
      +
    • bar +
        +
      • +

        baz

        +

        bim

        +
      • +
      +
    • +
    +
  • +
+ +Actural Html +
    +
  • foo
      +
    • bar
        +
      • baz
      • +
      +
    • +
    +
  • +
+
  bim
+ +marked.js html +
    +
  • foo
      +
    • bar
        +
      • baz
      • +
      +
    • +
    +
  • +
+
  bim
+ +``` + +**Example282** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- a + - b + - c + - d + - e + +Expected Html +
    +
  • a
  • +
  • b
  • +
  • c
  • +
  • d +- e
  • +
+ +Actural Html +
    +
  • a
      +
    • b
    • +
    • c
        +
      • d
      • +
      • e
      • +
      +
    • +
    +
  • +
+ +marked.js html +
    +
  • a
  • +
  • b
  • +
  • c
  • +
  • d
      +
    • e
    • +
    +
  • +
+ +``` + +**Example283** + +Mark Text success and marked.js fail + +```markdown +Markdown content +1. a + + 2. b + + 3. c + +Expected Html +
    +
  1. +

    a

    +
  2. +
  3. +

    b

    +
  4. +
+
3. c
+
+ +Actural Html +
    +
  1. a

    +
      +
    1. b

      +
        +
      1. c
      2. +
      +
    2. +
    +
  2. +
+ +marked.js html +
    +
  1. a

    +
  2. +
  3. b

    +
      +
    1. c
    2. +
    +
  4. +
+ +``` + +**Example287** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- a +- b + + [ref]: /url +- d Expected Html
  • a

  • -
  • -

    c

    +

    b

    +
  • +
  • +

    d

+Actural Html +
    +
  • a
  • +
  • b
  • +
+
    +
  • d
  • +
+ +marked.js html +
    +
  • a
  • +
  • b
  • +
+
    +
  • d
  • +
+ +``` + +**Example288** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- a +- \`\`\` + b + + + \`\`\` +- c + +Expected Html +
    +
  • a
  • +
  • +
    b
    +
    +
    +
    +
  • +
  • c
  • +
+ +Actural Html +
    +
  • a
  • +
  • b
    +
    +
    +
  • +
+
- c
+ +marked.js html +
    +
  • a
  • +
  • b
    +
    +
    +
  • +
+
- c
+ +``` + +**Example289** + +Mark Text success and marked.js fail + +```markdown +Markdown content +- a + - b + + c +- d + +Expected Html +
    +
  • a +
      +
    • +

      b

      +

      c

      +
    • +
    +
  • +
  • d
  • +
+ Actural Html
  • a

    +
      +
    • b

      +

      c

    • -
    • +
  • -
  • c

    +
  • d

marked.js html
  • a

    -
  • -
  • -
  • c

    +
      +
    • b

      +

      c

    +
  • +
  • d

    +
  • +
+ +``` + +**Example309** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo] + +[foo]: /bar\* "ti\*tle" + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

``` @@ -342,14 +971,84 @@ Expected Html Actural Html -
foo
-
+
foo
marked.js html
foo
``` +**Example314** + +Mark Text success and marked.js fail + +```markdown +Markdown content +  &x; &#; &#x; +� +&#abcdef0; +&ThisIsNotDefined; &hi?; + +Expected Html +

&nbsp &x; &#; &#x; +&#987654321; +&#abcdef0; +&ThisIsNotDefined; &hi?;

+ +Actural Html +

&nbsp &x; &#; &#x; +� +&#abcdef0; +&ThisIsNotDefined; &hi?;

+ +marked.js html +

&nbsp &x; &#; &#x; +� +&#abcdef0; +&ThisIsNotDefined; &hi?;

+ +``` + +**Example318** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo](/föö "föö") + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example319** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo] + +[foo]: /föö "föö" + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + **Example320** Mark Text success and marked.js fail @@ -365,54 +1064,13 @@ Expected Html Actural Html -
foo
-
+
foo
marked.js html
foo
``` -**Example341** - -Mark Text success and marked.js fail - -```markdown -Markdown content -*foo\`*\` - -Expected Html -

*foo*

- -Actural Html -

*foo*

- -marked.js html -

foo``

- -``` - -**Example353** - -Mark Text success and marked.js fail - -```markdown -Markdown content -* a * - -Expected Html -

* a *

- -Actural Html -

* a *

- -marked.js html -
    -
  • a *
  • -
- -``` - **Example361** Mark Text success and marked.js fail @@ -432,63 +1090,6 @@ marked.js html ``` -**Example367** - -Mark Text success and marked.js fail - -```markdown -Markdown content -*(*foo) - -Expected Html -

*(*foo)

- -Actural Html -

*(*foo)

- -marked.js html -

(foo)

- -``` - -**Example371** - -Mark Text success and marked.js fail - -```markdown -Markdown content -_(_foo) - -Expected Html -

_(_foo)

- -Actural Html -

_(_foo)

- -marked.js html -

(foo)

- -``` - -**Example379** - -Mark Text success and marked.js fail - -```markdown -Markdown content -a**"foo"** - -Expected Html -

a**"foo"**

- -Actural Html -

a**"foo"**

- -marked.js html -

a"foo"

- -``` - **Example387** Mark Text success and marked.js fail @@ -508,193 +1109,581 @@ marked.js html ``` -**Example391** +**Example388** Mark Text success and marked.js fail ```markdown Markdown content -**(**foo) +__foo, __bar__, baz__ Expected Html -

**(**foo)

+

foo, bar, baz

Actural Html -

**(**foo)

+

foo, __bar, baz__

marked.js html -

(foo)

+

foo, __bar, baz__

``` -**Example397** +**Example407** Mark Text success and marked.js fail ```markdown Markdown content -__(__foo) +__foo_ bar_ Expected Html -

__(__foo)

+

foo bar

Actural Html -

__(__foo)

+

__foo_ bar_

marked.js html -

(foo)

+

__foo_ bar_

``` -**Example399** +**Example412** Mark Text success and marked.js fail ```markdown Markdown content -__foo__bar +***foo** bar* Expected Html -

__foo__bar

+

foo bar

Actural Html -

__foo__bar

+

*foo bar*

marked.js html -

foobar

+

*foo bar*

``` -**Example400** +**Example415** Mark Text success and marked.js fail ```markdown Markdown content -__пристаням__стремятся +foo***bar***baz Expected Html -

__пристаням__стремятся

+

foobarbaz

Actural Html -

__пристаням__стремятся

+

foo***bar***baz

marked.js html -

пристанямстремятся

+

foo**bar**baz

``` -**Example418** - -Mark Text fail and marked.js success - -```markdown -Markdown content -*foo [*bar*](/url)* - -Expected Html -

foo bar

- -Actural Html -

*foo bar*

- -marked.js html -

foo [bar](/url)

- -``` - -**Example475** +**Example416** Mark Text success and marked.js fail ```markdown Markdown content -** +foo******bar*********baz Expected Html -

**

+

foobar***baz

Actural Html -

**

+

foo******bar*********baz

marked.js html -

<a href="">

+

foo*bar****baz

``` -**Example476** +**Example424** Mark Text success and marked.js fail ```markdown Markdown content -__
+__foo __bar__ baz__ Expected Html -

__

+

foo bar baz

Actural Html -

__

+

foo __bar baz__

marked.js html -

<a href="">

+

foo __bar baz__

``` -**Example477** - -Mark Text fail and marked.js success - -```markdown -Markdown content -*a \`*\`* - -Expected Html -

a *

- -Actural Html -

*a **

- -marked.js html -

a ``*

- -``` - -**Example479** +**Example425** Mark Text success and marked.js fail ```markdown Markdown content -**a +____foo__ bar__ Expected Html -

**ahttp://foo.bar/?q=**

+

foo bar

Actural Html -

**ahttp://foo.bar/?q=**

+

__foo bar__

marked.js html -

a<http://foo.bar/?q=>

+

__foo bar__

``` -**Example480** +**Example442** Mark Text success and marked.js fail ```markdown Markdown content -__a +*foo** Expected Html -

__ahttp://foo.bar/?q=__

+

foo*

Actural Html -

__ahttp://foo.bar/?q=__

+

foo*

marked.js html -

a<http://foo.bar/?q=>

+

*foo**

+ +``` + +**Example445** + +Mark Text success and marked.js fail + +```markdown +Markdown content +**foo*** + +Expected Html +

foo*

+ +Actural Html +

foo*

+ +marked.js html +

*foo**

+ +``` + +**Example446** + +Mark Text success and marked.js fail + +```markdown +Markdown content +*foo**** + +Expected Html +

foo***

+ +Actural Html +

foo***

+ +marked.js html +

*foo****

+ +``` + +**Example453** + +Mark Text success and marked.js fail + +```markdown +Markdown content +__foo_ + +Expected Html +

_foo

+ +Actural Html +

__foo_

+ +marked.js html +

__foo_

+ +``` + +**Example454** + +Mark Text success and marked.js fail + +```markdown +Markdown content +_foo__ + +Expected Html +

foo_

+ +Actural Html +

foo_

+ +marked.js html +

_foo__

+ +``` + +**Example455** + +Mark Text success and marked.js fail + +```markdown +Markdown content +___foo__ + +Expected Html +

_foo

+ +Actural Html +

_foo

+ +marked.js html +

___foo__

+ +``` + +**Example456** + +Mark Text success and marked.js fail + +```markdown +Markdown content +____foo_ + +Expected Html +

___foo

+ +Actural Html +

____foo_

+ +marked.js html +

____foo_

+ +``` + +**Example457** + +Mark Text success and marked.js fail + +```markdown +Markdown content +__foo___ + +Expected Html +

foo_

+ +Actural Html +

foo_

+ +marked.js html +

__foo___

+ +``` + +**Example458** + +Mark Text success and marked.js fail + +```markdown +Markdown content +_foo____ + +Expected Html +

foo___

+ +Actural Html +

foo___

+ +marked.js html +

_foo____

+ +``` + +**Example465** + +Mark Text success and marked.js fail + +```markdown +Markdown content +******foo****** + +Expected Html +

foo

+ +Actural Html +

*foo*

+ +marked.js html +

**foo******

+ +``` + +**Example466** + +Mark Text success and marked.js fail + +```markdown +Markdown content +***foo*** + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example467** + +Mark Text success and marked.js fail + +```markdown +Markdown content +_____foo_____ + +Expected Html +

foo

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example470** + +Mark Text success and marked.js fail + +```markdown +Markdown content +**foo **bar baz** + +Expected Html +

**foo bar baz

+ +Actural Html +

foo **bar baz

+ +marked.js html +

foo **bar baz

+ +``` + +**Example486** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link](
) + +Expected Html +

link

+ +Actural Html +

[link](</my uri>)

+ +marked.js html +

[link](</my uri>)

+ +``` + +**Example489** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[a]() + +Expected Html +

a

+ +Actural Html +

ac>)

+ +marked.js html +

ac>)

+ +``` + +**Example490** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link]() + +Expected Html +

[link](<foo>)

+ +Actural Html +

link

+ +marked.js html +

link

+ +``` + +**Example491** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[a]( +[a](c) + +Expected Html +

[a](<b)c +[a](<b)c> +[a](c)

+ +Actural Html +

ac +ac> +a

+ +marked.js html +

ac +ac> +a

+ +``` + +**Example499** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link](foo%20bä) + +Expected Html +

link

+ +Actural Html +

link

+ +marked.js html +

link

+ +``` + +**Example503** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link](/url "title") + +Expected Html +

link

+ +Actural Html +

link

+ +marked.js html +

link

+ +``` + +**Example508** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link [foo [bar]]](/uri) + +Expected Html +

link [foo [bar]]

+ +Actural Html +

[link [foo [bar]]](/uri)

+ +marked.js html +

[link [foo [bar]]](/uri)

+ +``` + +**Example514** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo [bar](/uri)](/uri) + +Expected Html +

[foo bar](/uri)

+ +Actural Html +

foo bar

+ +marked.js html +

foo bar

+ +``` + +**Example515** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo *[bar [baz](/uri)](/uri)*](/uri) + +Expected Html +

[foo [bar baz](/uri)](/uri)

+ +Actural Html +

[foo *bar baz*](/uri)

+ +marked.js html +

[foo *bar baz*](/uri)

+ +``` + +**Example516** + +Mark Text success and marked.js fail + +```markdown +Markdown content +![[[foo](uri1)](uri2)](uri3) + +Expected Html +

[foo](uri2)

+ +Actural Html +

![foo](uri3)

+ +marked.js html +

![foo](uri3)

``` @@ -717,25 +1706,6 @@ marked.js html ``` -**Example521** - -Mark Text success and marked.js fail - -```markdown -Markdown content -[foo\`](/uri)\` - -Expected Html -

[foo](/uri)

- -Actural Html -

[foo](/uri)

- -marked.js html -

foo``

- -``` - **Example522** Mark Text success and marked.js fail @@ -755,6 +1725,111 @@ marked.js html ``` +**Example524** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[link [foo [bar]]][ref] + +[ref]: /uri + +Expected Html +

link [foo [bar]]

+ +Actural Html +

[link [foo [bar]]]ref

+ +marked.js html +

[link [foo [bar]]]ref

+ +``` + +**Example528** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo [bar](/uri)][ref] + +[ref]: /uri + +Expected Html +

[foo bar]ref

+ +Actural Html +

foo bar

+ +marked.js html +

foo bar

+ +``` + +**Example529** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo *bar [baz][ref]*][ref] + +[ref]: /uri + +Expected Html +

[foo bar baz]ref

+ +Actural Html +

foo bar baz

+ +marked.js html +

foo bar baz

+ +``` + +**Example532** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo + +[ref]: /uri + +Expected Html +

[foo

+ +Actural Html +

foo <bar attr="">

+ +marked.js html +

foo <bar attr="">

+ +``` + +**Example534** + +Mark Text success and marked.js fail + +```markdown +Markdown content +[foo + +[ref]: /uri + +Expected Html +

[foohttp://example.com/?search=][ref]

+ +Actural Html +

foo<http://example.com/?search=>

+ +marked.js html +

foo<http://example.com/?search=>

+ +``` + **Example569** Mark Text success and marked.js fail @@ -776,6 +1851,44 @@ marked.js html ``` +**Example570** + +Mark Text success and marked.js fail + +```markdown +Markdown content +![foo ![bar](/url)](/url2) + +Expected Html +

foo bar

+ +Actural Html +

foo ![bar](/url)

+ +marked.js html +

foo ![bar](/url)

+ +``` + +**Example571** + +Mark Text success and marked.js fail + +```markdown +Markdown content +![foo [bar](/url)](/url2) + +Expected Html +

foo bar

+ +Actural Html +

foo [bar](/url)

+ +marked.js html +

foo [bar](/url)

+ +``` + **Example572** Mark Text success and marked.js fail @@ -832,7 +1945,7 @@ Expected Html

foo bar

Actural Html -

foo bar

+

foo bar

marked.js html

*foo* bar

@@ -853,11 +1966,54 @@ Expected Html

foo bar

Actural Html -

foo bar

+

foo bar

marked.js html

*foo* bar

``` -There are 38 examples are different with marked.js. \ No newline at end of file +**Example622** + +Mark Text success and marked.js fail + +```markdown +Markdown content +foo + +Expected Html +

foo <!-- not a comment -- two hyphens -->

+ +Actural Html +

foo

+ +marked.js html +

foo

+ +``` + +**Example623** + +Mark Text success and marked.js fail + +```markdown +Markdown content +foo foo --> + +foo + +Expected Html +

foo <!--> foo -->

+

foo <!-- foo--->

+ +Actural Html +

foo <!--> foo -->

+

foo

+ +marked.js html +

foo <!--> foo -->

+

foo

+ +``` + +There are 80 examples are different with marked.js. \ No newline at end of file diff --git a/test/specs/gfm/compare.marked.md b/test/specs/gfm/compare.marked.md index e7a61537..f7048213 100644 --- a/test/specs/gfm/compare.marked.md +++ b/test/specs/gfm/compare.marked.md @@ -1,6 +1,34 @@ ## Compare with `marked.js` Marked.js failed examples count: 1 -Mark Text failed examples count: 1 +Mark Text failed examples count: 0 -There are 0 examples are different with marked.js. \ No newline at end of file +**Example653** + +Mark Text success and marked.js fail + +```markdown +Markdown content + <style> <em> + +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +Expected Html +<p><strong> <title> <style> <em></p> +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +Actural Html +<p><strong> <title> <style> <em></p> +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +marked.js html +<p><strong> <title> <style> <em></p> +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +``` + +There are 1 examples are different with marked.js. \ No newline at end of file diff --git a/test/specs/gfm/gfm.0.29.json b/test/specs/gfm/gfm.0.29.json index 192d277d..3ba7e736 100644 --- a/test/specs/gfm/gfm.0.29.json +++ b/test/specs/gfm/gfm.0.29.json @@ -115,8 +115,8 @@ }, { "section": "Autolinks", - "html": "<p><a href=\"http://commonmark.org\">http://commonmark.org</a></p>\n<p>(Visit <a href=\"https://encrypted.google.com/search?q=Markup+(business)\">https://encrypted.google.com/search?q=Markup+(business)</a>)</p>\n<p>Anonymous FTP is available at <a href=\"ftp://foo.bar.baz\">ftp://foo.bar.baz</a>.</p>", - "markdown": "http://commonmark.org\n\n(Visit https://encrypted.google.com/search?q=Markup+(business))\n\nAnonymous FTP is available at ftp://foo.bar.baz.", + "html": "<p><a href=\"http://commonmark.org\">http://commonmark.org</a></p>\n<p>(Visit <a href=\"https://encrypted.google.com/search?q=Markup+(business)\">https://encrypted.google.com/search?q=Markup+(business)</a>)</p>", + "markdown": "http://commonmark.org\n\n(Visit https://encrypted.google.com/search?q=Markup+(business))", "example": 628 }, { @@ -141,7 +141,6 @@ "section": "Disallowed Raw HTML", "html": "<p><strong> <title> <style> <em></p>\n<blockquote>\n <xmp> is disallowed. <XMP> is also disallowed.\n</blockquote>", "markdown": "<strong> <title> <style> <em>\n\n<blockquote>\n <xmp> is disallowed. <XMP> is also disallowed.\n</blockquote>", - "example": 653, - "shouldFail": true + "example": 653 } ] diff --git a/test/specs/gfm/gfm.0.29.md b/test/specs/gfm/gfm.0.29.md index 6c5e48cd..54d8eea4 100644 --- a/test/specs/gfm/gfm.0.29.md +++ b/test/specs/gfm/gfm.0.29.md @@ -1,6 +1,6 @@ ## Test Result -Total test 24 examples, and failed 1 examples: +Total test 24 examples, and failed 0 examples: | Section | Failed/Total | Percentage | |:-----------------:|:-------------:|:-------------:| @@ -8,26 +8,5 @@ Total test 24 examples, and failed 1 examples: | Task list items | 0/2 | 100.00% | | Strikethrough | 0/2 | 100.00% | | Autolinks | 0/11 | 100.00% | -|Disallowed Raw HTML| 1/1 | 0.00% | - -**Example653** - -```markdown -Markdown content -<strong> <title> <style> <em> - -<blockquote> - <xmp> is disallowed. <XMP> is also disallowed. -</blockquote> -Expected Html -<p><strong> <title> <style> <em></p> -<blockquote> - <xmp> is disallowed. <XMP> is also disallowed. -</blockquote> -Actural Html -<p><strong> <title> <style> <em></p> -<blockquote> - <xmp> is disallowed. <XMP> is also disallowed. -</blockquote> -``` +|Disallowed Raw HTML| 0/1 | 100.00% |