misskey-dev / mfm.js

An MFM parser implementation with TypeScript.
MIT License
108 stars 19 forks source link

MFM to HTML support #138

Open ThuHtooSan opened 4 months ago

ThuHtooSan commented 4 months ago

Do you have a plan to support MFM to HTML direct parsing? Currently, if I want to implement the MFM parser in my projects, I need to write my own encoder to convert the returned MFM tree to HTML.

I'm sorry to bother you but Discord link is dead and the forum no longer exists so...

gabboman commented 2 months ago

Hi with the package @opera7133/mfmp you can

import { toHtml } from '@opera7133/mfmp' import * as mfm from 'mfm-js'

toHtml(mfm.parse(MFM_STRING_HERE))

ThuHtooSan commented 2 months ago

@gabboman Thank you! I'll check it out.

gabboman commented 2 months ago

its a bit wonky. In wafrn I ended up disabling it. a lot of custom clasees, and broken links

ThuHtooSan commented 2 months ago

Oh is it? When I checked (the code) earlier, it didn't look like it has custom classes though. But I do see some custom dataset attributes. ig I have to find another one then :)