Link references with text

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Link references with text

aalmiray
Hi,

I'm aware that you can write references to sections in the following manner

[[_section_2_]]
= Section 2
Blah blah blah bla

= Section 3
As explained in <<_section2_,section 2>> blah blah ...

However one has to update the text if the section text changes. Also, if one desires to use the section number and the section is moved the text has to be updated as well.

Is there a way to link to a section and have the text be the exact number/text from the rendered section? Something like <<_section_2,>> perhaps?

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Link references with text

mojavelinux
Administrator
Andres,

Yes, just don't specify the text. Then it will use the title of the target.

<<_section_2>>

This works for all references in the same document (except if the target is a node in the middle of a paragraph).

Cheers,

-Dan

On Thu, Apr 4, 2019 at 2:31 PM aalmiray [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I'm aware that you can write references to sections in the following manner

[[_section_2_]]
= Section 2
Blah blah blah bla

= Section 3
As explained in <<_section2_,section 2>> blah blah ...

However one has to update the text if the section text changes. Also, if one desires to use the section number and the section is moved the text has to be updated as well.

Is there a way to link to a section and have the text be the exact number/text from the rendered section? Something like <<_section_2,>> perhaps?

Cheers,
Andres


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Link-references-with-text-tp6833.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Link references with text

aalmiray
Thanks Dan!