feat: parse markdown when posting
can't be toggled off for now 🤷
This commit is contained in:
parent
505bdfa234
commit
34df958af0
3 changed files with 8 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4412,6 +4412,7 @@ dependencies = [
|
|||
"futures",
|
||||
"jrd",
|
||||
"mastodon-async-entities",
|
||||
"mdhtml",
|
||||
"nodeinfo",
|
||||
"openssl",
|
||||
"rand",
|
||||
|
|
|
@ -24,6 +24,7 @@ chrono = { version = "0.4", features = ["serde"] }
|
|||
uuid = { version = "1.8", features = ["v4"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
mdhtml = { path = "mdhtml", features = ["markdown"] }
|
||||
jrd = "0.1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
|
|
|
@ -23,6 +23,9 @@ impl apb::server::Outbox for Context {
|
|||
.set_attributed_to(Node::link(uid.clone()))
|
||||
.set_published(Some(chrono::Utc::now()))
|
||||
)?;
|
||||
if let Some(content) = object_model.content {
|
||||
object_model.content = Some(mdhtml::safe_markdown(&content));
|
||||
}
|
||||
match (&object_model.in_reply_to, &object_model.context) {
|
||||
(Some(reply_id), None) => // get context from replied object
|
||||
object_model.context = self.fetch_object(reply_id).await?.context,
|
||||
|
@ -84,6 +87,9 @@ impl apb::server::Outbox for Context {
|
|||
object_model.bto = activity_model.bto.clone();
|
||||
object_model.cc = activity_model.cc.clone();
|
||||
object_model.bcc = activity_model.bcc.clone();
|
||||
if let Some(content) = object_model.content {
|
||||
object_model.content = Some(mdhtml::safe_markdown(&content));
|
||||
}
|
||||
match (&object_model.in_reply_to, &object_model.context) {
|
||||
(Some(reply_id), None) => // get context from replied object
|
||||
object_model.context = self.fetch_object(reply_id).await?.context,
|
||||
|
|
Loading…
Reference in a new issue