We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0461840 commit 13e6c7dCopy full SHA for 13e6c7d
packages/tools/src/helpers.ts
@@ -47,7 +47,10 @@ export const slugify = (string: string) => {
47
export const replaceInBetween = (content: string, mark: string, injection: string) => {
48
const escapedMark = mark.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
49
const escapedInjection = injection.replace(/\$/g, '$$$$');
50
- const rx = new RegExp(`${escapedMark}[\\S\\s]*${escapedMark}`, 'gm');
+ const rx = new RegExp(
51
+ `${escapedMark}([\\S\\s](?!${escapedMark}))*(\\s|\\S)?${escapedMark}`,
52
+ 'gm',
53
+ );
54
return content.replace(rx, `${mark}\n${escapedInjection}\n${mark}`);
55
};
56
0 commit comments