about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-06 00:36:34 +0000
committerbors <bors@rust-lang.org>2018-07-06 00:36:34 +0000
commita8403e1cda2e0cba4f2c7282ab5adb5392bef473 (patch)
tree6e50a040eb0509b7cd78e05b708974d4a19c7e52 /src/test/rustdoc
parent00f49728e03d7bcf419e0d94fa45f3f4285ff7e3 (diff)
parent6a86ee73285c6a522dce0da5fee3ed4681501b21 (diff)
downloadrust-a8403e1cda2e0cba4f2c7282ab5adb5392bef473.tar.gz
rust-a8403e1cda2e0cba4f2c7282ab5adb5392bef473.zip
Auto merge of #51861 - GuillaumeGomez:prevent-some-markdown-short-doc, r=QuietMisdreavus
Prevent some markdown transformation on short docblocks

Before:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 01" src="https://user-images.githubusercontent.com/3050060/42005762-7d533bbe-7a76-11e8-8361-027886803399.png">

After:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 02" src="https://user-images.githubusercontent.com/3050060/42005768-81bd59a0-7a76-11e8-819b-9b4be72579d6.png">

This is only performed on short doc blocks, not on plain ones. Not all transformations are prevented (you still have a few like urls, code blocks, etc...).

cc @nical

r? @QuietMisdreavus
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/short-dockblock.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/rustdoc/short-dockblock.rs b/src/test/rustdoc/short-dockblock.rs
new file mode 100644
index 00000000000..cb36110b291
--- /dev/null
+++ b/src/test/rustdoc/short-dockblock.rs
@@ -0,0 +1,35 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_name = "foo"]
+
+// @has foo/index.html '//*[@class="docblock-short"]/p' 'fooo'
+// @!has foo/index.html '//*[@class="docblock-short"]/p/h1' 'fooo'
+// @has foo/fn.foo.html '//h1[@id="fooo"]/a[@href="#fooo"]' 'fooo'
+
+/// # fooo
+///
+/// foo
+pub fn foo() {}
+
+// @has foo/index.html '//*[@class="docblock-short"]/p' 'mooood'
+// @!has foo/index.html '//*[@class="docblock-short"]/p/h2' 'mooood'
+// @has foo/foo/index.html '//h2[@id="mooood"]/a[@href="#mooood"]' 'mooood'
+
+/// ## mooood
+///
+/// foo mod
+pub mod foo {}
+
+// @has foo/index.html '//*[@class="docblock-short"]/p/a[@href=\
+//                      "https://nougat.world"]/code' 'nougat'
+
+/// [`nougat`](https://nougat.world)
+pub struct Bar;