10000 fix recursion code block · segmentfault/HyperDown.js@f67fa41 · GitHub
[go: up one dir, main page]

Skip to content

Commit f67fa41

Browse files
committed
fix recursion code block
1 parent 596dac3 commit f67fa41

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Parser.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"license": "BSD-4-Clause",
99
"author": "SegmentFault",
10-
"version": "2.4.15",
10+
"version": "2.4.16",
1111
"scripts": {
1212
"test": "mocha",
1313
"build": "cake build"

src/Parser.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ class Parser
438438
parseBlockCode: (block, key, line, state) ->
439439
if !!(matches = line.match /^(\s*)(~{3,}|`{3,})([^`~]*)$/i)
440440
if @isBlock 'code'
441+
if state.code != matches[2]
442+
@setBlock key
443+
return no
444+
441445
isAfterList = block[3][2]
442446

443447
if isAfterList
@@ -452,6 +456,7 @@ class Parser
452456

453457
isAfterList = matches[1].length >= space + state.empty
454458

459+
state.code = matches[2]
455460
@startBlock 'code', key, [matches[1], matches[3], isAfterList]
456461

457462
return no

0 commit comments

Comments
 (0)
0