File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -591,7 +591,15 @@ impl<'a> fmt::Display for Markdown<'a> {
591
591
opts. insert ( OPTION_ENABLE_TABLES ) ;
592
592
opts. insert ( OPTION_ENABLE_FOOTNOTES ) ;
593
593
594
- let p = Parser :: new_ext ( md, opts) ;
594
+ let replacer = |_: & str , s : & str | {
595
+ if let Some ( & ( _, ref replace) ) = links. into_iter ( ) . find ( |link| & * link. 0 == s) {
596
+ Some ( ( replace. clone ( ) , s. to_owned ( ) ) )
597
+ } else {
598
+ None
599
+ }
600
+ } ;
601
+
602
+ let p = Parser :: new_with_broken_link_callback ( md, opts, Some ( & replacer) ) ;
595
603
596
604
let mut s = String :: with_capacity ( md. len ( ) * 3 / 2 ) ;
597
605
@@ -662,7 +670,16 @@ impl<'a> fmt::Display for MarkdownSummaryLine<'a> {
662
670
// This is actually common enough to special-case
663
671
if md. is_empty ( ) { return Ok ( ( ) ) }
664
672
665
- let p = Parser :: new ( md) ;
673
+ let replacer = |_: & str , s : & str | {
674
+ if let Some ( & ( _, ref replace) ) = links. into_iter ( ) . find ( |link| & * link. 0 == s) {
675
+ Some ( ( replace. clone ( ) , s. to_owned ( ) ) )
676
+ } else {
677
+ None
678
+ }
679
+ } ;
680
+
681
+ let p = Parser :: new_with_broken_link_callback ( md, Options :: empty ( ) ,
682
+ Some ( & replacer) ) ;
666
683
667
684
let mut s = String :: new ( ) ;
668
685
You can’t perform that action at this time.
0 commit comments