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,30 +11,30 @@ 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`
let mut options = Options::default(); let mut options = Options::default();
options.render.unsafe_ = true; options.render.unsafe_ = true;
// options.render.hardbreaks = true; // options.render.hardbreaks = true;
let root = parse_document(&arena, document, &options); let root = parse_document(&arena, document, &options);
// Iterate over all the descendants of root. // Iterate over all the descendants of root.
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![]; }
format_html(root, &options, &mut html).unwrap(); let mut html = vec![];
println!("{}", String::from_utf8(html.clone()).unwrap()); format_html(root, &options, &mut html).unwrap();
rendered_markdown = String::from_utf8(html).unwrap(); println!("{}", String::from_utf8(html.clone()).unwrap());
Ok(()) rendered_markdown = String::from_utf8(html).unwrap();
}); // 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;
} }