Headings encoding

Make the headingsID unique and use `encodeURIComponent` for unicode headings.