8000 GitHub - Groundpolis/gpfm.js: An MFM parser implementation with PEG.js
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Groundpolis/gpfm.js

 
 

Repository files navigation

gpfm.js

An GPFM(Extended MFM for Groundpolis) parser implementation with PEG.js. Forked from mfm.js.

Installation

npm i Groundpolis/gpfm.js

Usage

Please see docs for the detail.

TypeScript:

import * as mfm from 'mfm-js';

const inputText =
`<center>
Hello $[tada everynyan! 🎉]

I'm @ai, A bot of misskey!

https://github.com/syuilo/ai
</center>`;

// Generate a MFM tree from the MFM text.
const mfmTree = mfm.parse(inputText);

// Generate a MFM tree from the MFM plain text.
const plainMfmTree = mfm.parsePlain('I like the hot soup :soup:​');

// Reverse to a MFM text from the MFM tree.
const text = mfm.toString(mfmTree);

Develop

1. Clone

git clone https://github.com/Groundpolis/gpfm.js.git

2. Install packages

cd gpfm.js
npm i

3. Build

npm run build

Use the interactive CLI parser

full parser:

npm run parse

plain parser:

npm run parse-plain

License

This software is released under the MIT License.

About

An MFM parser implementation with PEG.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 66.6%
  • JavaScript 21.0% 2B76
  • PEG.js 12.4%
0