Urlize shortcode inner content

I’m attempting to generate url safe anchor tags for some shortcode blocks. The idea is that these shortcodes are for headers that have specific templates, I want to make them linkable and since the Inner content is the header title I figured i’d just use those generated as safe urls.

Simple example:

{{ $url := .Inner }}
<div  id="{{ $url | urlize}}">

This however just escapes like so:
<p>&lt;div id=”</p>

You might try anchorize: https://gohugo.io/functions/anchorize/#readout


div id=“{{ $url | safeHTMLAttr }}”

And I agree: This is one of the more confusing parts of the Go HTML templates.