UNPKG

@atlaskit/editor-wikimarkup-transformer

Version:

Wiki markup transformer for JIRA and Confluence

23 lines 503 B
import { createRuleNode } from '../nodes/rule'; // Ignored via go/ees005 // eslint-disable-next-line require-unicode-regexp const RULER_REGEX = /^-{4,5}(\s|$)/; export const ruler = ({ input, position, schema }) => { const match = input.substring(position).match(RULER_REGEX); if (match) { return { type: 'pmnode', nodes: createRuleNode(schema), length: match[0].length }; } return { type: 'text', text: input.substring(position, 1), length: 1 }; };