@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
22 lines • 561 B
JavaScript
import { createRuleNode } from '../nodes/rule';
// Ignored via go/ees005
// eslint-disable-next-line require-unicode-regexp
var RULER_REGEX = /^-{4,5}(\s|$)/;
export var ruler = function ruler(_ref) {
var input = _ref.input,
position = _ref.position,
schema = _ref.schema;
var 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
};
};