fix(baoyu-post-to-wechat): prevent placeholder regex from matching longer numbered variants

This commit is contained in:
Jim Liu 宝玉 2026-03-20 18:45:05 -05:00
parent 83afacb00e
commit eb416d174c
1 changed files with 1 additions and 1 deletions

View File

@ -450,7 +450,7 @@ function renderMarkdownWithPlaceholders(
function replaceAllPlaceholders(html: string, placeholder: string, replacement: string): string { function replaceAllPlaceholders(html: string, placeholder: string, replacement: string): string {
const escapedPlaceholder = placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const escapedPlaceholder = placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
return html.replace(new RegExp(escapedPlaceholder, "g"), replacement); return html.replace(new RegExp(escapedPlaceholder + "(?!\\d)", "g"), replacement);
} }
function extractHtmlContent(htmlPath: string): string { function extractHtmlContent(htmlPath: string): string {