File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ impl Markdown {
74
74
if enable_stream {
75
75
self . mode = Mode :: Stream {
76
76
pending : self . content . text ( ) ,
77
- parsed : markdown:: Content :: parse ( "" ) ,
77
+ parsed : markdown:: Content :: new ( ) ,
78
78
} ;
79
79
80
80
scrollable:: snap_to (
Original file line number Diff line number Diff line change @@ -66,13 +66,17 @@ pub use core::text::Highlight;
66
66
pub use pulldown_cmark:: HeadingLevel ;
67
67
pub use url:: Url ;
68
68
69
- #[ derive( Debug ) ]
69
+ #[ derive( Debug , Default ) ]
70
70
pub struct Content {
71
71
items : Vec < Item > ,
72
72
state : State ,
73
73
}
74
74
75
75
impl Content {
76
+ pub fn new ( ) -> Self {
77
+ Self :: default ( )
78
+ }
79
+
76
80
pub fn parse ( markdown : & str ) -> Self {
77
81
let mut state = State :: default ( ) ;
78
82
let items = parse_with ( & mut state, markdown) . collect ( ) ;
@@ -595,16 +599,12 @@ fn parse_with<'a>(
595
599
pulldown_cmark:: Event :: Text ( text) if !metadata && !table => {
596
600
#[ cfg( feature = "highlighter" ) ]
597
601
if let Some ( highlighter) = & mut highlighter {
598
- let start = std:: time:: Instant :: now ( ) ;
599
-
600
602
for line in text. lines ( ) {
601
603
spans. extend_from_slice (
602
604
highlighter. highlight_line ( & format ! ( "{line}\n " ) ) ,
603
605
) ;
604
606
}
605
607
606
- dbg ! ( start. elapsed( ) ) ;
607
-
608
608
return None ;
609
609
}
610
610
You can’t perform that action at this time.
0 commit comments