I would like to propose a modification to the Cleaner class.
It would be nice to be able to clean the <head> as well as <body> if we need it.
Why doing this?
I am working on a mail iOS app and I need to show HTML mails. When I sanitize the message, I want to clean the whole document, so <head> and <body>.
On Android, the mail app k9 does the same process. They have created a HeadCleaner class: k9mail - HeadCleaner.kt which is a visitor that cleans the <head> tag.
You have an example here of how I am using this : feat: Clean head and body from html document #719.
I understand it's quite a big change and SwiftSoup would be slightly different from Jsoup. This change does not break the current API at all but adds an option for those who will need it.
I need this modification for my project and rather than doing this for myself only, I thought it would be nice to create a PR if it can help other people. So you can decide if this change belongs in SwiftSoup or not 😃
👋 Hello
I would like to propose a modification to the
Cleaner
class. It would be nice to be able to clean the<head>
as well as<body>
if we need it.Why doing this? I am working on a mail iOS app and I need to show HTML mails. When I sanitize the message, I want to clean the whole document, so
<head>
and<body>
. On Android, the mail app k9 does the same process. They have created aHeadCleaner
class: k9mail - HeadCleaner.kt which is a visitor that cleans the<head>
tag. You have an example here of how I am using this : feat: Clean head and body from html document #719.I understand it's quite a big change and SwiftSoup would be slightly different from Jsoup. This change does not break the current API at all but adds an option for those who will need it.
I need this modification for my project and rather than doing this for myself only, I thought it would be nice to create a PR if it can help other people. So you can decide if this change belongs in SwiftSoup or not 😃