Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

string-strip-html: removes <%= %> tags

See original GitHub issue

Issue Description

Package’s name


Describe the bug

string-strip-html is removing <%= %> tags along with everything inside them.

To Reproduce

const {stripHtml} = require('string-strip-html')

const plaintext = stripHtml('<div>My variable: <%= @var %></div>').result

This outputs: My variable:

Expected behavior

Should output: My variable: <%= @var %>

Additional context

Reported in where we currently use v7.0.2, but I’ve just tested with v8.0.1 and the bug is still present.

P.S.: it’s great to have you back here 🥳

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

reveltcommented, Feb 6, 2021

It’s already fixed on local, I’m aiming to release this weekend. Algorithm wise, I DRY’ed up all asserts on "<" (assumption that tag should start here) or ">" (assumption that tag would end here) into separate functions, then beefed them up at that single location with checks, do % precede/follow. Originally, I had added the check against % following a single opening, on only one clause, inline. Now it’s checking everywhere, properly. It’s a good future-proof measure, we’ll be able to supplement more templating language types that way. Maybe another templating language like <$... $> or something…

reveltcommented, Feb 3, 2021

on it. sorry about that

Read more comments on GitHub >

github_iconTop Results From Across the Web

string-strip-html - npm
Strip HTML tags from strings. No parser, accepts mixed sources.. Latest version: 13.0.6, last published: 5 days ago.
Read more >
4 Ways to Strip & Remove HTML Tags In Javascript - Code Boxx
This tutorial will walk through ways to strip or remove HTML tags in Javascript. ... Use a library such as String Strip HTML....
Read more >
string-strip-html open source npm package - Codsen
These tags will be removed along with their children tags. Set it to something falsy to turn it off. You can set it...
Read more >
string-strip-html | Yarn - Package Manager
Strip HTML tags from strings. No parser, accepts mixed sources. code, extract, from, html. readme. string-strip- ...
Read more >
How to Strip HTML Tags From String in JavaScript - Linux Hint
This method can be implemented in such a way that if the particular string includes the “<script>” element, string-strip-html() will remove it along...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found