simonw/strip-tags

Exclude tags option: -r/--remove

Closed this issue · 3 comments

HaveF commented

I like this tool, thank you, Simon.

In most of time, it seems that we don't know where is the the main part of a common page.

But we may know we don't want aside, we don't want 'header', 'footer', 'nav'...

So, I believe exclude tags options may useful?

This is interesting - yeah, it makes sense to me.

A -x/--exclude option could fit here. Here's what --help would look like with that:

Options:
  --version             Show the version and exit.
  -i, --input FILENAME
  -m, --minify          Minify whitespace
  -x, --exclude TEXT    Exclude content in these selectors
  -t, --keep-tag TEXT   Keep these <tags>
  --all-attrs           Include all attributes on kept tags
  --first               First element matching the selectors
  --help                Show this message and exit.

Demo:

curl -s https://datasette.io/ | strip-tags -r nav -r footer -m