Login  Register

Re: Create cross-reference to section number

Posted by apj68 on Jan 23, 2021; 4:43am
URL: https://discuss.asciidoctor.org/Create-cross-reference-to-section-number-tp8451p8454.html

Thanks, I did see that which works for getting the section number but mainly my challenge is how can I create a link to the section using a reference name that I can easily write in my link?  For example, I'm linking to what could be long "section" titles:

=== Does http://www.example.com:1090 bring you to a valid location?

Unlike something like:

=== Simple Section

Which I believe I could link to with link:#simple_section.

I do understand with short xrefstyle links I can get just the number but how can I create a reference to the first section mentioned above?  My struggle is how to link to the section.  What I'd _like_ to do is something like this:

== Do you need to check the URL?  Goto <<checkurl>>.

=== Does http://www.example.com:1090 bring you to a valid location? [[checkurl]]

But I want the generated link to be the section number (i.e., "Goto 1.1" rather than "Goto checkurl").  I also don't want to put a custom reftext because then I'll have to maintain that if the section changes.  That is:

=== Does http://www.example.com:1090 bring you to a valid location? [[checkurl,"1.1"]]

I hope this is making sense. . .?