diff options
| author | Lucas Morales <lucas@lucasem.com> | 2018-07-04 08:56:31 -0400 |
|---|---|---|
| committer | Lucas Morales <lucas@lucasem.com> | 2018-07-04 12:41:45 -0400 |
| commit | ff2ff2b2b88f5948e1326809e70fbdf4db167097 (patch) | |
| tree | f976edf2e32aef4426a633eafee5872b9620113f /src/doc/rustdoc | |
| parent | d3b4cb1730cb18bd42e3f985bdc155a3c5565e1c (diff) | |
| download | rust-ff2ff2b2b88f5948e1326809e70fbdf4db167097.tar.gz rust-ff2ff2b2b88f5948e1326809e70fbdf4db167097.zip | |
rustdoc book on codeblock hash escaping
Diffstat (limited to 'src/doc/rustdoc')
| -rw-r--r-- | src/doc/rustdoc/src/documentation-tests.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index 7639537fc55..e4af122d0cb 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -170,6 +170,23 @@ By repeating all parts of the example, you can ensure that your example still compiles, while only showing the parts that are relevant to that part of your explanation. +The `#`-hiding of lines can be prevented by using two consecutive hashes +`##`. This only needs to be done with with the first `#` which would've +otherwise caused hiding. If we have a string literal like the following, +which has a line that starts with a `#`: + +```rust +let s = "foo +## bar # baz"; +``` + +We can document it by escaping the initial `#`: + +```text +/// let s = "foo +/// ## bar # baz"; +``` + ## Using `?` in doc tests |
