From e1ea47052d7ff596dd1f662c01be1e157b5d5a78 Mon Sep 17 00:00:00 2001 From: Adrian Osterwind Date: Wed, 13 Nov 2024 15:46:13 +0100 Subject: [PATCH] rewrite in vanilla js --- src-tauri/src/lib.rs | 3 +-- src/index.html | 24 +----------------------- src/main.js | 2 +- src/styles.css | 10 +++++++--- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a43bdbf..67ed735 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -18,7 +18,7 @@ fn parse_markdown(document: &str) -> String { // Parse the document into a root `AstNode` let mut options = Options::default(); - options.render.hardbreaks = true; + // options.render.hardbreaks = true; let root = parse_document(&arena, document, &options); // Iterate over all the descendants of root. @@ -28,7 +28,6 @@ fn parse_markdown(document: &str) -> String { } } let mut html = vec![]; - options.render.hardbreaks = true; format_html(root, &options, &mut html).unwrap(); println!("{:?}", String::from_utf8(html.clone())); String::from_utf8(html).unwrap() diff --git a/src/index.html b/src/index.html index 0594d23..76966fa 100644 --- a/src/index.html +++ b/src/index.html @@ -10,31 +10,9 @@
-

Welcome to Tauri

- - -

Click on the Tauri logo to learn more about the framework

- - -
+
- -
diff --git a/src/main.js b/src/main.js index 749b950..b85aba8 100644 --- a/src/main.js +++ b/src/main.js @@ -16,7 +16,7 @@ window.addEventListener("DOMContentLoaded", () => { invoke("parse_markdown", { document: text }).then( (ret)=>{ var tag_id = document.getElementById('rendered_markdown'); - tag_id.innerHTML = ret; + tag_id.innerHTML = "
".concat("", ret).concat("", "
"); } ); diff --git a/src/styles.css b/src/styles.css index e57b8ac..8e403ec 100644 --- a/src/styles.css +++ b/src/styles.css @@ -22,8 +22,8 @@ padding-top: 10vh; display: flex; flex-direction: column; - justify-content: center; - text-align: center; + justify-content: left; + text-align: left; } .logo { @@ -39,9 +39,13 @@ .row { display: flex; - justify-content: center; + justify-content: left; } +.rendered_markdown { + + text-align: left; +} a { font-weight: 500; color: #646cff;