Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve comment cleanup regex #309

Merged
merged 3 commits into from
Feb 14, 2024
Merged

Conversation

catalan-adobe
Copy link
Collaborator

Fixes #308.

Copy link
Contributor

@kptdobe kptdobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to add corresponding tests ?

@catalan-adobe
Copy link
Collaborator Author

Would be great to add corresponding tests ?

True true :) ! Done in 6b05e99

kptdobe
kptdobe previously approved these changes Feb 13, 2024
Copy link
Contributor

@kptdobe kptdobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@catalan-adobe
Copy link
Collaborator Author

I spent some more time on this and pushed 0a16dc5:

.replace(/(>\s*)<!--(?!>)[\S\s]*?-->/gm, '$1')

\s matches all "spaces" (space, tab, new line character)

so in the following regex there should be no need of \n.

Also, this combination of regex catches a new case of comments as in:
<p>The content stays<!-- useless comment inside an element --></p>

Copy link

@alexcarol alexcarol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@catalan-adobe catalan-adobe merged commit d406864 into main Feb 14, 2024
3 checks passed
@catalan-adobe catalan-adobe deleted the issue-308-comments-cleanup branch February 14, 2024 10:29
@adobe-bot
Copy link

🎉 This PR is included in version 3.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some comments are not cleaned up during import
4 participants