TOC hook fails with UnboundLocalError when heading id is None
TOC hook fails with UnboundLocalError when heading id is None: a task in UltraTerminal (Harbor dataset). When using the TOC hook without providing a custom heading id function, the code raises an UnboundLocalError because the default heading id function is not properly defined before it's used.
The task
When using the TOC hook without providing a custom `heading_id` function, the code raises an `UnboundLocalError` because the default `heading_id` function is not properly defined before it's used.
Part of harness-hub/UltraTerminal.