UMD/ESM TypeScript port of maniaplanet-style-js-parser with some tweaks.
$ npm i -S @altrd/mpformat
// node.js
const { parse, toHTML, toPlainText } = require('@altrd/mpformat')
// webpack/parcel/etc (TypeScript supported)
import { parse, toHTML, toPlainText } from '@altrd/mpformat'
const html = toHTML(parse('$f00Red')) // => '<span style="color: #ff0000;">Red</span>'
const text = toPlainText(parse('$f00Red')) // => 'Red'
<script src="https://unpkg.com/@altrd/mpformat"></script>
MPFormat.toHTML(MPFormat.parse('$f00Red'))