@@ -1826,37 +1826,32 @@ fn render_markdown(w: &mut fmt::Formatter,
18261826 prefix : & str ,
18271827 scx : & SharedContext )
18281828 -> fmt:: Result {
1829- // We only emit warnings if the user has opted-in to Pulldown rendering.
1830- let output = if render_type == RenderType :: Pulldown {
1831- // Save the state of USED_ID_MAP so it only gets updated once even
1832- // though we're rendering twice.
1833- let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
1834- let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1835- USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
1836- let pulldown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Pulldown ) ) ;
1837- let mut differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
1838- differences. retain ( |s| {
1839- match * s {
1840- html_diff:: Difference :: NodeText { ref elem_text,
1841- ref opposite_elem_text,
1842- .. }
1843- if elem_text. split_whitespace ( ) . eq ( opposite_elem_text. split_whitespace ( ) ) => {
1844- false
1845- }
1846- _ => true ,
1829+ // Save the state of USED_ID_MAP so it only gets updated once even
1830+ // though we're rendering twice.
1831+ let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
1832+ let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1833+ USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
1834+ let pulldown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Pulldown ) ) ;
1835+ let mut differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
1836+ differences. retain ( |s| {
1837+ match * s {
1838+ html_diff:: Difference :: NodeText { ref elem_text,
1839+ ref opposite_elem_text,
1840+ .. }
1841+ if elem_text. split_whitespace ( ) . eq ( opposite_elem_text. split_whitespace ( ) ) => {
1842+ false
18471843 }
1848- } ) ;
1849-
1850- if !differences. is_empty ( ) {
1851- scx. markdown_warnings . borrow_mut ( ) . push ( ( span, md_text. to_owned ( ) , differences) ) ;
1844+ _ => true ,
18521845 }
1846+ } ) ;
18531847
1854- pulldown_output
1855- } else {
1856- format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) )
1857- } ;
1848+ if !differences. is_empty ( ) {
1849+ scx. markdown_warnings . borrow_mut ( ) . push ( ( span, md_text. to_owned ( ) , differences) ) ;
1850+ }
18581851
1859- write ! ( w, "<div class='docblock'>{}{}</div>" , prefix, output)
1852+ write ! ( w, "<div class='docblock'>{}{}</div>" ,
1853+ prefix,
1854+ if render_type == RenderType :: Pulldown { pulldown_output } else { hoedown_output } )
18601855}
18611856
18621857fn document_short ( w : & mut fmt:: Formatter , item : & clean:: Item , link : AssocItemLink ,
0 commit comments