markdown
This commit is contained in:
parent
48a4903cb7
commit
78ffa6b738
4 changed files with 28 additions and 6 deletions
16
doordesk/Cargo.lock
generated
16
doordesk/Cargo.lock
generated
|
@ -86,6 +86,7 @@ dependencies = [
|
||||||
"leptos_axum",
|
"leptos_axum",
|
||||||
"leptos_meta",
|
"leptos_meta",
|
||||||
"leptos_router",
|
"leptos_router",
|
||||||
|
"markdown",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -1333,6 +1334,15 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markdown"
|
||||||
|
version = "1.0.0-alpha.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b0f0025e8c0d89b84d6dc63e859475e40e8e82ab1a08be0a93ad5731513a508"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-id",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchit"
|
name = "matchit"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
|
@ -2408,6 +2418,12 @@ version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
|
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-id"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.12"
|
version = "1.0.12"
|
||||||
|
|
|
@ -15,6 +15,7 @@ http.workspace = true
|
||||||
cfg-if.workspace = true
|
cfg-if.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
serde = "1.0.195"
|
serde = "1.0.195"
|
||||||
|
markdown = "1.0.0-alpha.16"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub fn Article(data: ArticleData) -> impl IntoView {
|
||||||
</h1>
|
</h1>
|
||||||
<hr class="opacity-50"/>
|
<hr class="opacity-50"/>
|
||||||
<span class="pt-0 pb-3.5 text-xs opacity-50 m-t">{&data.date}</span>
|
<span class="pt-0 pb-3.5 text-xs opacity-50 m-t">{&data.date}</span>
|
||||||
<div>{&data.content}</div>
|
<div inner_html={&data.content}></div>
|
||||||
</article>
|
</article>
|
||||||
</Transition>
|
</Transition>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use std::thread::sleep;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
pub fn fetch(path: &str) -> String {
|
pub fn fetch(path: &str) -> String {
|
||||||
format!("https://dennis.doordesk.net/{path}")
|
format!("https://dennis.doordesk.net/{path}")
|
||||||
}
|
}
|
||||||
|
@ -18,21 +15,29 @@ pub struct ArticleData {
|
||||||
|
|
||||||
#[server(Slingshot)]
|
#[server(Slingshot)]
|
||||||
pub async fn slingshot() -> Result<Vec<ArticleData>, ServerFnError> {
|
pub async fn slingshot() -> Result<Vec<ArticleData>, ServerFnError> {
|
||||||
|
let md1: String = markdown::to_html("[test](https://lickmysa.cc)");
|
||||||
|
let md2: String = markdown::to_html("[test2](https://lickmysa.cc)");
|
||||||
|
|
||||||
|
|
||||||
let data_vec = vec![
|
let data_vec = vec![
|
||||||
ArticleData {
|
ArticleData {
|
||||||
content_type: String::from("Blog"),
|
content_type: String::from("Blog"),
|
||||||
title: String::from("Test article"),
|
title: String::from("Test article"),
|
||||||
date: String::from("12/21/2022"),
|
date: String::from("12/21/2022"),
|
||||||
content: String::from("Testicles"),
|
content: md1,
|
||||||
},
|
},
|
||||||
ArticleData {
|
ArticleData {
|
||||||
content_type: String::from("Blog"),
|
content_type: String::from("Blog"),
|
||||||
title: String::from("Test article 2"),
|
title: String::from("Test article 2"),
|
||||||
date: String::from("12/22/2022"),
|
date: String::from("12/22/2022"),
|
||||||
content: String::from("Testicless"),
|
content: md2,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Simulate lag
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
sleep(Duration::from_secs(1));
|
sleep(Duration::from_secs(1));
|
||||||
|
|
||||||
Ok(data_vec)
|
Ok(data_vec)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue