Supporting lists attempt, starting to think I have redundant methods..

This commit is contained in:
Gabriel 2025-07-19 14:46:45 -04:00
parent 937079e6dc
commit 8c16e36582

View file

@ -46,15 +46,11 @@ fn markdown_content(item: &Item) -> Content {
Item::Title(n,children) => {
markdown = markdown + &"#".repeat(*n) + " " +&process_children(children);
},
Item::BoldedText(b) => {
let _ = b.iter().map(|i|{
markdown = "**".to_owned() + &markdown + "**";
});
Item::BoldedText(children) => {
markdown = format!("**{}**",process_children(children));
},
Item::EmphasisText(e) => {
let _ = e.iter().map(|i|{
markdown = "*".to_owned() + &markdown + "*";
});
Item::EmphasisText(children) => {
markdown = format!("*{}*",process_children(children));
}
Item::Text(s) => {
markdown = markdown + s;
@ -65,15 +61,14 @@ fn markdown_content(item: &Item) -> Content {
Item::Paragraph(children) => {
markdown = markdown + &process_children(children);
}
Item::UnorderedList(u) => {
let _ = u.iter().map(|i|{
markdown = "".to_owned() + &markdown ;
});
Item::UnorderedList(children) => {
markdown = markdown + &process_children(children);
}
Item::OrderedList(o) => {
let _ = o.iter().map(|i|{
markdown = "".to_owned() + &markdown;
});
Item::OrderedList(children) => {
markdown = markdown + &process_children(children);
}
Item::ListItem(children) => {
markdown = "\n- ".to_owned() + &process_children(children);
}
_ => {}
}
@ -105,6 +100,9 @@ fn process_content(items: Vec<Item>) -> Vec<Content> {
Item::OrderedList(children) => {
result.push(markdown_content(i));
}
Item::ListItem(children) => {
result.push(markdown_content(i));
}
Item::Image(src) => {
result.push(Content::Image(src.to_owned()));
}