]> git.lizzy.rs Git - rust.git/commitdiff
Add strikethrough support to rustdoc
authormibac138 <5672750+mibac138@users.noreply.github.com>
Tue, 5 May 2020 16:43:37 +0000 (18:43 +0200)
committermibac138 <5672750+mibac138@users.noreply.github.com>
Tue, 5 May 2020 23:05:58 +0000 (01:05 +0200)
src/librustdoc/html/markdown.rs

index 4bb50f75791976f7afbb6b7ea0164ead66f9c492..bdda45fdcd4d98ac7d5337e1ad1c3a307d7a1c78 100644 (file)
@@ -44,7 +44,7 @@
 mod tests;
 
 fn opts() -> Options {
-    Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES
+    Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES | Options::ENABLE_STRIKETHROUGH
 }
 
 /// When `to_string` is called, this struct will emit the HTML corresponding to
@@ -933,7 +933,11 @@ pub fn to_string(self) -> String {
             }
         };
 
-        let p = Parser::new_with_broken_link_callback(md, Options::empty(), Some(&replacer));
+        let p = Parser::new_with_broken_link_callback(
+            md,
+            Options::ENABLE_STRIKETHROUGH,
+            Some(&replacer),
+        );
 
         let mut s = String::new();
 
@@ -975,7 +979,11 @@ fn next(&mut self) -> Option<String> {
         }
     }
     let mut s = String::with_capacity(md.len() * 3 / 2);
-    let p = ParserWrapper { inner: Parser::new(md), is_in: 0, is_first: true };
+    let p = ParserWrapper {
+        inner: Parser::new_ext(md, Options::ENABLE_STRIKETHROUGH),
+        is_in: 0,
+        is_first: true,
+    };
     p.filter(|t| !t.is_empty()).for_each(|i| s.push_str(&i));
     s
 }