File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,22 @@ impl Term {
314314 }
315315 writeln ! ( buffer, r#" </div>"# ) . unwrap ( ) ;
316316 }
317+
318+ /// Returns the various parts needed to create an HTML page.
319+ pub fn render_html_fragments ( & self , ansi : & str ) -> HtmlFragments {
320+ let mut styled = adapter:: AnsiBytes :: new ( ) ;
321+ let mut elements = styled. extract_next ( ansi. as_bytes ( ) ) . collect :: < Vec < _ > > ( ) ;
322+ preprocess_invert_style ( & mut elements, self . bg_color , self . fg_color ) ;
323+
324+ let styled_lines = split_lines ( & elements) ;
325+
326+ let mut style = String :: new ( ) ;
327+ let mut body = String :: new ( ) ;
328+
329+ self . render_classes ( & mut style, & elements) ;
330+ self . render_content ( & mut body, styled_lines) ;
331+ HtmlFragments { style, body }
332+ }
317333}
318334
319335/// Contains the different parts of a HTML rendered page.
You can’t perform that action at this time.
0 commit comments