Use FEP-c16b: Formatting MFM functions #823
No reviewers
Labels
No labels
approved, awaiting change
bug
cannot reproduce
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
not our bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AkkomaGang/akkoma!823
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ilja/akkoma:use_fep-c16b_formatting_mfm_functions"
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?
See https://akkoma.dev/AkkomaGang/akkoma/issues/381
We can't use the HTML content as-is. FEP-c16b was written to have a "scrubber friendly" way of representing MFM functions in HTML. Here we add support in the backend for the functions Foundkey supports.
This currently uses the parser from https://codeberg.org/ilja/mfm_parser/ but can be changed to the one under the Akkoma namespace once AkkomaGang/mfm-parser#2 is merged.
Caveats:
htmlMfmterm, and use thecontentwhen that term is provided on incoming federation).Broader scope where this PR is part of:
Extra:
I fixed the earmark version to 1.4.46 bc there's apparently a bug in 1.4.47 (which I first pulled in). See my comment #823 (comment)
5fd6771bc6f6422cb370WIP: Use FEP-c16b: Formatting MFM functionsto Use FEP-c16b: Formatting MFM functionsI notice mix.lock also changed a bunch of stuff. I'm not used to changing dependencies, so I'm unsure if that's OK or what I should do with that?
I was even wondering why this is not ignored, since it's rebuild anyhow, but apparently the good practice is to keep it https://elixirforum.com/t/should-mix-lock-be-part-of-the-public-repository-and-package/45203
Use FEP-c16b: Formatting MFM functionsto WIP: Use FEP-c16b: Formatting MFM functionsEDIT: Yes, it worked by downgrading earmark back to 1.4.46. There's an open issue for it https://github.com/pragdave/earmark/issues/361
You can ignore the below text 🤐
I put it in WIP again bc I just realised I forgot to run the test. One is failing bc the MFM markup changed, I already fixed that one locally. But the other one seems a problem with Earmark... Maybe bc I drew in a newer version than what the CI previously had? I'll see if I can figure it out.
Afaict, Earmark removes everything before the comment (
Formatter.markdown_to_html()). Then the comment (I assume correctly) gets removed later withFormatter.html_escape("text/html").This is the failure
Here is the code responsible for this
There was one test who used MFM and now failed due to the new representation. This is now adapted so it doesn't fail any more. There was another test failing, but I don't see how this could have been affected by the MFM changes... But I did draw in newer dependencies, so I thought maybe a newer EARMARK dependency was now failing, and indeed. By explicitly asking for 1.4.46 (according to mix.lock the version it was before), it now works again. This is what was failing. It seems that earmark 1.4.47 removed everything before the comment, which it should not do. 1) test format_input/3 with markdown raw HTML (Pleroma.Web.CommonAPI.UtilsTest) test/pleroma/web/common_api/utils_test.exs:213 Assertion with == failed code: assert result == ~s"<a href=\"http://example.org/\">OwO</a>" left: "" right: "<a href=\"http://example.org/\">OwO</a>" stacktrace: test/pleroma/web/common_api/utils_test.exs:216: (test)WIP: Use FEP-c16b: Formatting MFM functionsto Use FEP-c16b: Formatting MFM functionsyeah that's fine that's just mix updating stuff it's fine
this looks very cool, i'll test it out a bit~
8508d10c65f646e78b48i was running this for 70 bazillion years and forgot to merge
thanks a lot! (frfr)
@floatingghost: the parser PR was merged too, but mix.exs still points to the fork on develop; probably want to change that
contentfor posts, also when it's MFM. #381