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
5 changes: 5 additions & 0 deletions .changeset/fresh-words-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"htmljs-parser": patch
---

Avoid startText call at eof.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1╭─ --
2╭─ hi
╰─ ╰─ text "\nhi\n"
3├─ --
4├─
5├─ --
6╭─ foo
╰─ ╰─ text "\nfoo\n\n"
7├─
8╰─
7 changes: 7 additions & 0 deletions src/__tests__/fixtures/concise-multiline-content/input.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--
hi
--

--
foo

4 changes: 1 addition & 3 deletions src/states/BEGIN_DELIMITED_HTML_BLOCK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ function handleDelimitedBlockEOL(
parser.pos += endHtmlBlockLookahead.length;

if (parser.consumeWhitespaceOnLine(0)) {
parser.endText();
parser.exitState();
parser.exitState();
} else {
Expand All @@ -115,7 +114,6 @@ function handleDelimitedBlockEOL(
// We know the next line does not end the multiline HTML block, but we need to check if there
// is any indentation that we need to skip over as we continue parsing the HTML in this
// multiline HTML block

parser.startText();
parser.pos += indent.length;
// We stay in the same state since we are still parsing a multiline, delimited HTML block
Expand All @@ -126,7 +124,7 @@ function handleDelimitedBlockEOL(
parser.endText();
parser.exitState();
parser.exitState();
} else {
} else if (parser.pos + newLineLength !== parser.maxPos) {
parser.startText();
}
}