Skip to content

Commit 471dd21

Browse files
committed
docs: clean up
1 parent 8c2548a commit 471dd21

File tree

5 files changed

+116
-119
lines changed

5 files changed

+116
-119
lines changed

crates/mdbookkit/tests/snaps/link_forever/README.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ expression: output
77
![mdbookkit hero image](https://github.com/lorem/ipsum/tree/dolor/docs/src/media/banner.webp)
88

99
[![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit)
10-
[![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit)
10+
[![documentation](https://img.shields.io/github/actions/workflow/status/tonywu6/mdbookkit/docs.yml?branch=main&event=release&style=flat-square&label=docs)](https://docs.rs/mdbookkit)
1111
[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](https://github.com/lorem/ipsum/tree/dolor/LICENSE-APACHE.md)
1212

1313
Quality-of-life plugins for your [mdBook] project.

crates/mdbookkit/tests/snaps/link_forever/_stderr.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ expression: report
77
4
88
5 │ [![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit)
99
· ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
10-
6 │ [![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit)
11-
· ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
10+
6 │ [![documentation](https://img.shields.io/github/actions/workflow/status/tonywu6/mdbookkit/docs.yml?branch=main&event=release&style=flat-square&label=docs)](https://docs.rs/mdbookkit)
11+
· ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1212
7 │ [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](/LICENSE-APACHE.md)
1313
· ───────────────────────────────────────────────────────────────────────────────────────
1414
8
@@ -40,7 +40,7 @@ expression: report
4040
· ╰── https://github.com/lorem/ipsum/tree/dolor/docs/src/media/banner.webp
4141
4 │
4242
5 │ [![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit)
43-
6 │ [![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit)
43+
6 │ [![documentation](https://img.shields.io/github/actions/workflow/status/tonywu6/mdbookkit/docs.yml?branch=main&event=release&style=flat-square&label=docs)](https://docs.rs/mdbookkit)
4444
7 │ [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](/LICENSE-APACHE.md)
4545
· ──────────────────────────────────────────────────────┬──────────────────────────────────────────────────────
4646
· ╰── https://github.com/lorem/ipsum/tree/dolor/LICENSE-APACHE.md

crates/mdbookkit/tests/snaps/rustdoc_link/supported-syntax.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ Types can contain generic parameters. This is _compatible_ with rustdoc.
7878
> ```md
7979
> | Phantom type | variance of `T` |
8080
> | :------------------------------------------------- | :---------------- |
81-
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **inv**ariant |
81+
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **in**variant |
8282
> | [`fn(T)`][std::marker::PhantomData<fn(T)>] | **contra**variant |
8383
> ```
8484
>
8585
> | Phantom type | variance of `T` |
8686
> | :------------------------------------------------- | :---------------- |
87-
> | [`&'a mut T`](https://doc.rust-lang.org/stable/core/marker/struct.PhantomData.html "std::marker::PhantomData<&'a mut T>") | **inv**ariant |
87+
> | [`&'a mut T`](https://doc.rust-lang.org/stable/core/marker/struct.PhantomData.html "std::marker::PhantomData<&'a mut T>") | **in**variant |
8888
> | [`fn(T)`](https://doc.rust-lang.org/stable/core/marker/struct.PhantomData.html "std::marker::PhantomData<fn(T)>") | **contra**variant |
8989

9090
This includes if you use turbofish:
@@ -163,8 +163,7 @@ ignored**:
163163
> [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` _module_.
164164
> ```
165165
>
166-
> [`std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "std::vec"), [`mod@std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "mod@std::vec"), and [`macro@std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "macro@std::vec") all link to the `vec` >
167-
> _module_.
166+
> [`std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "std::vec"), [`mod@std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "mod@std::vec"), and [`macro@std::vec`](https://doc.rust-lang.org/stable/alloc/vec/index.html "macro@std::vec") all link to the `vec` _module_.
168167

169168
Currently, duplicate names in Rust are allowed only if they correspond to items in
170169
different [namespaces], for example, between macros and modules, and between struct

crates/mdbookkit/tests/snaps/rustdoc_link/supported-syntax.stderr.snap

Lines changed: 106 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ expression: report
4747
74 │ > ```md
4848
75 │ > | Phantom type | variance of `T` |
4949
76 │ > | :------------------------------------------------- | :---------------- |
50-
77 │ > | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **inv**ariant |
50+
77 │ > | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **in**variant |
5151
78 │ > | [`fn(T)`][std::marker::PhantomData<fn(T)>] | **contra**variant |
5252
79 │ > ```
5353
80 │ >
5454
81 │ > | Phantom type | variance of `T` |
5555
82 │ > | :------------------------------------------------- | :---------------- |
56-
83 │ > | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **inv**ariant |
56+
83 │ > | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **in**variant |
5757
· ─────────────────────────┬────────────────────────
5858
· ╰── https://doc.rust-lang.org/stable/core/marker/struct.PhantomData.html
5959
84 │ > | [`fn(T)`][std::marker::PhantomData<fn(T)>] | **contra**variant |
@@ -160,129 +160,128 @@ expression: report
160160
159 │ > [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` _module_.
161161
160 │ > ```
162162
161 │ >
163-
162 │ > [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` >
163+
162 │ > [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` _module_.
164164
· ──────┬───── ────────┬─────── ─────────┬────────
165165
· │ │ ╰── https://doc.rust-lang.org/stable/alloc/vec/index.html
166166
· │ ╰── https://doc.rust-lang.org/stable/alloc/vec/index.html
167167
· ╰── https://doc.rust-lang.org/stable/alloc/vec/index.html
168-
163 │ > _module_.
169-
164 │
170-
165 │ Currently, duplicate names in Rust are allowed only if they correspond to items in
171-
166 │ different [namespaces], for example, between macros and modules, and between struct
172-
167 │ fields and methods — this is mostly covered by the function and macro syntax, described
173-
168 │ [above](#functions-and-macros).
174-
169 │
175-
170 │ If you encounter items that must be disambiguated using rustdoc's disambiguator syntax,
176-
171 │ other than [the "special types" listed below](#special-types), please [file an
177-
172 │ issue][gh-issues]!
178-
173 │
179-
174 │ ## Special types
180-
175 │
181-
176 │ > [!WARNING]
182-
177 │
183-
178 │ There is **no support** on types whose syntax is not a path; they are currently not
184-
179 │ parsed at all:
185-
180 │
186-
181 │ > references `&T`, slices `[T]`, arrays `[T; N]`, tuples `(T1, T2)`, pointers like
187-
182 │ > `*const T`, trait objects like `dyn Any`, and the never type `!`
188-
183 │
189-
184 │ Note that such types can still be used as generic params, just not as standalone types.
190-
185 │
191-
186 │ ## Struct fields
192-
187 │
193-
188 │ > [!WARNING]
194-
189 │
195-
190 │ Linking to struct fields is **not supported** yet. This is **incompatible** with
196-
191 │ rustdoc.
197-
192 │
198-
193 │ ## Markdown link syntax
199-
194 │
200-
195 │ All Markdown link formats supported by rustdoc are supported:
201-
196 │
202-
197 │ Linking with URL inlined:
203-
198 │
204-
199 │ > ```md
205-
200 │ > [The Option type](std::option::Option)
206-
201 │ > ```
207-
202 │ >
208-
203 │ > [The Option type](std::option::Option)
168+
163 │
169+
164 │ Currently, duplicate names in Rust are allowed only if they correspond to items in
170+
165 │ different [namespaces], for example, between macros and modules, and between struct
171+
166 │ fields and methods — this is mostly covered by the function and macro syntax, described
172+
167 │ [above](#functions-and-macros).
173+
168 │
174+
169 │ If you encounter items that must be disambiguated using rustdoc's disambiguator syntax,
175+
170 │ other than [the "special types" listed below](#special-types), please [file an
176+
171 │ issue][gh-issues]!
177+
172 │
178+
173 │ ## Special types
179+
174 │
180+
175 │ > [!WARNING]
181+
176 │
182+
177 │ There is **no support** on types whose syntax is not a path; they are currently not
183+
178 │ parsed at all:
184+
179 │
185+
180 │ > references `&T`, slices `[T]`, arrays `[T; N]`, tuples `(T1, T2)`, pointers like
186+
181 │ > `*const T`, trait objects like `dyn Any`, and the never type `!`
187+
182 │
188+
183 │ Note that such types can still be used as generic params, just not as standalone types.
189+
184 │
190+
185 │ ## Struct fields
191+
186 │
192+
187 │ > [!WARNING]
193+
188 │
194+
189 │ Linking to struct fields is **not supported** yet. This is **incompatible** with
195+
190 │ rustdoc.
196+
191 │
197+
192 │ ## Markdown link syntax
198+
193 │
199+
194 │ All Markdown link formats supported by rustdoc are supported:
200+
195 │
201+
196 │ Linking with URL inlined:
202+
197 │
203+
198 │ > ```md
204+
199 │ > [The Option type](std::option::Option)
205+
200 │ > ```
206+
201 │ >
207+
202 │ > [The Option type](std::option::Option)
209208
· ───────────────────┬──────────────────
210209
· ╰── https://doc.rust-lang.org/stable/core/option/enum.Option.html
211-
204
212-
205 │ Linking with reusable references:
213-
206
214-
207 │ > ```md
215-
208 │ > [The Option type][option-type]
216-
209 │ >
217-
210 │ > [option-type]: std::option::Option
218-
211 │ > ```
219-
212 │ >
220-
213 │ > [The Option type][option-type]
210+
203
211+
204 │ Linking with reusable references:
212+
205
213+
206 │ > ```md
214+
207 │ > [The Option type][option-type]
215+
208 │ >
216+
209 │ > [option-type]: std::option::Option
217+
210 │ > ```
218+
211 │ >
219+
212 │ > [The Option type][option-type]
221220
· ───────────────┬──────────────
222221
· ╰── https://doc.rust-lang.org/stable/core/option/enum.Option.html
223-
214 │ >
224-
215 │ > [option-type]: std::option::Option
225-
216
226-
217 │ Reference-style links `[text][id]` without a corresponding `[id]: name` part will be
227-
218 │ treated the same as inline-style links `[text](id)`:
228-
219
229-
220 │ > ```md
230-
221 │ > [The Option type][std::option::Option]
231-
222 │ > ```
232-
223 │ >
233-
224 │ > [The Option type][std::option::Option]
222+
213 │ >
223+
214 │ > [option-type]: std::option::Option
224+
215
225+
216 │ Reference-style links `[text][id]` without a corresponding `[id]: name` part will be
226+
217 │ treated the same as inline-style links `[text](id)`:
227+
218
228+
219 │ > ```md
229+
220 │ > [The Option type][std::option::Option]
230+
221 │ > ```
231+
222 │ >
232+
223 │ > [The Option type][std::option::Option]
234233
· ───────────────────┬──────────────────
235234
· ╰── https://doc.rust-lang.org/stable/core/option/enum.Option.html
236-
225
237-
226 │ Shortcuts are supported, and can contain inline markups:
238-
227
239-
228 │ > ```md
240-
229 │ > You can create a [`Vec`] with [**`Vec::new`**], or by using the [_`vec!`_][^2] macro.
241-
230 │ > ```
242-
231 │ >
243-
232 │ > You can create a [`Vec`] with [**`Vec::new`**], or by using the [_`vec!`_][^2] macro.
235+
224
236+
225 │ Shortcuts are supported, and can contain inline markups:
237+
226
238+
227 │ > ```md
239+
228 │ > You can create a [`Vec`] with [**`Vec::new`**], or by using the [_`vec!`_][^2] macro.
240+
229 │ > ```
241+
230 │ >
242+
231 │ > You can create a [`Vec`] with [**`Vec::new`**], or by using the [_`vec!`_][^2] macro.
244243
· ───┬─── ────────┬─────── ─────┬────
245244
· │ │ ╰── https://doc.rust-lang.org/stable/alloc/macros/macro.vec.html
246245
· │ ╰── https://doc.rust-lang.org/stable/alloc/vec/struct.Vec.html#method.new
247246
· ╰── https://doc.rust-lang.org/stable/alloc/vec/struct.Vec.html
248-
233
249-
234 │ (The items must still be resolvable; in this case `Vec` and `vec!` come from the
250-
235 │ prelude.)
251-
236
252-
237 │ ## Linking to page sections
253-
238
254-
239 │ To link to a known section on a page, use a URL fragment, just like a normal link. This
255-
240 │ is _compatible_ with rustdoc.
256-
241
257-
242 │ <!-- prettier-ignore-start -->
258-
243
259-
244 │ > ```md
260-
245 │ > [When Should You Use Which Collection?][std::collections#when-should-you-use-which-collection]
261-
246 │ > ```
262-
247 │ >
263-
248 │ > [When Should You Use Which Collection?][std::collections#when-should-you-use-which-collection]
247+
232
248+
233 │ (The items must still be resolvable; in this case `Vec` and `vec!` come from the
249+
234 │ prelude.)
250+
235
251+
236 │ ## Linking to page sections
252+
237
253+
238 │ To link to a known section on a page, use a URL fragment, just like a normal link. This
254+
239 │ is _compatible_ with rustdoc.
255+
240
256+
241 │ <!-- prettier-ignore-start -->
257+
242
258+
243 │ > ```md
259+
244 │ > [When Should You Use Which Collection?][std::collections#when-should-you-use-which-collection]
260+
245 │ > ```
261+
246 │ >
262+
247 │ > [When Should You Use Which Collection?][std::collections#when-should-you-use-which-collection]
264263
· ───────────────────────────────────────────────┬──────────────────────────────────────────────
265264
· ╰── https://doc.rust-lang.org/stable/std/collections/index.html
266-
249
267-
250 │ <!-- prettier-ignore-end -->
268-
251
269-
252 │ ---
270-
253
271-
254 │ [^1]:
272-
255 │ rust-analyzer's ability to generate links for enum variants like `Option::Some` was
273-
256 │ improved only somewhat recently: before
274-
257 │ [#19246](https://github.com/rust-lang/rust-analyzer/pull/19246), links for variants
275-
258 │ and associated items may only point to the types themselves. If linking to such
276-
259 │ items doesn't seem to work for you, be sure to upgrade to a newer rust-analyzer
277-
260 │ first!
278-
261
279-
262 │ [^2]:
280-
263 │ As of rust-analyzer <ra-version>(version)</ra-version>, links generated for macros
281-
264 │ don't always work. Examples include [`std::format!`] (seen above) and
265+
248
266+
249 │ <!-- prettier-ignore-end -->
267+
250
268+
251 │ ---
269+
252
270+
253 │ [^1]:
271+
254 │ rust-analyzer's ability to generate links for enum variants like `Option::Some` was
272+
255 │ improved only somewhat recently: before
273+
256 │ [#19246](https://github.com/rust-lang/rust-analyzer/pull/19246), links for variants
274+
257 │ and associated items may only point to the types themselves. If linking to such
275+
258 │ items doesn't seem to work for you, be sure to upgrade to a newer rust-analyzer
276+
259 │ first!
277+
260
278+
261 │ [^2]:
279+
262 │ As of rust-analyzer <ra-version>(version)</ra-version>, links generated for macros
280+
263 │ don't always work. Examples include [`std::format!`] (seen above) and
282281
· ────────┬───────
283282
· ╰── https://doc.rust-lang.org/stable/alloc/macros/macro.format.html
284-
265 │ [`tokio::main!`]. For more info, see [Known issues](known-issues.md#macros).
283+
264 │ [`tokio::main!`]. For more info, see [Known issues](known-issues.md#macros).
285284
· ────────┬───────
286285
· ╰── https://docs.rs/tokio-macros/2.5.0/tokio_macros/macro.main.html
287-
266
286+
265
288287
╰────

docs/src/rustdoc-link/supported-syntax.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ Types can contain generic parameters. This is _compatible_ with rustdoc.
7474
> ```md
7575
> | Phantom type | variance of `T` |
7676
> | :------------------------------------------------- | :---------------- |
77-
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **inv**ariant |
77+
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **in**variant |
7878
> | [`fn(T)`][std::marker::PhantomData<fn(T)>] | **contra**variant |
7979
> ```
8080
>
8181
> | Phantom type | variance of `T` |
8282
> | :------------------------------------------------- | :---------------- |
83-
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **inv**ariant |
83+
> | [`&'a mut T`][std::marker::PhantomData<&'a mut T>] | **in**variant |
8484
> | [`fn(T)`][std::marker::PhantomData<fn(T)>] | **contra**variant |
8585
8686
This includes if you use turbofish:
@@ -159,8 +159,7 @@ ignored**:
159159
> [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` _module_.
160160
> ```
161161
>
162-
> [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` >
163-
> _module_.
162+
> [`std::vec`], [`mod@std::vec`], and [`macro@std::vec`] all link to the `vec` _module_.
164163
165164
Currently, duplicate names in Rust are allowed only if they correspond to items in
166165
different [namespaces], for example, between macros and modules, and between struct

0 commit comments

Comments
 (0)