Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ public ParsedInline tryParse(InlineParserState inlineParserState) {
while (scanner.find('`') > 0) {
var beforeClosing = scanner.position();
var length = scanner.matchMultiple('`');
// Keep track of last position of backticks run of this length
backtickPositions.put(length, beforeClosing);
// Keep track of last position of backticks run of this length. Once the whole input
// has been scanned, the map already holds the last positions, so don't overwrite them
// with earlier ones.
if (!scannedToEnd) {
backtickPositions.put(length, beforeClosing);
}
if (length == openingLength) {
Code node = new Code();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,11 @@ public void emphasisAfterHardLineBreak() {
Foo</p>
""");
}

@Test
public void codeSpansAfterUnclosedBackticks() {
assertRendering("`` `a` `c`", "<p>`` <code>a</code> <code>c</code></p>\n");
assertRendering(
"`` `a` `c` `e`", "<p>`` <code>a</code> <code>c</code> <code>e</code></p>\n");
}
}