MfmParser.Parser (pleroma_mfm_parser v0.2.1)

Copy Markdown View Source

MfmParser is a FEP-c16b compatible parser for Misskey's Markup language For Misskey MFM functions.

It can parse a string representing text containing MFM functions and return a tree. There's also has an encoder who can turn a tree into HTML.

It only parses the MFM specific tags of the form $[name.opts content].

Other parts of MFM (html, Markdown and KaTeX) are out of scope for this project.

Examples

iex> MfmParser.Parser.parse("$[twitch.speed=0.5s 🍮]")
[
  %MfmParser.Node.MFM{
    name: "twitch",
    attributes: [{"speed", "0.5s"}],
    content: [%MfmParser.Node.Text{content: "🍮"}]
  }
]

Summary

Functions

parse(input, tree \\ [], is_open \\ false)