Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 797 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 797 Bytes

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 = toPlainText(parse('$f00Red')) // => 'Red'

In the browser via unpkg

<script src="https://unpkg.com/@altrd/mpformat"></script>
MPFormat.toHTML(MPFormat.parse('$f00Red'))