error checking update

This commit is contained in:
2025-09-01 08:51:32 -06:00
parent 523a05d45e
commit ecb5f6d70f
2 changed files with 44 additions and 1 deletions

View File

@@ -92,7 +92,7 @@ export function markdownToHTMLSafe({
const html = markdownToHtmlNoImages(markdownString);
const replacedHtml = replaceText.reduce(
(acc, { source, destination, strict = false }) => {
if (strict) {
if (strict && acc.includes(source)) {
if (typeof destination === "undefined" || destination === null) {
throw new Error(
`Text replacement failed: destination is undefined for source "${source}"`