diff --git a/src/lib/snipTagContent.ts b/src/lib/snipTagContent.ts index 0f8d1190..b61757af 100644 --- a/src/lib/snipTagContent.ts +++ b/src/lib/snipTagContent.ts @@ -1,8 +1,11 @@ export const snippedTagContentAttribute = '✂prettier:content✂'; export function snipTagContent(tagName: string, source: string, placeholder = ''): string { - const regex = new RegExp(`<${tagName}([^]*?)>([^]*?)<\/${tagName}>`, 'g'); - return source.replace(regex, (_, attributes, content) => { + const regex = new RegExp(`|<${tagName}([^]*?)>([^]*?)<\/${tagName}>`, 'g'); + return source.replace(regex, (match, attributes, content) => { + if (match.startsWith(' + + + +