Skip to content

Commit

Permalink
multi tags and titles replaced as well
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko committed Jan 11, 2021
1 parent 0fdc6bc commit afed95f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ export const applyTemplateOnBlock = ({
}: TemplateBlockSettings): string => {
if (value && check()) {
return template
.replace(startBlockPlaceholder, '')
.replace(endBlockPlaceholder, '')
.replace(valuePlaceholder, value);
.replace(new RegExp(`${startBlockPlaceholder}`,'g'), '')
.replace(new RegExp(`${endBlockPlaceholder}`,'g'), '')
.replace(new RegExp(`${valuePlaceholder}`,'g'), value);

}

return template.replace(
new RegExp(
`${startBlockPlaceholder}${M.MATCH_ALL}${endBlockPlaceholder}`,
`${startBlockPlaceholder}([\\D\\d]).*?(?=${endBlockPlaceholder})${endBlockPlaceholder}`,
'g',
),
'',
Expand Down

0 comments on commit afed95f

Please sign in to comment.