mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-25 07:25:13 +00:00
Fix return value of parsePlain API
This commit is contained in:
parent
d82b12146a
commit
ecca995a20
2 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
import peg from 'pegjs';
|
import peg from 'pegjs';
|
||||||
import { MfmNode } from './node';
|
import { MfmNode, MfmPlainNode } from './node';
|
||||||
import { stringifyNode, stringifyTree } from './util';
|
import { stringifyNode, stringifyTree } from './util';
|
||||||
const parser: peg.Parser = require('./parser');
|
const parser: peg.Parser = require('./parser');
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ export function parse(input: string): MfmNode[] {
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parsePlain(input: string): MfmNode[] {
|
export function parsePlain(input: string): MfmPlainNode[] {
|
||||||
const nodes = parser.parse(input, { startRule: 'plainParser' });
|
const nodes = parser.parse(input, { startRule: 'plainParser' });
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
export type MfmNode = MfmBlock | MfmInline;
|
export type MfmNode = MfmBlock | MfmInline;
|
||||||
|
|
||||||
|
export type MfmPlainNode = MfmUnicodeEmoji | MfmEmojiCode | MfmText;
|
||||||
|
|
||||||
export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter;
|
export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter;
|
||||||
|
|
||||||
const blockTypes: MfmNode['type'][] = [ 'quote', 'search', 'blockCode', 'mathBlock', 'center' ];
|
const blockTypes: MfmNode['type'][] = [ 'quote', 'search', 'blockCode', 'mathBlock', 'center' ];
|
||||||
|
|
Loading…
Reference in a new issue