https://discuss.asciidoctor.org/Using-the-parent-section-id-in-section-link-tp463p476.html
Costin,
Currently, there isn't a way to change it, short of monkeypatching the Section class.
class Section
def generate_id
# implement custom strategy here
end
end
Given that there are likely numerous requirements about how to autogenerate an id beyond the limited control AsciiDoc / Asciidoctor provide out of the box, I see this as a something well worth making pluggable. In fact, I need to do this anyway since there is a place in the code where I need to generate an id this way that isn't a section.
The first step is to refactor the generate_id method by pulling it up into a SectionIdGenerator implementation. Then, we can perhaps introduce a method in the Extension registration that lets you set your own implementation.
Extensions.register do |document|
sectid_generator, InheritableSectionIdGenerator
end
We could introduce a bunch of built-in generators, but that just seems like a fishing expedition, at least this early in the game. I'd say we introduce those when it's obvious that we sorely need them...though we could put the implementation classes in Asciidoctor so all you have to do is register one.
Can you file an issue for this enhancement? I'm also interest in feedback, particularly around naming and the design strategy for how the generators get created. Given your expertise, I have a feeling you're pretty good at this sort of thing :)
-Dan