Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class EventParser {
if (colons.length >= container.extra.colons) {
container.extra.endFenceStartpos = m.startpos;
container.extra.endFenceEndpos = m.startpos + colons.length - 1;
this.pos = m.endpos; // before newline
this.pos = this.starteol; // before newline (CRLF-safe, see #113)
return false;
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,19 @@ rendering the light markup format <a href="https://djot.net">djot</a>.</p>
);
});

it("closes a fenced div with CRLF line endings", () => {
// Regression test for issue #113: with CRLF line endings the closing
// ::: fence must close the div, so following content ("after") lands
// outside the div rather than being swallowed inside an unclosed div.
const expected =
`<div>
<p>hello</p>
</div>
<p>after</p>
`;
expect(renderHTML(parse(":::\r\nhello\r\n:::\r\nafter\r\n"))).toEqual(expected);
// The LF equivalent is unchanged and produces byte-identical HTML.
expect(renderHTML(parse(":::\nhello\n:::\nafter\n"))).toEqual(expected);
});

});
Loading