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