parse markdown in this lib

This commit is contained in:
Gabriel 2025-07-22 12:53:08 -04:00
parent 16bfecb1f8
commit db2e39cf62

View file

@ -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<markdown::Item>),
Image(String),
Audio(String),
Video(String),
@ -16,8 +18,14 @@ pub enum Content {
}
pub fn parse_content(c: &str) -> Vec<Content>{
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 {