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 @@ -1752,9 +1752,13 @@ fn render_markdown(w: &mut fmt::Formatter,
1752
1752
prefix : & str ,
1753
1753
scx : & SharedContext )
1754
1754
-> fmt:: Result {
1755
- let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1756
1755
// We only emit warnings if the user has opted-in to Pulldown rendering.
1757
1756
let output = if render_type == RenderType :: Pulldown {
1757
+ // Save the state of USED_ID_MAP so it only gets updated once even
1758
+ // though we're rendering twice.
1759
+ let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
1760
+ let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
1761
+ USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
1758
1762
let pulldown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Pulldown ) ) ;
1759
1763
let differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
1760
1764
let differences = differences. into_iter ( )
@@ -1775,7 +1779,7 @@ fn render_markdown(w: &mut fmt::Formatter,
1775
1779
1776
1780
pulldown_output
1777
1781
} else {
1778
- hoedown_output
1782
+ format ! ( "{}" , Markdown ( md_text , RenderType :: Hoedown ) )
1779
1783
} ;
1780
1784
1781
1785
write ! ( w, "<div class='docblock'>{}{}</div>" , prefix, output)
You can’t perform that action at this time.
0 commit comments