File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1762,9 +1762,13 @@ fn render_markdown(w: &mut fmt::Formatter,
1762
1762
prefix : & str ,
1763
1763
scx : & SharedContext )
1764
1764
-> fmt:: Result {
1765
- let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1766
1765
// We only emit warnings if the user has opted-in to Pulldown rendering.
1767
1766
let output = if render_type == RenderType :: Pulldown {
1767
+ // Save the state of USED_ID_MAP so it only gets updated once even
1768
+ // though we're rendering twice.
1769
+ let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
1770
+ let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1771
+ USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
1768
1772
let pulldown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Pulldown ) ) ;
1769
1773
let mut differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
1770
1774
differences. retain ( |s| {
@@ -1785,7 +1789,7 @@ fn render_markdown(w: &mut fmt::Formatter,
1785
1789
1786
1790
pulldown_output
1787
1791
} else {
1788
- hoedown_output
1792
+ format ! ( "{}" , Markdown ( md_text , RenderType :: Hoedown ) )
1789
1793
} ;
1790
1794
1791
1795
write ! ( w, "<div class='docblock'>{}{}</div>" , prefix, output)
You can’t perform that action at this time.
0 commit comments