maike
maike

Reputation: 31

How can I link to different page and scroll to a specific section?

I want a link on page1.adoc to page2.adoc and then directly scroll/go to section 2 on this page. How can I do it? I can´t find a solution for my problem.

Upvotes: 1

Views: 1060

Answers (1)

Kiroul
Kiroul

Reputation: 535

What you are looking for are Document to Document Cross References. A simple example of 2 files referencing each other is:

filea.adoc

= doc A

[#linkdoca]
this is a text with the linkdoca id/reference

xref:fileb.adoc#linkdocb[go to linkdocb in fileb.adoc]

fileb.adoc

= doc B

[#linkdocb]
this is a text with the linkdocb id/reference

xref:filea.adoc#linkdoca[go to linkdoca in filea.adoc]

Both files are in the same folder, after converting them with asciidoctor the HTML files link to each other.

Upvotes: 2

Related Questions