HTML writer:  Make header attributes work outside top level.

Previously they only appeared on top level header elements.
Now they work e.g. in blockquotes.

Closes #1711.