diff --git a/.changeset/semicolon-html-comment.md b/.changeset/semicolon-html-comment.md
new file mode 100644
index 00000000..3de9e63e
--- /dev/null
+++ b/.changeset/semicolon-html-comment.md
@@ -0,0 +1,5 @@
+---
+"htmljs-parser": minor
+---
+
+Report code after an html comment that follows a concise `;` (eg `div; span`) as an error, as after any other comment there, instead of reading it as a new line nested in the tag. More comments may still follow.
diff --git a/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/__snapshots__/invalid-code-after-semicolon-html-comment.expected.txt b/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/__snapshots__/invalid-code-after-semicolon-html-comment.expected.txt
new file mode 100644
index 00000000..c4a99c9a
--- /dev/null
+++ b/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/__snapshots__/invalid-code-after-semicolon-html-comment.expected.txt
@@ -0,0 +1,17 @@
+1╭─ div; // c
+ │ │ ││ │ │ │ │ ╰─ comment.value " c"
+ │ │ ││ │ │ │ ╰─ comment "// c"
+ │ │ ││ │ │ ╰─ comment.value " b "
+ │ │ ││ │ ╰─ comment ""
+ │ │ ││ ╰─ comment.value " a "
+ │ │ │╰─ comment ""
+ │ │ ╰─ openTagEnd
+ ╰─ ╰─ tagName "div"
+2╭─ span; p
+ │ │ ││ │ ╰─ error(INVALID_CODE_AFTER_SEMICOLON:A semicolon indicates the end of a line. Only comments may follow it.)
+ │ │ ││ ╰─ comment.value " d "
+ │ │ │╰─ comment ""
+ │ │ ╰─ openTagEnd
+ │ ├─ closeTagEnd(div)
+ ╰─ ╰─ tagName "span"
+3╰─
\ No newline at end of file
diff --git a/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/input.marko b/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/input.marko
new file mode 100644
index 00000000..96c6f141
--- /dev/null
+++ b/src/__tests__/fixtures/invalid-code-after-semicolon-html-comment/input.marko
@@ -0,0 +1,2 @@
+div; // c
+span; p
diff --git a/src/states/CONCISE_HTML_CONTENT.ts b/src/states/CONCISE_HTML_CONTENT.ts
index 060189d7..47d92556 100644
--- a/src/states/CONCISE_HTML_CONTENT.ts
+++ b/src/states/CONCISE_HTML_CONTENT.ts
@@ -188,6 +188,11 @@ export const CONCISE_HTML_CONTENT: StateDefinition = {
break;
}
+ case STATE.HTML_COMMENT:
+ // Only reached after a ";" (a line starting with "<" is an html
+ // block), so only comments may follow it either.
+ STATE.endConciseLine(this, this.data);
+ break;
}
},
};