Skip to content

Commit cc171de

Browse files
authored
Rollup merge of #121021 - GuillaumeGomez:extend-intra-doc-link-chapter, r=notriddle
Extend intra-doc link chapter in the rustdoc book Linked to #117178. r? `@notriddle`
2 parents e36a7f4 + 1392f60 commit cc171de

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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)