From c818436e8543e5bad8519715e6bee2c457012653 Mon Sep 17 00:00:00 2001 From: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:29:31 -0400 Subject: [PATCH 1/3] Change summary textContent to innerHTML Signed-off-by: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> --- themes/mieweb-docs/assets/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/mieweb-docs/assets/js/main.js b/themes/mieweb-docs/assets/js/main.js index cb6d23449..6a194ec16 100644 --- a/themes/mieweb-docs/assets/js/main.js +++ b/themes/mieweb-docs/assets/js/main.js @@ -651,7 +651,7 @@ function renderSearchResults(query, results) { if (link) link.href = href || "#"; if (title) title.textContent = result.title; if (summary) { - summary.textContent = result.snippet || ""; + summary.innerHTML = result.snippet || ""; } link?.setAttribute("data-index", index); From acc73e654a786dd15c68a8d71ba3c4de2a68e9fb Mon Sep 17 00:00:00 2001 From: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:46:30 -0400 Subject: [PATCH 2/3] Add HTML decoding for search result snippets Added a function to decode HTML entities and updated the rendering of search result snippets to use this function with DOMPurify for sanitization. Signed-off-by: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> --- themes/mieweb-docs/assets/js/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/mieweb-docs/assets/js/main.js b/themes/mieweb-docs/assets/js/main.js index 6a194ec16..37475791e 100644 --- a/themes/mieweb-docs/assets/js/main.js +++ b/themes/mieweb-docs/assets/js/main.js @@ -621,6 +621,12 @@ function updateSelectedResult(results) { /** * Render a list of search results (from the worker) into the modal. */ +function decodeHtml(str) { + return new DOMParser() + .parseFromString(str, "text/html") + .documentElement.textContent; +} + function renderSearchResults(query, results) { if (!searchResults) return; @@ -651,7 +657,7 @@ function renderSearchResults(query, results) { if (link) link.href = href || "#"; if (title) title.textContent = result.title; if (summary) { - summary.innerHTML = result.snippet || ""; + summary.textContent = DOMPurify.sanitize(decodeHtml(result.snippet)) || ""; } link?.setAttribute("data-index", index); From 778e906480f484d8d0aca1f8b9d97a6ad172ed9d Mon Sep 17 00:00:00 2001 From: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:48:06 -0400 Subject: [PATCH 3/3] Update main.js Signed-off-by: Monika-MIE <162727606+pierzchala-m@users.noreply.github.com> --- themes/mieweb-docs/assets/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/mieweb-docs/assets/js/main.js b/themes/mieweb-docs/assets/js/main.js index 37475791e..a46539fde 100644 --- a/themes/mieweb-docs/assets/js/main.js +++ b/themes/mieweb-docs/assets/js/main.js @@ -657,7 +657,7 @@ function renderSearchResults(query, results) { if (link) link.href = href || "#"; if (title) title.textContent = result.title; if (summary) { - summary.textContent = DOMPurify.sanitize(decodeHtml(result.snippet)) || ""; + summary.textContent = decodeHtml(result.snippet) || ""; } link?.setAttribute("data-index", index);