Kévin Le Gouguec <kevin.legoug...@gmail.com> writes: >> 3. Instead of trying to find a silver bullet for human-readable anchor >> generator, we allow users to customize it. The default will be >> constant "org" yielding "org-Ajjq"-type anchors, just like we have >> now. But we can also provide other generators, like the one Timothy >> proposed, or better versions contributed in future if there is >> demand. > > Personally, I'd be wholly satisfied with a customization option; the > grail for me would be [pandoc's algorithm], which doesn't look too hard > to reimplement in one's config. > > (Although the collision-handling logic could be tricky: since it > revolves around appending a counter to the ID, it needs to keep track of > how many times the same ID has been generated for the whole document. > If the generator API is just {heading ↦ ID}, i.e. there is no extra > "context" argument, one will need to do some bookkeeping "on the > side"…)
The collision-handling should not concern the anchor generator code. If an anchor generator returns a duplicate ID, we can just append some symbols to make it unique. All the bookkeeping has to be made in centralized way on ox.el side. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>