@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
25 lines • 627 B
JavaScript
import { rawContentProcessor } from './quote-macro';
// bq. foobarbaz
// Ignored via go/ees005
// eslint-disable-next-line require-unicode-regexp
const BLOCKQUOTE_REGEXP = /^bq\.(.*)/;
export const blockquote = ({
input,
position,
schema,
context
}) => {
const match = input.substring(position).match(BLOCKQUOTE_REGEXP);
if (!match) {
return fallback(input, position);
}
const [, rawContent] = match;
return rawContentProcessor('', rawContent, match[0].length, schema, context);
};
function fallback(input, position) {
return {
type: 'text',
text: input.substr(position, 1),
length: 1
};
}