@@ -48,17 +48,21 @@ use pulldown_cmark::{
4848mod tests;
4949
5050/// Options for rendering Markdown in the main body of documentation.
51- pub ( crate ) fn opts ( ) -> Options {
51+ pub ( crate ) fn main_body_opts ( ) -> Options {
5252 Options :: ENABLE_TABLES
5353 | Options :: ENABLE_FOOTNOTES
5454 | Options :: ENABLE_STRIKETHROUGH
5555 | Options :: ENABLE_TASKLISTS
5656 | Options :: ENABLE_SMART_PUNCTUATION
5757}
5858
59- /// A subset of [`opts()`] used for rendering summaries .
59+ /// Options for rendering Markdown in summaries (e.g., in search results) .
6060pub ( crate ) fn summary_opts ( ) -> Options {
61- Options :: ENABLE_STRIKETHROUGH | Options :: ENABLE_SMART_PUNCTUATION | Options :: ENABLE_TABLES
61+ Options :: ENABLE_TABLES
62+ | Options :: ENABLE_FOOTNOTES
63+ | Options :: ENABLE_STRIKETHROUGH
64+ | Options :: ENABLE_TASKLISTS
65+ | Options :: ENABLE_SMART_PUNCTUATION
6266}
6367
6468/// When `to_string` is called, this struct will emit the HTML corresponding to
@@ -981,7 +985,7 @@ impl Markdown<'_> {
981985 }
982986 } ;
983987
984- let p = Parser :: new_with_broken_link_callback ( md, opts ( ) , Some ( & mut replacer) ) ;
988+ let p = Parser :: new_with_broken_link_callback ( md, main_body_opts ( ) , Some ( & mut replacer) ) ;
985989 let p = p. into_offset_iter ( ) ;
986990
987991 let mut s = String :: with_capacity ( md. len ( ) * 3 / 2 ) ;
@@ -1000,7 +1004,7 @@ impl MarkdownWithToc<'_> {
10001004 crate fn into_string ( self ) -> String {
10011005 let MarkdownWithToc ( md, mut ids, codes, edition, playground) = self ;
10021006
1003- let p = Parser :: new_ext ( md, opts ( ) ) . into_offset_iter ( ) ;
1007+ let p = Parser :: new_ext ( md, main_body_opts ( ) ) . into_offset_iter ( ) ;
10041008
10051009 let mut s = String :: with_capacity ( md. len ( ) * 3 / 2 ) ;
10061010
@@ -1025,7 +1029,7 @@ impl MarkdownHtml<'_> {
10251029 if md. is_empty ( ) {
10261030 return String :: new ( ) ;
10271031 }
1028- let p = Parser :: new_ext ( md, opts ( ) ) . into_offset_iter ( ) ;
1032+ let p = Parser :: new_ext ( md, main_body_opts ( ) ) . into_offset_iter ( ) ;
10291033
10301034 // Treat inline HTML as plain text.
10311035 let p = p. map ( |event| match event. 0 {
@@ -1099,7 +1103,7 @@ fn markdown_summary_with_limit(
10991103 }
11001104 } ;
11011105
1102- let p = Parser :: new_with_broken_link_callback ( md, opts ( ) , Some ( & mut replacer) ) ;
1106+ let p = Parser :: new_with_broken_link_callback ( md, summary_opts ( ) , Some ( & mut replacer) ) ;
11031107 let mut p = LinkReplacer :: new ( p, link_names) ;
11041108
11051109 let mut buf = HtmlWithLimit :: new ( length_limit) ;
@@ -1246,7 +1250,8 @@ crate fn markdown_links(md: &str) -> Vec<MarkdownLink> {
12461250 } ) ;
12471251 None
12481252 } ;
1249- let p = Parser :: new_with_broken_link_callback ( md, opts ( ) , Some ( & mut push) ) . into_offset_iter ( ) ;
1253+ let p = Parser :: new_with_broken_link_callback ( md, main_body_opts ( ) , Some ( & mut push) )
1254+ . into_offset_iter ( ) ;
12501255
12511256 // There's no need to thread an IdMap through to here because
12521257 // the IDs generated aren't going to be emitted anywhere.
@@ -1285,7 +1290,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_>) -> Vec<RustCodeB
12851290 return code_blocks;
12861291 }
12871292
1288- let mut p = Parser :: new_ext ( md, opts ( ) ) . into_offset_iter ( ) ;
1293+ let mut p = Parser :: new_ext ( md, main_body_opts ( ) ) . into_offset_iter ( ) ;
12891294
12901295 while let Some ( ( event, offset) ) = p. next ( ) {
12911296 if let Event :: Start ( Tag :: CodeBlock ( syntax) ) = event {
0 commit comments