fix(baoyu-post-to-wechat): prevent placeholder regex from matching longer numbered variants
This commit is contained in:
parent
83afacb00e
commit
eb416d174c
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue