Skip to content

Commit

Permalink
Fix to heading regular expression for GFM markedjs#201.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsun authored and gkoberger committed Aug 24, 2015
1 parent 6201e93 commit 85d27e9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ block.normal = merge({}, block);
*/

block.gfm = merge({}, block.normal, {
fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
paragraph: /^/
fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
paragraph: /^/,
heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
});

block.gfm.paragraph = replace(block.paragraph)
Expand Down
5 changes: 5 additions & 0 deletions test/new/gfm_hashtag.gfm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p>#header</p>

<h1 id="header1">header1</h1>

<h1 id="header2">header2</h1>
5 changes: 5 additions & 0 deletions test/new/gfm_hashtag.gfm.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#header

# header1

# header2
5 changes: 5 additions & 0 deletions test/new/gfm_hashtag.nogfm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1 id="header">header</h1>

<h1 id="header1">header1</h1>

<h1 id="header2">header2</h1>
5 changes: 5 additions & 0 deletions test/new/gfm_hashtag.nogfm.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#header

# header1

# header2
5 changes: 5 additions & 0 deletions test/tests/gfm_hashtag.gfm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p>#header</p>

<h1 id="header1">header1</h1>

<h1 id="header2">header2</h1>
5 changes: 5 additions & 0 deletions test/tests/gfm_hashtag.gfm.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#header

# header1

# header2
5 changes: 5 additions & 0 deletions test/tests/gfm_hashtag.nogfm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1 id="header">header</h1>

<h1 id="header1">header1</h1>

<h1 id="header2">header2</h1>
5 changes: 5 additions & 0 deletions test/tests/gfm_hashtag.nogfm.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#header

# header1

# header2

0 comments on commit 85d27e9

Please sign in to comment.