[rfc] pre-parse mfm_content as plaintext #58
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#58
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
this is a problem I encountered while writing marked-mfm:
the
mfm_content
attribute is completely plaintext as opposed toraw_html
. this is fine for things like markdown or HTML, since Marked is going to parse them on the frontend, with two exceptions: mentions and hashtags.I could parse them on the frontend through Marked, but I think that's not a good idea for a few reasons:
HashtagLink
andMentionsLine
given the proper attributeswhat if instead of being completely plaintext,
mfm_content
came with the mentions and hashtags already linked? then all we'd have to do is parse it usingmarked-mfm
, shove it in a RichContent (in the case of pleroma-fe) and it's done.my rationale for this is that, while mfm rendering is done entirely by the client, even
plaintext
posts have mentions and hashtagsALSO!!! this would be very useful for people who don't wanna see mfm formatting
if we show them
mfm_content
regardless, but just don't parse it, they're gonna see the$[tada plain mfm]
instead of italic textkilling two birds with one stone
psuedocode (i don't know elixir hhh):
and on the frontend:
basically, completely ignoring what HTML Misskey chose to send us (it probably wasn't anything good anyway)
yeah, we probably should be able to pre-link it
but i'm not a fan of the per-content-type flag, it feels prone to being extended in the future and we won't want
is_someothertype
checksmy proposal would be to pre-link in the same way as plaintext, but then have the frontend rely on a
status.content_type
fieldthat's a better solution, yes
currently the frontend relies on
status.mfm_content
existing to figure out if it's mfm or not but that would work with this solution so i added a flagbut using Content-Types is better
ok, i've got an example format for you
returned as the status json
that feeling better to you?
yes
one other thing i noticed is how the backend rewrites
\n
to<br>
on all types other than mfmso currently i replace it in the frontend but if it can be replaced here that would be better i think, for consistency
yea luckily a side-effect of using the linker is that it does that - so it'll be
<br>
post change(obv ignore the unlinked @ i have a buggo)
reckon we can probably close this one off now