Skip to content

Commit 1392f60

Browse files
Extend intra-doc link chapter in the rustdoc book
1 parent d6c46a2 commit 1392f60

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md

+18
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,21 @@ will be given, even if the link fails to resolve. For example, any link containi
151151
characters will be ignored.
152152

153153
[#72243]: https://github.com/rust-lang/rust/issues/72243
154+
155+
## What happens in case an intra-doc link cannot be generated
156+
157+
In some cases (items behind a `cfg` for example), an intra-doc link cannot be generated to item.
158+
There are different ways to create a link in markdown, and depending on the one you use, it will
159+
render differently in this case:
160+
161+
```md
162+
1. [a]
163+
2. [b][c]
164+
3. [d](e)
165+
4. [f]
166+
167+
[f]: g
168+
```
169+
170+
`1.` and `2.` will will be displayed as is in the rendered documentation (ie, `[a]` and `[b][c]`)
171+
whereas `3.` and `4.` will be replaced by a link targetting `e` for `[d](e)` and `g` for `[f]`.

0 commit comments

Comments
 (0)