diff --git a/src/filters/html.ts b/src/filters/html.ts index 3121857e3..0dd5f77d3 100644 --- a/src/filters/html.ts +++ b/src/filters/html.ts @@ -45,5 +45,5 @@ export function newline_to_br (this: FilterImpl, v: string) { export function strip_html (this: FilterImpl, v: string) { const str = stringify(v) this.context.memoryLimit.use(str.length) - return str.replace(/||<.*?>|/g, '') + return str.replace(/||<[\s\S]*?>|/g, '') } diff --git a/test/integration/filters/html.spec.ts b/test/integration/filters/html.spec.ts index fce809d3a..c4551dad4 100644 --- a/test/integration/filters/html.spec.ts +++ b/test/integration/filters/html.spec.ts @@ -77,5 +77,10 @@ describe('filters/html', function () { it('should strip until empty', function () { return test('{{"

< p >

" | strip_html }}', '') }) + it('should strip generic tags spanning ASCII newlines inside the tag', function () { + expect(liquid.parseAndRenderSync('{{"" | strip_html}}')).toBe('') + expect(liquid.parseAndRenderSync('{{"" | strip_html}}')).toBe('') + expect(liquid.parseAndRenderSync('{{"" | strip_html}}')).toBe('') + }) }) })