diff --git a/lib/marked.js b/lib/marked.js index 9b0878872f..8543c6b288 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -32,7 +32,7 @@ var block = { def: /^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, nptable: noop, table: noop, - lheading: /^([^\n]+)\n {0,3}(=|-){2,} *(?:\n+|$)/, + lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, text: /^[^\n]+/ }; @@ -495,7 +495,7 @@ Lexer.prototype.token = function(src, top) { src = src.substring(cap[0].length); this.tokens.push({ type: 'heading', - depth: cap[2] === '=' ? 1 : 2, + depth: cap[2].charAt(0) === '=' ? 1 : 2, text: cap[1] }); continue; diff --git a/test/specs/commonmark/commonmark.0.29.json b/test/specs/commonmark/commonmark.0.29.json index 1050702822..e203324415 100644 --- a/test/specs/commonmark/commonmark.0.29.json +++ b/test/specs/commonmark/commonmark.0.29.json @@ -425,8 +425,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", diff --git a/test/specs/gfm/commonmark.0.29.json b/test/specs/gfm/commonmark.0.29.json index e080b070ff..f577c7c5cd 100644 --- a/test/specs/gfm/commonmark.0.29.json +++ b/test/specs/gfm/commonmark.0.29.json @@ -427,8 +427,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",