Skip to content

Commit

Permalink
Rollup merge of rust-lang#40466 - projektir:outdated_docs_highlightin…
Browse files Browse the repository at this point in the history
…g, r=steveklabnik

Remove doc about highlighting code in other languages rust-lang#40301

This doesn't appear to be true any longer, so removing it to avoid confusion. See rust-lang#40301

Thoughts:
- may be a good idea to remove "Let's discuss the details of these code blocks.", as there's not much being discussed at this point;
- does `text` still work?

r? @steveklabnik
  • Loading branch information
frewsxcv authored Mar 14, 2017
2 parents 70511e7 + eb203d5 commit 7cf0a09
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/doc/book/src/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -183,23 +181,8 @@ 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.
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

Expand Down

0 comments on commit 7cf0a09

Please sign in to comment.