An VFM parser implementation with TypeScript.
| etc | ||
| src | ||
| test | ||
| test-d | ||
| .editorconfig | ||
| .eslintignore | ||
| .gitignore | ||
| api-extractor.json | ||
| CHANGELOG.md | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| eslint.config.cjs | ||
| jest.config.ts | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| tsconfig.json | ||
vfm.js
An VFM parser implementation with fixes based on MFM.
Installation
npm i vfm-js
Usage
Please see docs for the detail.
TypeScript:
import * as mfm from 'vfm-js';
const inputText =
`<center>
Hello $[tada everynyan! 🎉]
I'm @bygul, A bot of valkyriecoms!
https://toastielab.dev/toastie_t0ast/bygul
</center>`;
// Generate a MFM tree from the full MFM text.
const mfmTree = mfm.parse(inputText);
// Generate a MFM tree from the simple MFM text.
const simpleMfmTree = mfm.parseSimple('I like the hot soup :soup:');
// Reverse to a MFM text from the MFM tree.
const text = mfm.toString(vfmTree);
Develop
1. Clone
git clone https://toastielab.dev/valkyrie-dev/vfm.js.git
2. Install packages
cd vfm.js
npm i
3. Build
npm run build
Use the interactive CLI parser
full parser:
npm run parse
simple parser:
npm run parse-simple
License
This software is released under the MIT License.