Version 0.2.0 of ox-html-stable-ids resolves an issue that caused previous versions to break internal links when exporting Org documents to HTML.
Given the following example document:
1. one item 2. <<target>>another item Here we refer to item target.
By default, Org’s HTML exporter produces an anchor and a link with an non-unique ID like “org7f59846”:
<ol class="org-ol"> <li>one item</li> <li><a id="org7f59846"></a>another item</li> </ol> <p> Here we refer to item <a href="#org7f59846">2</a>. </p>
With ox-html-stable-ids enabled, those IDs should be made unique, but previous versions failed to extract the elements’ values, causing broken links:
<ol class="org-ol"> <li>one item</li> <li><a></a>another item</li> </ol> <p> Here we refer to item <a href="#nil">2</a>. </p>
Extracting the values for each element happens by taking its :raw-value property.
Because some elements, like anchors and links, don’t have such a property, ox-html-stable-ids 0.2.0 has a fallback that tries the :value property, but only if it’s an inline element:
(defun org-html-stable-ids--extract-value (datum) (let ((value (or (org-element-property :raw-value datum) (org-element-property-raw :value datum)))) (unless (org-element-deferred-p value) value)))
This way of extracting values resolves the issue and results in stable IDs for internal links:
<ol class="org-ol"> <li>one item</li> <li><a id="target"></a>another item</li> </ol> <p> Here we refer to item <a href="#target">2</a>. </p>