From 064477391c086d4ea26d880bc0f5e1a5c4cb1383 Mon Sep 17 00:00:00 2001 From: projektir Date: Mon, 13 Mar 2017 00:14:42 -0400 Subject: [PATCH 1/2] Remove doc about highlighting code in other languages #40301 --- src/doc/book/src/documentation.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/doc/book/src/documentation.md b/src/doc/book/src/documentation.md index 69d49e2f96aa8..551c393be775e 100644 --- a/src/doc/book/src/documentation.md +++ b/src/doc/book/src/documentation.md @@ -183,24 +183,6 @@ To write some Rust code in a comment, use the triple graves: # fn foo() {} ``` -If you want something that's not Rust code, you can add an annotation: - -```rust -/// ```c -/// printf("Hello, world\n"); -/// ``` -# fn foo() {} -``` - -This will highlight according to whatever language you're showing off. -If you're only showing plain text, choose `text`. - -It's important to choose the correct annotation here, because `rustdoc` uses it -in an interesting way: It can be used to actually test your examples in a -library crate, so that they don't get out of date. If you have some C code but -`rustdoc` thinks it's Rust because you left off the annotation, `rustdoc` will -complain when trying to generate the documentation. - ## Documentation as tests Let's discuss our sample example documentation: From eb203d597f6bed9bb6a7103649a36f19a087a2ab Mon Sep 17 00:00:00 2001 From: projektir Date: Mon, 13 Mar 2017 18:37:21 -0400 Subject: [PATCH 2/2] Adjust wording #40301 --- src/doc/book/src/documentation.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/doc/book/src/documentation.md b/src/doc/book/src/documentation.md index 551c393be775e..176a7e508c0ac 100644 --- a/src/doc/book/src/documentation.md +++ b/src/doc/book/src/documentation.md @@ -170,8 +170,6 @@ more than one section: # fn foo() {} ``` -Let's discuss the details of these code blocks. - #### Code block annotations To write some Rust code in a comment, use the triple graves: @@ -183,6 +181,9 @@ To write some Rust code in a comment, use the triple graves: # fn foo() {} ``` +This will add code highlighting. If you are only showing plain text, put `text` +instead of `rust` after the triple graves (see below). + ## Documentation as tests Let's discuss our sample example documentation: