add: use pulldown-cmark instead

This commit is contained in:
trisua 2025-07-20 15:28:44 -04:00
parent 3f70a8f465
commit fe2e61118a
5 changed files with 68 additions and 56 deletions

View file

@ -36,12 +36,13 @@ pub(crate) type InnerState = (DataManager, Tera, Client, Option<StripeClient>);
pub(crate) type State = Arc<RwLock<InnerState>>;
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
Ok(
tetratto_shared::markdown::render_markdown(&CustomEmoji::replace(value.as_str().unwrap()))
.replace("\\@", "@")
.replace("%5C@", "@")
.into(),
Ok(tetratto_shared::markdown::render_markdown(
&CustomEmoji::replace(value.as_str().unwrap()),
true,
)
.replace("\\@", "@")
.replace("%5C@", "@")
.into())
}
fn render_emojis(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {

View file

@ -267,7 +267,7 @@ pub async fn delete_by_dir_request(
}
pub async fn render_markdown_request(Json(req): Json<RenderMarkdown>) -> impl IntoResponse {
tetratto_shared::markdown::render_markdown(&CustomEmoji::replace(&req.content))
tetratto_shared::markdown::render_markdown(&CustomEmoji::replace(&req.content), true)
.replace("\\@", "@")
.replace("%5C@", "@")
}