add: parse_image_line, parse_link_line
This commit is contained in:
parent
d8167aa06f
commit
9fe5735127
9 changed files with 234 additions and 25 deletions
|
@ -208,10 +208,20 @@ async fn editor_request(
|
|||
#[derive(Deserialize)]
|
||||
struct RenderMarkdown {
|
||||
content: String,
|
||||
metadata: String,
|
||||
}
|
||||
|
||||
async fn render_request(Json(req): Json<RenderMarkdown>) -> impl IntoResponse {
|
||||
crate::markdown::render_markdown(&req.content)
|
||||
let metadata: EntryMetadata = match toml::from_str(&EntryMetadata::ini_to_toml(&req.metadata)) {
|
||||
Ok(x) => x,
|
||||
Err(e) => return Html(e.to_string()),
|
||||
};
|
||||
|
||||
if let Err(e) = metadata.validate() {
|
||||
return Html(e.to_string());
|
||||
}
|
||||
|
||||
Html(crate::markdown::render_markdown(&req.content) + &metadata.css())
|
||||
}
|
||||
|
||||
async fn exists_request(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue