From 35aa84f3de0143fe1c2ca1d8a705568631315dd8 Mon Sep 17 00:00:00 2001
From: Yurii Bakurov <45154988+Yurii201811@users.noreply.github.com>
Date: Thu, 11 Jun 2026 01:24:43 +0200
Subject: [PATCH] fix: escape embedded JSON in standalone HTML
---
scripts/build_standalone.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/build_standalone.py b/scripts/build_standalone.py
index 1023529..a58a697 100644
--- a/scripts/build_standalone.py
+++ b/scripts/build_standalone.py
@@ -9,6 +9,10 @@
from pathlib import Path
+def json_for_script(data) -> str:
+ return json.dumps(data).replace("", "<\\/")
+
+
def inline_assets(html_content: str, dist_dir: Path, base_path: str = "/") -> str:
"""
Replace external CSS and JS references with inline content.
@@ -64,7 +68,7 @@ def inject_data(html_content: str, data_json_path: Path) -> str:
data = json.load(f)
# Inject data before the main script
- data_script = f''
+ data_script = f''
# Insert before closing