Added some animations

This commit is contained in:
Iaphetes 2024-12-21 12:01:08 +01:00
parent 4f7836d296
commit 0c7bc1c2b1
2 changed files with 22 additions and 21 deletions

View file

@ -11,8 +11,8 @@ fn greet(name: &str) -> String {
#[tauri::command] #[tauri::command]
fn parse_markdown(document: &str) -> String { fn parse_markdown(document: &str) -> String {
let mut rendered_markdown: String = String::new(); let mut rendered_markdown: String = String::new();
tauri::Builder::default().setup(move |app| { // tauri::Builder::default().setup(move |app| {
let webview = app.get_webview_window("main").unwrap(); // let webview = app.get_webview_window("main").unwrap();
let arena = Arena::new(); let arena = Arena::new();
// Parse the document into a root `AstNode` // Parse the document into a root `AstNode`
@ -25,16 +25,16 @@ fn parse_markdown(document: &str) -> String {
for node in root.descendants() { for node in root.descendants() {
if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value { if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value {
// image_node.url = format!("file://{}", image_node.url); // image_node.url = format!("file://{}", image_node.url);
println!("{:?}", webview.eval(&image_node.url)); // println!("{:?}", webview.eval(&image_node.url));
} }
} }
let mut html = vec![]; let mut html = vec![];
format_html(root, &options, &mut html).unwrap(); format_html(root, &options, &mut html).unwrap();
println!("{}", String::from_utf8(html.clone()).unwrap()); println!("{}", String::from_utf8(html.clone()).unwrap());
rendered_markdown = String::from_utf8(html).unwrap(); rendered_markdown = String::from_utf8(html).unwrap();
Ok(()) // Ok(())
}); // });
return "".to_owned(); return rendered_markdown.to_owned();
// String::from_str("lololo").unwrap() // String::from_str("lololo").unwrap()
} }

View file

@ -128,5 +128,6 @@ ul li {
#sidebar { #sidebar {
visibility: visible; visibility: visible;
width: var(--sidebar-width); width: var(--sidebar-width);
transition: all 0.1s ease-out;
} }