danburzo / trimd

Convert between HTML, Markdown, and plain text from the command line.
https://danburzo.ro/projects/trimd/
MIT License
13 stars 0 forks source link

[Online] Add option or action to clean up HTML #6

Closed danburzo closed 8 months ago

danburzo commented 8 months ago

When pasting from a rich-text editing app (such as Apple Notes), the input HTML contains lots of inline styles and classes. It would be great to be able to clean that up.

One solution is to provide input options that apply on paste:

This is more complicated in that we need to parse the input (being mindful of security, and probably utilizing a sanitizer such as DOMPurify), account for ill-formed HTML, etc. Users may also not want to stop at styles and classes when cleaning up the input HTML.

The alternative is to provide a button to transform the resulting Markdown output back into simpler HTML input. Beyond simplification, this has the benefit of beautifying the markup.

danburzo commented 8 months ago

Beautifying the markup was deferred to #7 so that it’s available in the CLI as well.