pub fn parse_markdown(
name: Option<&str>,
content: &str,
width: u16,
) -> ComponentRootExamples found in repository?
examples/demo.rs (line 77)
74 fn draw(&mut self, frame: &mut Frame) {
75 self.area = frame.area();
76
77 self.markdown = Some(parser::parse_markdown(None, CONTENT, self.area.width));
78
79 if let Some(markdown) = &mut self.markdown {
80 markdown.set_scroll(self.scroll);
81
82 let area = Rect {
83 width: self.area.width - 1,
84 height: self.area.height - 1,
85 x: 1,
86 ..self.area
87 };
88
89 for child in markdown.children() {
90 if let Component::TextComponent(comp) = child {
91 if comp.y_offset().saturating_sub(comp.scroll_offset()) >= area.height
92 || (comp.y_offset() + comp.height()).saturating_sub(comp.scroll_offset())
93 == 0
94 {
95 continue;
96 }
97
98 frame.render_widget(comp.clone(), area);
99 }
100 }
101 }
102 }