You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This regex will match the entire fragment (including the uncommented <img src="..."> tag) and causes inline-source to ignore the image.
I'm having trouble groking the regex personally (as I'm not sure what the i is for, and I can't make sense of the mismatched brackets), but the problem seems to be due to the use of a newline to separate the open/close tags for the comment, without any other characters.
If I change the + into a *, the regex works for me, but -- as I'm not clear on exactly how this regex works -- I can't speak to if that creates any false positives or what the best solution is.
Unfortunately my use case ingests HTML generated by a third party library, meaning I can't easily generate the HTML without the useless comment.
Thanks for your help!
The text was updated successfully, but these errors were encountered:
Oh wait. I just realized the second [ appears to be recognized in JS as a literal [. If that's the case, while I'm still not sure why the i is in the pattern, the following regex seems likely to do the trick:
/(<!--(?!=[\[i])[\S\s]+?--\s?>)/
Happy to create a PR if you'd like.
Note: I escaped the literal [ for ease of understanding above, but I imagine that can be removed if desired.
I just ran into an issue with this library where (what I think is) valid, uncommented HTML is being removed at
inline-source/src/parse.js
Line 25 in bc91b4f
due to the
RE_COMMENT
regex here:inline-source/src/parse.js
Line 16 in bc91b4f
A minimal example is this HTML fragment.
This regex will match the entire fragment (including the uncommented
<img src="...">
tag) and causesinline-source
to ignore the image.I'm having trouble groking the regex personally (as I'm not sure what the
i
is for, and I can't make sense of the mismatched brackets), but the problem seems to be due to the use of a newline to separate the open/close tags for the comment, without any other characters.If I change the
+
into a*
, the regex works for me, but -- as I'm not clear on exactly how this regex works -- I can't speak to if that creates any false positives or what the best solution is.Unfortunately my use case ingests HTML generated by a third party library, meaning I can't easily generate the HTML without the useless comment.
Thanks for your help!
The text was updated successfully, but these errors were encountered: