Update custom heading rendering

1. Same as "Closes #360: non-ascii heading id generation".
2. For now, add to all headings a class (html) so they will be indexed in the table of contents.