rewrite in vanilla js
This commit is contained in:
parent
590aec5260
commit
e1ea47052d
4 changed files with 10 additions and 29 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -10,31 +10,9 @@
|
|||
|
||||
<body>
|
||||
<main class="container">
|
||||
<h1>Welcome to Tauri</h1>
|
||||
|
||||
<div class="row">
|
||||
<a href="https://tauri.app" target="_blank">
|
||||
<img src="/assets/tauri.svg" class="logo tauri" alt="Tauri logo" />
|
||||
</a>
|
||||
<a
|
||||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript"
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
src="/assets/javascript.svg"
|
||||
class="logo vanilla"
|
||||
alt="JavaScript logo"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<p>Click on the Tauri logo to learn more about the framework</p>
|
||||
|
||||
<textarea id="markdown_input"></textarea>
|
||||
|
||||
<div class="row" id="rendered_markdown">
|
||||
<div class="rendered_markdown" id="rendered_markdown">
|
||||
</div>
|
||||
|
||||
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -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 = "<pre>".concat("", ret).concat("", "</pre>");
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue