Skip to content

Commit

Permalink
Support HTML start tags with new lines in them.
Browse files Browse the repository at this point in the history
HTML5 Start tags can contain "one or more space characters" (8.1.2.1 markedjs#3).

A "space character" is space, tab, LF, FF or CR (2.4.1).

This change makes marked support any Unicode white space in tags by restricting
the autolink to not contain any /\s/ character. It is slightly more permissive
than the HTML5 standard, but that is unlikely to be a problem in practice.
  • Loading branch information
tommie committed Sep 25, 2014
1 parent 3e02a69 commit ba059b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Lexer.prototype.token = function(src, top, bq) {

var inline = {
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
autolink: /^<([^\s>]+(@|:\/)[^\s>]+)>/,
url: noop,
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
link: /^!?\[(inside)\]\(href\)/,
Expand Down
2 changes: 2 additions & 0 deletions test/new/html_tag_newline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<a
href="hello">world</a>
2 changes: 2 additions & 0 deletions test/new/html_tag_newline.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<a
href="hello">world</a>

0 comments on commit ba059b2

Please sign in to comment.