about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-09-15 16:18:05 -0700
committerCamelid <camelidcamel@gmail.com>2021-02-07 19:57:53 -0800
commita0f9d4beec3a89eec88289701c152a69d488487b (patch)
tree8e1e0bb9048394b8f435b4fd9b004c50c2c4b765
parentbb587b1a1737738658d2eaecd4c8c1cab555257a (diff)
downloadrust-a0f9d4beec3a89eec88289701c152a69d488487b.tar.gz
rust-a0f9d4beec3a89eec88289701c152a69d488487b.zip
Enable smart punctuation
-rw-r--r--src/librustdoc/html/markdown.rs3
-rw-r--r--src/test/rustdoc/inline_cross/add-docs.rs2
-rw-r--r--src/test/rustdoc/smart-punct.rs13
3 files changed, 16 insertions, 2 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index a81fd55f6f1..34bda2b7883 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -52,11 +52,12 @@ pub(crate) fn opts() -> Options {
         | Options::ENABLE_FOOTNOTES
         | Options::ENABLE_STRIKETHROUGH
         | Options::ENABLE_TASKLISTS
+        | Options::ENABLE_SMART_PUNCTUATION
 }
 
 /// A subset of [`opts()`] used for rendering summaries.
 pub(crate) fn summary_opts() -> Options {
-    Options::ENABLE_STRIKETHROUGH
+    Options::ENABLE_STRIKETHROUGH | Options::ENABLE_SMART_PUNCTUATION
 }
 
 /// When `to_string` is called, this struct will emit the HTML corresponding to
diff --git a/src/test/rustdoc/inline_cross/add-docs.rs b/src/test/rustdoc/inline_cross/add-docs.rs
index 1af5e8f03b4..8f0c4e5e641 100644
--- a/src/test/rustdoc/inline_cross/add-docs.rs
+++ b/src/test/rustdoc/inline_cross/add-docs.rs
@@ -4,6 +4,6 @@ extern crate inner;
 
 
 // @has add_docs/struct.MyStruct.html
-// @has add_docs/struct.MyStruct.html "Doc comment from 'pub use', Doc comment from definition"
+// @has add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition"
 /// Doc comment from 'pub use',
 pub use inner::MyStruct;
diff --git a/src/test/rustdoc/smart-punct.rs b/src/test/rustdoc/smart-punct.rs
new file mode 100644
index 00000000000..5c4530c97a9
--- /dev/null
+++ b/src/test/rustdoc/smart-punct.rs
@@ -0,0 +1,13 @@
+#![crate_name = "foo"]
+
+//! This is the "start" of the 'document'! How'd you know that "it's" the start?
+//!
+//! # Header with "smart punct'"
+//!
+//! [link with "smart punct'" -- yessiree!][]
+//!
+//! [link with "smart punct'" -- yessiree!]: https://www.rust-lang.org
+
+// @has "foo/index.html" "//p" "This is the “start” of the ‘document’! How’d you know that “it’s” the start?"
+// @has "foo/index.html" "//h1" "Header with “smart punct’”"
+// @has "foo/index.html" '//a[@href="https://www.rust-lang.org"]' "link with “smart punct’” – yessiree!"