Add markdown rendering for recipe descriptions using comrak
This commit is contained in:
parent
9b89117a66
commit
0c2e4b7624
3 changed files with 12 additions and 1 deletions
|
|
@ -18,6 +18,16 @@ impl Recipes {
|
|||
}
|
||||
}
|
||||
|
||||
mod filters {
|
||||
use askama::filters::Safe;
|
||||
pub fn markdown<T: std::fmt::Display>(s: T) -> askama::Result<Safe<String>> {
|
||||
Ok(Safe(comrak::markdown_to_html(
|
||||
&s.to_string(),
|
||||
&comrak::ComrakOptions::default(),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "home.html")]
|
||||
pub struct HomeTemplate {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue