@altrd/mpformat
v0.2.0
Published
UMD/TS rewrite of maniaplanet/maniaplanet-style-js-parser
Downloads
5
Readme
Maniaplanet Formatting Utilities
UMD/ESM TypeScript port of maniaplanet-style-js-parser with some tweaks.
Installation
$ npm i -S @altrd/mpformat
Usage
In node.js or browser via webpack/parcel/etc:
// 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 = toHTML(parse('$f00Red')) // => 'Red'
In the browser via unpkg
<script src="https://unpkg.com/@altrd/mpformat"></script>
MPFormat.toHTML(MPFormat.parse('$f00Red'))