How to cross reference code annotations (aka callouts) in asciidoc?

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

How to cross reference code annotations (aka callouts) in asciidoc?

siddjain
Say I have following asciidoc:

[source,ruby]
----
require 'asciidoctor' <1>
puts Asciidoctor.render_file('sample.adoc', :header_footer => true) <2>
----
<1> Imports the library
<2> Reads, parses and renders the file

How can I now cross reference <1> here? Just typing <1> renders it literally.

Reply | Threaded
Open this post in threaded view
|

Re: How to cross reference code annotations (aka callouts) in asciidoc?

TheElderCat
Not sure if this is what you are trying to do? If not, please ignore. It just shows how to create links which when clicked will make the browser show the line containing the specific callout at the top of the screen.

= Cross Referencing Callouts From A Code Listing
:icons: font

.Code Listing Number 1

[source, ruby]

----
require 'asciidoctor' <1>
puts Asciidoctor.render_file('sample.adoc',:header_footer=>true) <2>
----
<1> Imports the library [[_1_1]]
<2> Reads,parses and renders the file [[_1_2]]

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

====
A random sidebar.
====

<<_1_1,1>> *_Listing 1, Callout 1._*

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

====
A random sidebar.
====

<<_1_2,2>> *_Listing 1, Callout 2._*

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

.Code Listing Number 2

[source, ruby]

----
require 'asciidoctor' <1>
puts Asciidoctor.render_file('sample.adoc',:header_footer=>true) <2>
----
<1> Imports the library [[_2_1]]
<2> Reads,parses and renders the file [[_2_2]]


====
A random sidebar.
====

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

<<_2_1,1>> *_Listing 2, Callout 1._*

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

====
A random sidebar.
====

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text

<<_2_2,2>> *_Listing 2, Callout 2._*

random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
random text random text random text random text random text
Reply | Threaded
Open this post in threaded view
|

Re: How to cross reference code annotations (aka callouts) in asciidoc?

mojavelinux
Administrator
In reply to this post by siddjain

-Dan

On Mon, Jun 22, 2020 at 3:25 PM siddjain [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Say I have following asciidoc:

[source,ruby]
----
require 'asciidoctor' <1>
puts Asciidoctor.render_file('sample.adoc', :header_footer => true) <2>
----
<1> Imports the library
<2> Reads, parses and renders the file

How can I now cross reference <1> here? Just typing <1> renders it literally.




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/How-to-cross-reference-code-annotations-aka-callouts-in-asciidoc-tp8082.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux