diff --git a/src/lib.rs b/src/lib.rs index 2e5ee8f..46ff9da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ use scraper::{ElementRef, Html, Node}; +use iced::widget::markdown; /* The goal here is to flatten the DOM as much as possible. @@ -9,6 +10,7 @@ use scraper::{ElementRef, Html, Node}; #[derive(Debug,Clone)] pub enum Content { Markdown(String), + MarkdownParsed(Vec), Image(String), Audio(String), Video(String), @@ -16,8 +18,14 @@ pub enum Content { } pub fn parse_content(c: &str) -> Vec{ - - process_content(itemize_content(c)) + process_content(itemize_content(c)).into_iter().map(|i| { + match i { + Content::Markdown(s) => { + Content::MarkdownParsed(markdown::parse(&s).collect()) + } + _ => {i} + } + }).collect() } fn markdownify_child(item: &Item) -> String {