Fair point. Would it be sufficient to give these type of links a class,
say "org-internal-links". Then you should be able to explicitly turn off
the content for these links.
.org-internal-links::after {content:"";}
I don't know, looks like a bug to me.
I haven't put much thought into it, but I wonder if it would be possible
to ignore EXTRA-IDS and only use PREFERRED-ID (see `org-html-headline'),
i.e., use
(or (org-element-property :CUSTOM_ID headline)
(org-export-get-reference headline info))
It could be a problem when publishing to HTML, but I'm not sure at this
point.
Going back to the original report:
------------------------------
<div id="outline-container-orgf4e5527" class="outline-2">
<h2 id="orgf4e5527"><span class="section-number-2">1</span> heading 1</h2>
</div>
<div id="outline-container-orge4e91c4" class="outline-2">
<h2 id="my-name"><a id="orge4e91c4"></a><span
class="section-number-2">2</span> heading 2</h2>
<div class="outline-text-2" id="text-my-name">
</div>
-------------------------------
The first headline with no CUSTOM_ID exports to "<h2 id="orgf4e5527">"
The second headline with a CUSTOM_ID exports to "<h2 id="my-name"><a
id="orge4e91c4"></a>"
Seems like the second one should export to either "<h2 id="my-name">" or
"<h2 id="my-name" id="orge4e91c4">". Not sure why the empty link is
being inserted or needs to be there at all.
Deepak