Skip to content

Commit bcd8372

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

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
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 }}
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

share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@
2121
{{#if symbol.doc.brief}}
2222
{{{symbol.doc.brief}}}
2323

24-
{{/if}}
25-
{{! Breadcrumbs
26-
27-
The antora breadcrumbs do not work with the multipage documentation.
28-
29-
This includes symbol/qualified-name here as an alternative for users
30-
to visit parent scopes.
31-
}}
32-
{{#if @root.config.multipage }}
33-
{{#> markup/code-block }}
34-
{{> symbol/qualified-name symbol }}
35-
{{/markup/code-block}}
3624
{{/if}}
3725
{{! Synopsis }}
3826
{{#unless (eq symbol.kind "namespace")}}

0 commit comments

Comments
 (0)