about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-04 20:21:01 +0000
committerbors <bors@rust-lang.org>2018-07-04 20:21:01 +0000
commitafaa40646542ca1e8fadb7e1d34197237e0fcd19 (patch)
tree54ba3fcffed75bbca891eb65a004d1d843208568 /src/liballoc_system
parent4af9132a022ebe4111395139d1a4e45e285d299a (diff)
parentff2ff2b2b88f5948e1326809e70fbdf4db167097 (diff)
downloadrust-afaa40646542ca1e8fadb7e1d34197237e0fcd19.tar.gz
rust-afaa40646542ca1e8fadb7e1d34197237e0fcd19.zip
Auto merge of #51803 - lucasem:rustdoc-code-hash-escape, r=GuillaumeGomez
rustdoc codeblock hash escape

So that docstring text such as the following (in a code block) can be created ergonomically:

```rust
let s = "
    foo
    # bar
    baz
";
```

Such code in a docstring hide the <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> line.

Previously, using two consecutive hashes <code>&nbsp;&nbsp;&nbsp;&nbsp;## bar</code> would turn the line into _shown_ `# bar`, losing the leading whitespace. A line of code like <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> (such as in the example above) **could not be represented** in the docstring text.

This commit makes the two consecutive hashes not also trim the leading whitespace — the two hashes simply **escape** into a single hash and do not hide the line, leaving the rest of that line unaffected. The new docstring text to achieve the above code block is:

```rust
/// ```
/// let s = "
///     foo
///     ## bar
///     baz
/// ";
/// ```
```
Diffstat (limited to 'src/liballoc_system')
0 files changed, 0 insertions, 0 deletions