@@ -80,6 +80,16 @@ it should also be possible to write a Rust path
80
80
and somewhere else in the document: ` [iter]: std::iter::Iterator `
81
81
3 . ` <std::iter::Iterator> `
82
82
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
+
83
93
## How it will be rendered
84
94
85
95
The following:
@@ -146,6 +156,7 @@ mod amet {
146
156
```
147
157
148
158
## Path ambiguities
159
+ [ path-ambiguities ] : #path-ambiguities
149
160
150
161
Rust allows items to have the same name. A short evaluation revealed that
151
162
@@ -173,7 +184,9 @@ This was originally proposed by
173
184
going into more details:
174
185
175
186
> ` <syntax::ptr::P> ` — First search for type-like items. If not found, search for value-like items
187
+ >
176
188
> ` <syntax::ptr::P()> ` — Only search for functions.
189
+ >
177
190
> ` <std::stringify!> ` — Only search for macros.
178
191
179
192
## Linking to methods
@@ -271,9 +284,29 @@ Maybe present an example use case of a module whose documentation links to sever
271
284
# Alternatives
272
285
[ alternatives ] : #alternatives
273
286
274
- ## Syntax alternatives
287
+ - Use reference-style links and automatically generate the references.
288
+ For example, the Markdown snippet
289
+
290
+ ``` md
291
+ This is of type [`String`].
292
+ ```
293
+
294
+ expects a link reference definition like
275
295
276
- Introduce special syntax for this:
296
+ ``` md
297
+ [`String`]: https://doc.rust-lang.org/nightly/std/string/struct.String.html
298
+ ```
299
+
300
+ to follow (or precede) it.
301
+ This link reference definition can be automatially generated by Rustdoc
302
+ with the (relative) URL to the page of the item.
303
+ This was suggested in [ the CommonMark forum]
304
+ as well as
305
+ by [ GuillaumeGomez] ( https://github.com/GuillaumeGomez ) .
306
+
307
+ We consider this equivalent to the ` <String> ` syntax this RFC proposes.
308
+
309
+ [ cm-forum ] : https://talk.commonmark.org/t/what-should-the-rust-community-do-for-linkage/2141
277
310
278
311
- [ javadoc] and [ jsdoc]
279
312
use ` {@link java.awt.Panel} `
@@ -282,6 +315,10 @@ Introduce special syntax for this:
282
315
[ javadoc ] : http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html
283
316
[ jsdoc ] : http://usejsdoc.org/tags-inline-link.html
284
317
318
+ - [ @kennytm ] ( https://github.com/kennytm )
319
+ listed other syntax alternatives
320
+ [ here] ( https://github.com/rust-lang/rfcs/pull/1946#issuecomment-284718018 ) .
321
+
285
322
286
323
# Unresolved questions
287
324
[ unresolved ] : #unresolved-questions
0 commit comments