I think there might be a problem with section IDs. Take this example:
In a Gemini client, the link would make a new request to the current URL
with the fragment #Title.
But with this patch, it would be converted to the following HTML:
And then the link would wrongly point to the header.