UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

11 lines (10 loc) 619 B
import { jsx as _jsx } from "react/jsx-runtime"; import { createMarkupRule } from "../MarkupRule.js"; import { BLOCK_SPACE_REGEXP, BLOCK_START_REGEXP, createBlockRegExp } from "../util/regexp.js"; /** * Paragraph. * - Captures almost anything in a block context. * - Any run of non-whitespace. * - Leading and trailing whitespace is trimmed. */ export const PARAGRAPH_RULE = createMarkupRule(createBlockRegExp("(?<paragraph>(?:(?=\\S)[\\s\\S]*?\\S))", `${BLOCK_START_REGEXP}${BLOCK_SPACE_REGEXP}*`), (key, { paragraph }, parser) => _jsx("p", { children: parser.parse(paragraph, "inline") }, key), ["block"], -10);