diff --git a/src/index.ts b/src/index.ts index b8fa44a6145a35cf04e19042bda33e0db456ca2b..85289f2a0832415c837a1418c50ac138228b8211 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import peg from 'pegjs'; -import { MfmNode } from './node'; +import { MfmNode, MfmPlainNode } from './node'; import { stringifyNode, stringifyTree } from './util'; const parser: peg.Parser = require('./parser'); @@ -8,7 +8,7 @@ export function parse(input: string): MfmNode[] { return nodes; } -export function parsePlain(input: string): MfmNode[] { +export function parsePlain(input: string): MfmPlainNode[] { const nodes = parser.parse(input, { startRule: 'plainParser' }); return nodes; } diff --git a/src/node.ts b/src/node.ts index 39875c4dc7ddad3814674ab74b394fa326f447cc..66de7ff88abdc81916cfb7c4aa23a98ede5775f9 100644 --- a/src/node.ts +++ b/src/node.ts @@ -1,5 +1,7 @@ export type MfmNode = MfmBlock | MfmInline; +export type MfmPlainNode = MfmUnicodeEmoji | MfmEmojiCode | MfmText; + export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter; const blockTypes: MfmNode['type'][] = [ 'quote', 'search', 'blockCode', 'mathBlock', 'center' ];