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

Is there any way to remove inline styles? #689

Closed
i-give-up opened this issue Mar 9, 2018 · 2 comments
Closed

Is there any way to remove inline styles? #689

i-give-up opened this issue Mar 9, 2018 · 2 comments

Comments

@i-give-up
Copy link

i-give-up commented Mar 9, 2018

[Feature request] One workaround is to use --clean yes and then remove the <style> tag manually. But a built-in way for tidy to remove inline styles would be quicker and would result in a smaller file size.

Use case: when exporting a spreadsheet as HTML, the program tries to preserve the original appearance using a lot of style information resulting in an odd-looking HTML table.

Input

<!DOCTYPE html>
<html>
  <title>Testing</title>
<body>
<table>
  <tr>
    <td style="font-weight:bold">Hello whirl!</td>
    <td style="color:red">Goodbye!</td>
  </tr>
</table>
</body>
</html>

Desired output

<!DOCTYPE html>
<html>
  <title>Testing</title>
<body>
<table>
  <tr>
    <td>Hello whirl!</td>
    <td>Goodbye!</td>
  </tr>
</table>
</body>
</html>
@geoffmcl
Copy link
Contributor

@i-give-up thought about this but certainly at the moment there is no option to just delete style, as you are requesting...

While one of tidy's actions is to clean a document, but in doing so considerable care has been taken to try to keep the rendering in a browser unchanged.

Such an option is asking tidy to deliberately mess up the rendering...

So at this moment do not see this as a suitable option for tidy, but would try to listen to other feedback and ideas... thanks...

@geoffmcl geoffmcl added this to the 5.7 milestone Mar 13, 2018
@geoffmcl
Copy link
Contributor

@i-give-up for the reasons mentioned marking this Won't Fix, and closing it... thanks...

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

No branches or pull requests

2 participants