diff --git a/src/rules.ts b/src/rules.ts index 5ec294d0..f224e356 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -338,9 +338,9 @@ const tag = edit( const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; -const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/) +const link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/) .replace('label', _inlineLabel) - .replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/) + .replace('href', /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/) .replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/) .getRegex(); diff --git a/test/specs/commonmark/commonmark.0.31.2.json b/test/specs/commonmark/commonmark.0.31.2.json index 690ab66e..86c3e4c7 100644 --- a/test/specs/commonmark/commonmark.0.31.2.json +++ b/test/specs/commonmark/commonmark.0.31.2.json @@ -4056,8 +4056,7 @@ "example": 507, "start_line": 7776, "end_line": 7780, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](/url \"title \"and\" title\")\n", diff --git a/test/specs/gfm/commonmark.0.31.2.json b/test/specs/gfm/commonmark.0.31.2.json index f54cf913..cecdf9cd 100644 --- a/test/specs/gfm/commonmark.0.31.2.json +++ b/test/specs/gfm/commonmark.0.31.2.json @@ -4056,8 +4056,7 @@ "example": 507, "start_line": 7776, "end_line": 7780, - "section": "Links", - "shouldFail": true + "section": "Links" }, { "markdown": "[link](/url \"title \"and\" title\")\n",