diff --git a/.changeset/eight-shirts-dream.md b/.changeset/eight-shirts-dream.md
new file mode 100644
index 00000000..39537b27
--- /dev/null
+++ b/.changeset/eight-shirts-dream.md
@@ -0,0 +1,5 @@
+---
+"htmljs-parser": patch
+---
+
+Fixes an regression where string literals inside of parsed text nodes (eg `
+ │ │ │ ╰─ closeTagEnd(script)
+ │ │ ╰─ closeTagName "script"
+ ╰─ ╰─ closeTagStart ""
+15╰─
\ No newline at end of file
diff --git a/src/__tests__/fixtures/script-with-strings/input.marko b/src/__tests__/fixtures/script-with-strings/input.marko
new file mode 100644
index 00000000..0d4f9a77
--- /dev/null
+++ b/src/__tests__/fixtures/script-with-strings/input.marko
@@ -0,0 +1,14 @@
+
diff --git a/src/states/PARSED_STRING.ts b/src/states/PARSED_STRING.ts
new file mode 100644
index 00000000..7ef88e29
--- /dev/null
+++ b/src/states/PARSED_STRING.ts
@@ -0,0 +1,42 @@
+import { CODE, ErrorCode, STATE, StateDefinition, Meta } from "../internal";
+
+interface ParsedStringMeta extends Meta {
+ quoteCharCode: number;
+}
+
+export const PARSED_STRING: StateDefinition = {
+ name: "PARSED_STRING",
+
+ enter(parent, start) {
+ return {
+ state: PARSED_STRING,
+ parent,
+ start,
+ end: start,
+ quoteCharCode: CODE.DOUBLE_QUOTE,
+ } as ParsedStringMeta;
+ },
+
+ exit() {},
+
+ char(code, str) {
+ if (code === str.quoteCharCode) {
+ this.pos++; // skip end quote
+ this.exitState();
+ } else if (!STATE.checkForPlaceholder(this, code)) {
+ this.startText();
+ }
+ },
+
+ eof(str) {
+ this.emitError(
+ str,
+ ErrorCode.INVALID_TEMPLATE_STRING,
+ "EOF reached while parsing string expression"
+ );
+ },
+
+ eol() {},
+
+ return() {},
+};
diff --git a/src/states/PARSED_TEXT_CONTENT.ts b/src/states/PARSED_TEXT_CONTENT.ts
index 4904354c..299d6cbf 100644
--- a/src/states/PARSED_TEXT_CONTENT.ts
+++ b/src/states/PARSED_TEXT_CONTENT.ts
@@ -50,6 +50,12 @@ export const PARSED_TEXT_CONTENT: StateDefinition = {
this.startText();
this.enterState(STATE.TEMPLATE_STRING);
break;
+ case CODE.DOUBLE_QUOTE:
+ case CODE.SINGLE_QUOTE:
+ this.startText();
+ this.enterState(STATE.PARSED_STRING).quoteCharCode = code;
+ break;
+
default:
if (!STATE.checkForPlaceholder(this, code)) this.startText();
break;
diff --git a/src/states/index.ts b/src/states/index.ts
index db5eb50f..33471b5c 100644
--- a/src/states/index.ts
+++ b/src/states/index.ts
@@ -17,4 +17,5 @@ export * from "./REGULAR_EXPRESSION";
export * from "./STRING";
export * from "./TAG_NAME";
export * from "./TEMPLATE_STRING";
+export * from "./PARSED_STRING";
export * from "./OPEN_TAG";