UNPKG

lexical-remark

Version:

This package contains Markdown helpers and functionality for Lexical using remark-parse.

12 lines (11 loc) 394 B
import lexicalList from '@lexical/list'; export const listItem = (node, parser) => { if (!lexicalList.$isListNode(parser.stack[parser.stack.length - 1])) { return; } const lexicalNode = lexicalList.$createListItemNode(); parser.push(lexicalNode); node.children.forEach((child) => parser.parse(child)); parser.pop(lexicalNode); parser.append(lexicalNode); };