You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference-dev-guide/src/links.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,20 @@ This chapter explains how links should be handled by the Reference. Several of t
4
4
5
5
See also the [linkchecker tests](tests.md#linkcheck) for testing links.
6
6
7
+
## Rule links
8
+
9
+
[Rules](rules/index.md) can be linked to by their ID using Markdown, with the destination set to the rule ID. Automatic link references allow any rule to be referred to from any page in the book.
10
+
11
+
```markdown
12
+
Direct label link: [names.preludes.lang]
13
+
14
+
Destination label link (custom link text): [language prelude][names.preludes.lang]
15
+
16
+
Definition link: [namespace kinds]
17
+
18
+
[namespace kinds]: names.namespaces.kinds
19
+
```
20
+
7
21
## Standard library links
8
22
9
23
You should link to the standard library without specifying a URL in a fashion similar to [rustdoc intra-doc links][intra]. Some examples:
@@ -51,3 +65,33 @@ When rendering the Reference locally, by default it uses relative links to confo
Link definitions are automatically generated for all grammar production names. See [grammar automatic linking](grammar.md#automatic-linking) for more.
72
+
73
+
```markdown
74
+
This attribute uses the [MetaWord] syntax.
75
+
76
+
Explicit grammar links can have the `grammar-` prefix like [Type][grammar-Type].
77
+
```
78
+
79
+
## Outside book links
80
+
81
+
Links to other books published with the Reference should be relative links pointing to the corresponding book. This allows the links to point to the correct version, to work with the offline docs, and to be checked by the linkchecker. For example:
When possible, internal links should use [rule links](#rule-links) or [grammar links](#grammar-links). Otherwise, links should be relative to the file path and use the `.md` extension.
0 commit comments