Skip to content

Commit cacaa79

Browse files
committed
Update intra_rustdoc_links
- Mention this is valid Markdown - Add more alternatives
1 parent 0483d34 commit cacaa79

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

text/0000-intra-rustdoc-links.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ it should also be possible to write a Rust path
8080
and somewhere else in the document: `[iter]: std::iter::Iterator`
8181
3. `<std::iter::Iterator>`
8282

83+
All additions are already valid Markdown,
84+
as defined by the orginal [Markdown syntax definition][md]
85+
as well as the [CommonMark] project.
86+
Especially, Rust paths are valid CommonMark [link destinations],
87+
even with the suffixes described [below][path-ambiguities].
88+
89+
[md]: https://daringfireball.net/projects/markdown/syntax
90+
[CommonMark]: http://commonmark.org
91+
[link destinations]: http://spec.commonmark.org/0.27/#link-destination
92+
8393
## How it will be rendered
8494

8595
The following:
@@ -146,6 +156,7 @@ mod amet {
146156
```
147157

148158
## Path ambiguities
159+
[path-ambiguities]: #path-ambiguities
149160

150161
Rust allows items to have the same name. A short evaluation revealed that
151162

@@ -271,9 +282,29 @@ Maybe present an example use case of a module whose documentation links to sever
271282
# Alternatives
272283
[alternatives]: #alternatives
273284

274-
## Syntax alternatives
285+
- Use reference-style links and automatically generate the references.
286+
For example, the Markdown snippet
287+
288+
```md
289+
This is of type [`String`].
290+
```
291+
292+
expects a link reference definition like
275293

276-
Introduce special syntax for this:
294+
```md
295+
[`String`]: https://doc.rust-lang.org/nightly/std/string/struct.String.html
296+
```
297+
298+
to follow (or precede) it.
299+
This link reference definition can be automatially generated by Rustdoc
300+
with the (relative) URL to the page of the item.
301+
This was suggested in [the CommonMark forum]
302+
as well as
303+
by [GuillaumeGomez](https://github.com/GuillaumeGomez).
304+
305+
We consider this equivalent to the `<String>` syntax this RFC proposes.
306+
307+
[cm-forum]: https://talk.commonmark.org/t/what-should-the-rust-community-do-for-linkage/2141
277308

278309
- [javadoc] and [jsdoc]
279310
use `{@link java.awt.Panel}`
@@ -282,6 +313,10 @@ Introduce special syntax for this:
282313
[javadoc]: http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html
283314
[jsdoc]: http://usejsdoc.org/tags-inline-link.html
284315

316+
- [@kennytm](https://github.com/kennytm)
317+
listed other syntax alternatives
318+
[here](https://github.com/rust-lang/rfcs/pull/1946#issuecomment-284718018).
319+
285320

286321
# Unresolved questions
287322
[unresolved]: #unresolved-questions

0 commit comments

Comments
 (0)