(blog) change boundary checks for spoiler syntax, as it may be adjacent to a html tag (which is not a whitespace)

This commit is contained in:
Valentyne Stigloher 2025-01-03 17:36:43 +01:00
parent ed73460849
commit b2f0b9da82

View File

@ -143,7 +143,7 @@ export default async function parseMarkdown(markdown: string, translator: Transl
.replace(/<p>{wide_table}<\/p>/g, '<div class="table-wide table-responsive my-5 headers-nowrap">')
.replace(/<p>{\/wide_table}<\/p>/g, '</div>')
.replace(/<p>{gallery={(.*?)}}<\/p>/gms, generateGallery)
.replace(/(?<=\s|^)!!(.*?)!!(?=\s|$)/gms, (_: string, spoilerString: string): string => {
.replace(/(?<![\w!])!!(.*?)!!(?![\w!])/gs, (_: string, spoilerString: string): string => {
return `<span class="spoiler">${spoilerString}</span>`;
})
}</div>`;