mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-24 23:15:14 +00:00
v0.1.3
This commit is contained in:
parent
ed85121c5a
commit
753cb6deff
3 changed files with 14 additions and 7 deletions
12
README.md
12
README.md
|
@ -9,10 +9,13 @@ npm i mfm-parser-pegjs
|
|||
|
||||
## Usage
|
||||
```ts
|
||||
import { parse } from 'mfm-parser-pegjs';
|
||||
import * as mfm from 'mfm-parser-pegjs';
|
||||
|
||||
// parse a MFM code
|
||||
const result = parse('this is a ***MFM text***');
|
||||
// parse a MFM text
|
||||
const result = mfm.parse('good morning ***everyone!***');
|
||||
|
||||
// parse a MFM plain text
|
||||
const plainResult = mfm.parsePlain('I like the hot soup :soup:');
|
||||
```
|
||||
|
||||
## Usage (Repository)
|
||||
|
@ -39,6 +42,3 @@ npm run parse
|
|||
|
||||
## License
|
||||
This software is released under the [MIT License](LICENSE).
|
||||
|
||||
This software includes codes of other softwares:
|
||||
- PEG.js: https://raw.githubusercontent.com/pegjs/pegjs/master/LICENSE
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mfm-parser-pegjs",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.3",
|
||||
"description": "A MFM parser made with PEG.js",
|
||||
"main": "./built/index.js",
|
||||
"scripts": {
|
||||
|
@ -18,6 +18,7 @@
|
|||
"url": "git+https://github.com/marihachi/mfm-parser-pegjs.git"
|
||||
},
|
||||
"author": "Marihachi",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/parsimmon": "^1.10.1",
|
||||
|
|
|
@ -12,3 +12,9 @@ export function parse(input: string) {
|
|||
trees = coreParser.parse(input);
|
||||
return trees;
|
||||
}
|
||||
|
||||
export function parsePlain(input: string) {
|
||||
let trees: Tree[];
|
||||
trees = coreParser.parse(input, { startRule: 'plainParser' });
|
||||
return trees;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue