Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/lib/md/preprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const extUrlRefs = EXT_URLS

type RegexSearchAndReplace = {
search: RegExp
replace: RegExp
// type union for current 'escapeAnchorChars()' implementation
replace: RegExp | string
}

// Match {myVar} styled placeholders
Expand Down Expand Up @@ -78,7 +79,11 @@ const escapeAnchorChars = (
if (!content) {
return content
}
content = content.replace(regex.search, regex.replace)

//type guard for current implementation
if (typeof regex.replace === "string") {
content = content.replace(regex.search, regex.replace)
}

return content
}
Expand Down