Skip to content

Commit db1e221

Browse files
Restructured docs on short-codes to be more clear
1 parent e5fbaba commit db1e221

File tree

1 file changed

+8
-13
lines changed
  • content/learn/book/contributing/docs

1 file changed

+8
-13
lines changed

content/learn/book/contributing/docs/_index.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,18 @@ A local server should start and you should be able to access a local version of
3030

3131
### Rust API Doc Syntax
3232

33-
We made an extension to the markdown syntax that makes linking to Rust API docs nicer. It also gives the links special formatting. Here are some examples:
33+
We made an extension to the markdown syntax that makes linking to Rust API docs nicer. It also gives the links special formatting.
3434

35-
* Full Type Path: {{rust_type(type="struct" crate="std", mod="collections", name="HashMap", show_mod=true)}}
35+
You can link to both Rust types and Rust modules with these shortcodes as shown below:
3636

37-
```{{curly_open()}}{rust_type(type="struct" crate="std" mod="collections" name="HashMap")}{{curly_close()}}```
38-
* Short Type: {{rust_type(type="struct", crate="std" mod="collections", name="HashMap")}}
37+
- {{rust_type(type="struct" crate="std" mod="collections" name="HashMap" show_mod=true)}} is produced with the shortcode ???.
38+
- {{rust_mod(crate="std" mod="collections")}} is produced with the short-code ??
3939

40-
```{{curly_open()}}{rust_type(type="struct" crate="std" mod="collections" name="HashMap")}{{curly_close()}}```
41-
* Plural Type: {{rust_type(type="struct" crate="std" mod="collections" name="HashMap" plural=true)}}
40+
There are several options available, toggled by adding the following arguments (separating each argument with a space) within the curly braces:
4241

43-
```{{curly_open()}}{rust_type(type="struct" crate="std" mod="collections" name="HashMap", plural=true)}{{curly_close()}}```
44-
* Function: {{rust_type(type="struct" crate="std" mod="collections" name="HashMap" method="insert")}}
45-
46-
```{{curly_open()}}{rust_type(type="struct" crate="std" mod="collections" name="HashMap" method="insert")}{{curly_close()}}```
47-
* Module: {{rust_mod(crate="std" mod="collections")}}
48-
49-
```{{curly_open()}}{rust_mod(crate="std" mod="collections")}{{curly_close()}}```
42+
- `show_crate`: shows the originating crate in the path
43+
- `show_mod`: shows the originating module in the path
44+
- `plural`: adds an "s" at the end of the linked type
5045

5146
Modules from {{rust_mod(crate="std")}} will link to [https://doc.rust-lang.org](https://doc.rust-lang.org/std/index.html). Other modules (like {{rust_mod(crate="bevy_render" mod="render_graph")}} ) will link to [https://docs.rs](https://docs.rs).
5247

0 commit comments

Comments
 (0)