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 committed Nov 18, 2014
1 parent 3e02a69 commit c3e3a89
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ block.normal = merge({}, block);

block.gfm = merge({}, block.normal, {
fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
paragraph: /^/
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 c3e3a89

Please sign in to comment.