Link to relative files in Asciidoc
Asked Answered
S

2

7

I'm writing a document using asciidoc and asciidoctor. So, I'm having a intro.adoc file and then bunch of section files. So, what I want to do is list them on to intro.adoc and add hyperlinks to them so that it will be easy to navigate.

For this I can think of two approaches:

First, I can use headers and associate a relative link to .adoc files in the same directory. So, that they will redirect to them. But I don't know how to achieve it. link: == section1.adoc[Section 1] is not working.

Second, using include::section1.adoc[]. Its working but its not a hyperlink.

What is wrong with it? or is there a easy way to do it.

Edit

If its not clear, I'm trying to achieve this # [Section1](section.md)(Markdown version) in asciidoc.

Sarita answered 26/4, 2017 at 10:30 Comment(1)
@ AnkitRGadiya: have you found a solution in the meantime?Pushing
L
5

What about:

<<section1.adoc#Section1,your link>>

See: https://docs.asciidoctor.org/asciidoc/latest/macros/inter-document-xref/

Leisured answered 28/4, 2017 at 8:20 Comment(2)
Yes the hyperlink is working but it is similar to this link:section1.adoc[Section 1] and what I want is that it renders as a hyperlink in Header. Thanks anywaysSarita
(since the nickname tag doesn't work under the OP, I repeat my question under an answer.) @AnkitRGadiya: have you found a solution in the meantime?Pushing
C
0
== link:../section1.adoc[Section 1]

Should do the work, "==" should be in front of the "link:".

Cormier answered 23/7 at 16:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.