UNPKG

@atlaskit/editor-wikimarkup-transformer

Version:

Wiki markup transformer for JIRA and Confluence

26 lines (25 loc) 856 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baseMarkPattern = void 0; /** * For text that has leading and ending space. We don't want to * convert it to `* strong *. Instead, we need it to be ` *strong* ` */ var baseMarkPattern = exports.baseMarkPattern = function baseMarkPattern(text, token) { // Ignored via go/ees005 // eslint-disable-next-line require-unicode-regexp if (/^\s*$/.test(text)) { /** * If it's a string with only whitespaces, wiki renderer * will behave incorrect if we apply format on it */ return text; } // Ignored via go/ees005 // eslint-disable-next-line require-unicode-regexp // Ignored via go/ees005 // eslint-disable-next-line require-unicode-regexp return text.replace(/^\s*/, "$&".concat(token)).replace(/\s*$/, "".concat(token, "$&")); };