PERF: only output an html id if a style is applied
- [x] closes #20695
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Greatly reduces the amount of `id` tag in the cells by only assigning one when a style is applied to that cell. If that is the not correct approach for solving #20695, I am open to suggestions.

Also I was confused by the `%-` tags to handle the whitespaces. Is there a reason the default options to handle whitespace are not used?