Skip to content

Commit 5d3e8f6

Browse files
committed
fix: adoc multipage wrapper includes relfileprefix
1 parent 8693504 commit 5d3e8f6

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

share/mrdocs/addons/generator/adoc/layouts/wrapper.adoc.hbs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,32 @@
99
1010
Breadcrumbs are included in the symbol template as an alternative.
1111
}}
12-
= {{> symbol/qualified-name symbol nolink=true }}
12+
= {{> symbol/qualified-name symbol nolink=false }}
13+
{{!
14+
Antora does not support relative links to pages in
15+
parent directories. Therefore, unlike in HTML templates,
16+
links are not relativized.
17+
18+
However, while Antora interprets xref as relative
19+
to the root of the module, these xref are
20+
interpreted as relative to the current directory
21+
because it has no concept of modules. This means
22+
links would be broken with either Antora or Asciidoc.
23+
24+
Even more, Antora uses the same rule as Asciidoc
25+
for breadcrumbs and the page title, where links
26+
would also be broken.
27+
28+
The solution is to set the relfileprefix attribute,
29+
which includes the relative location of the root
30+
directory and makes all links relative to it.
31+
32+
This relfileprefix affects Asciidoc links, the
33+
Antora title, and the Antora breadcrumbs.
34+
35+
See https://docs.asciidoctor.org/asciidoc/latest/macros/inter-document-xref/#mapping-references-to-a-different-structure
36+
}}
37+
:relfileprefix: {{{ repeat "../" (count (remove_prefix symbol.url '/') '/') }}}
1338
{{else}}
1439
{{! Single page documentation: symbol is not available to the wrapper }}
1540
= Reference

0 commit comments

Comments
 (0)