Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for viewing MFM (Misskey Flavored Markdown) #2441

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

hazycora
Copy link

Not sure if there's interest for this but it's something I've wanted for a while for myself, and thought I'd at least submit a draft PR in case there is any interest. Since MFM conflicts with Markdown a bit, the MFM implementation includes a limited Markdown implementation as well (😭).

A post containing MFM artwork showing a blue sky and a massive sun with a baby angel flying in the sky, all drawn with emoji

This feature is not complete- While MFM tags such as $[x2 Hi!] work, along with some inline markdown formatting such as emphasis and strong emphasis, some other things like blockquotes aren't implemented yet. There's also some test cases for the markdown parsing that fail still. Another very important blocker is that it's currently not possible for users to disable viewing MFM, and it autoplays all animations, both of which of course need to be fixed for this to be able to be merged.

It would probably also be a good idea to allow users of glitch-soc to send their own MFM, but this would require adding a column to the Status table so we store both the MFM source code for instances with support for MFM, along with the normal representation for other instances. I've not touched any database stuff for this PR yet- The way this PR works as of now is recognising MFM in posts and rewriting the MFM as HTML before the post is added to the database like normal.

(This is my second time using Ruby at all, this was made for my own instance and I'm making this PR just in case, no worries if this implementation isn't good enough!)

@ErikUden
Copy link

Would really love this in glitch-soc! Find it very odd to see Misskey posts utilizing MFM on my Masto-timeline not rendering anything correctly.

@hazycora
Copy link
Author

All implemented test cases now pass- That doesn't mean parsing is complete though, test cases for blockquotes for example haven't been written. I'll implement blockquotes and whatever else is left soon and then I'll take a look at having the animations be toggleable.

Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Copy link

This pull request has resolved merge conflicts and is ready for review.

Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants