mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
init text/markdown parser (based on text/gemini)
This commit is contained in:
parent
6fb7e70213
commit
fc6cce8072
23 changed files with 1452 additions and 0 deletions
|
|
@ -154,6 +154,35 @@ impl Content {
|
|||
}
|
||||
}
|
||||
|
||||
/// `text/markdown`
|
||||
pub fn to_text_markdown(&self, base: &Uri, data: &str) -> Text {
|
||||
self.clean();
|
||||
match Text::markdown((&self.window_action, &self.item_action), base, data) {
|
||||
Ok(text) => {
|
||||
self.g_box.append(&text.scrolled_window);
|
||||
text
|
||||
}
|
||||
Err((message, text)) => {
|
||||
self.g_box.append(&{
|
||||
let banner = adw::Banner::builder()
|
||||
.title(message)
|
||||
.revealed(true)
|
||||
.button_label("Ok")
|
||||
.build();
|
||||
banner.connect_button_clicked(|this| this.set_revealed(false));
|
||||
banner
|
||||
});
|
||||
match text {
|
||||
Some(text) => {
|
||||
self.g_box.append(&text.scrolled_window);
|
||||
text
|
||||
}
|
||||
None => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `text/plain`
|
||||
pub fn to_text_plain(&self, data: &str) -> Text {
|
||||
self.clean();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue