Skip to content

Commit 1f5a827

Browse files
committed
Fix end source position for fenced code and raw HTML.
Closes #141.
1 parent 94ad030 commit 1f5a827

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/blocks.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ var blocks = {
325325
ln.slice(parser.nextNonspace).match(reClosingCodeFence));
326326
if (match && match[0].length >= container._fenceLength) {
327327
// closing fence - we're at end of line, so we can return
328+
parser.lastLineLength = match[0].length;
328329
parser.finalize(container, parser.lineNumber);
329330
return 2;
330331
} else {
@@ -673,7 +674,6 @@ var incorporateLine = function(ln) {
673674
all_matched = false;
674675
break;
675676
case 2: // we've hit end of line for fenced code close and can return
676-
this.lastLineLength = ln.length;
677677
return;
678678
default:
679679
throw 'continue returned illegal value, must be 0, 1, or 2';
@@ -769,6 +769,7 @@ var incorporateLine = function(ln) {
769769
container._htmlBlockType >= 1 &&
770770
container._htmlBlockType <= 5 &&
771771
reHtmlBlockClose[container._htmlBlockType].test(this.currentLine.slice(this.offset))) {
772+
this.lastLineLength = ln.length;
772773
this.finalize(container, this.lineNumber);
773774
}
774775

0 commit comments

Comments
 (0)