File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 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,
17521752 prefix : & str ,
17531753 scx : & SharedContext )
17541754 -> fmt:: Result {
1755- let hoedown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Hoedown ) ) ;
17561755 // We only emit warnings if the user has opted-in to Pulldown rendering.
17571756 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) ;
17581762 let pulldown_output = format ! ( "{}" , Markdown ( md_text, RenderType :: Pulldown ) ) ;
17591763 let differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
17601764 let differences = differences. into_iter ( )
@@ -1775,7 +1779,7 @@ fn render_markdown(w: &mut fmt::Formatter,
17751779
17761780 pulldown_output
17771781 } else {
1778- hoedown_output
1782+ format ! ( "{}" , Markdown ( md_text , RenderType :: Hoedown ) )
17791783 } ;
17801784
17811785 write ! ( w, "<div class='docblock'>{}{}</div>" , prefix, output)
You can’t perform that action at this time.
0 commit comments