rustdoc: make calls of markdown::render safer

Previously, external code might call `markdown::render()` without having
called `markdown::reset_headers()`, meaning the TLS key
`used_header_map` was unset.  Now `markdown::render()` ensures that
`used_header_map` is set by calling `reset_headers` if necessary.

Fix #17736
auto merge of #17796 : tomjakubowski/rust/rustdoc-ice-17736, r=alexcrichton

Previously, external code might call `markdown::render()` without having
called `markdown::reset_headers()`, meaning the TLS key
`used_header_map` was unset.  Now `markdown::render()` ensures that
`used_header_map` is set by calling `reset_headers` if necessary.

Fix #17736