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

flatten only tags with no attributes #12

Open
mariusa opened this issue Jun 8, 2022 · 0 comments
Open

flatten only tags with no attributes #12

mariusa opened this issue Jun 8, 2022 · 0 comments

Comments

@mariusa
Copy link

mariusa commented Jun 8, 2022

Hi and thanks for this useful library!

How can one flatten only tags with no attributes? eg

sanitizeHtml(document, '<span><span>This is into useless spans</span></span>. <i>Hello</i> <span style="color: #ff3333;">world!</span>', {
  allow_tags_deep: { '.*': '.*' },
  flatten_tags_deep: { '.*': 'span' },
});
=>
"This is into useless spans. <i>Hello</i> <span style="color: #ff3333;">world!</span>"

(need to keep spans which have attributes)

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

No branches or pull requests

1 participant