marked-mfm/README.md

33 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2022-07-08 08:41:18 +00:00
# marked-mfm
a [Marked.js](https://marked.js.org) custom extension for [Misskey-flavored Markdown](https://github.com/misskey-dev/mfm.js/blob/develop/docs/syntax.md).
this is a reimplementation of [the original MFM parser](https://github.com/misskey-dev/mfm.js/blob/develop/docs/syntax.md), which was written from the ground up using PEG.js instead of as an extension of CommonMark, and therefore was not up to spec.
2022-07-12 17:29:43 +00:00
this extension is mostly compatible with the original, except it only implements `$[tags]`. mentions, hashtags and the `search` markup are out of scope.
2022-07-08 08:41:18 +00:00
## usage
```js
const marked = require('marked')
const markedMfm = require('marked-mfm')
marked.use(markedMfm)
marked.parse('$[x2 beeg text]')
2022-07-12 17:29:43 +00:00
// <p><span class="mfm _mfm_x2_" >beeg text</span></p>
2022-07-08 08:41:18 +00:00
```
2022-07-13 18:03:53 +00:00
2022-08-01 09:40:07 +00:00
there is also an interactive CLI:
```html
$ npm run dingus
marked-mfm interactive parser
version 0.0.0
> $[x2 beeg text]
<p><span class="mfm _mfm_x2_" >beeg text</span></p>
```
you should use it to figure out whether a bug is with marked-mfm or with the frontend it's used on.
2022-07-13 18:03:53 +00:00
## contributing
development discussion takes place on [`#mfm`](https://irc.akkoma.dev/#mfm). contribute by sending pull requests, or patches to my [public inbox](mailto:~sfr/public-inbox@lists.sr.ht).