Added some animations
This commit is contained in:
parent
4f7836d296
commit
0c7bc1c2b1
2 changed files with 22 additions and 21 deletions
|
|
@ -11,30 +11,30 @@ fn greet(name: &str) -> String {
|
|||
#[tauri::command]
|
||||
fn parse_markdown(document: &str) -> String {
|
||||
let mut rendered_markdown: String = String::new();
|
||||
tauri::Builder::default().setup(move |app| {
|
||||
let webview = app.get_webview_window("main").unwrap();
|
||||
let arena = Arena::new();
|
||||
// tauri::Builder::default().setup(move |app| {
|
||||
// let webview = app.get_webview_window("main").unwrap();
|
||||
let arena = Arena::new();
|
||||
|
||||
// Parse the document into a root `AstNode`
|
||||
let mut options = Options::default();
|
||||
options.render.unsafe_ = true;
|
||||
// options.render.hardbreaks = true;
|
||||
let root = parse_document(&arena, document, &options);
|
||||
// Parse the document into a root `AstNode`
|
||||
let mut options = Options::default();
|
||||
options.render.unsafe_ = true;
|
||||
// options.render.hardbreaks = true;
|
||||
let root = parse_document(&arena, document, &options);
|
||||
|
||||
// Iterate over all the descendants of root.
|
||||
for node in root.descendants() {
|
||||
if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value {
|
||||
// image_node.url = format!("file://{}", image_node.url);
|
||||
println!("{:?}", webview.eval(&image_node.url));
|
||||
}
|
||||
// Iterate over all the descendants of root.
|
||||
for node in root.descendants() {
|
||||
if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value {
|
||||
// image_node.url = format!("file://{}", image_node.url);
|
||||
// println!("{:?}", webview.eval(&image_node.url));
|
||||
}
|
||||
let mut html = vec![];
|
||||
format_html(root, &options, &mut html).unwrap();
|
||||
println!("{}", String::from_utf8(html.clone()).unwrap());
|
||||
rendered_markdown = String::from_utf8(html).unwrap();
|
||||
Ok(())
|
||||
});
|
||||
return "".to_owned();
|
||||
}
|
||||
let mut html = vec![];
|
||||
format_html(root, &options, &mut html).unwrap();
|
||||
println!("{}", String::from_utf8(html.clone()).unwrap());
|
||||
rendered_markdown = String::from_utf8(html).unwrap();
|
||||
// Ok(())
|
||||
// });
|
||||
return rendered_markdown.to_owned();
|
||||
// String::from_str("lololo").unwrap()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue