@chayns-components/format 5.0.0-beta.651 → 5.0.0-beta.674
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/types/format.js +2 -0
- package/lib/cjs/types/format.js.map +1 -0
- package/lib/cjs/utils/escape.js +1 -3
- package/lib/cjs/utils/escape.js.map +1 -1
- package/lib/cjs/utils/formatString/bb-code/findBBCode.js +6 -4
- package/lib/cjs/utils/formatString/bb-code/findBBCode.js.map +1 -1
- package/lib/cjs/utils/formatString/bb-code/formatBBCode.js +37 -37
- package/lib/cjs/utils/formatString/bb-code/formatBBCode.js.map +1 -1
- package/lib/cjs/utils/formatString/formatString.js +30 -42
- package/lib/cjs/utils/formatString/formatString.js.map +1 -1
- package/lib/cjs/utils/formatString/formatString.test.js +549 -0
- package/lib/cjs/utils/formatString/formatString.test.js.map +1 -0
- package/lib/cjs/utils/formatString/markdown/formatMarkdown.js +145 -30
- package/lib/cjs/utils/formatString/markdown/formatMarkdown.js.map +1 -1
- package/lib/esm/types/format.js +2 -0
- package/lib/esm/types/format.js.map +1 -0
- package/lib/esm/utils/escape.js +0 -1
- package/lib/esm/utils/escape.js.map +1 -1
- package/lib/esm/utils/formatString/bb-code/findBBCode.js +6 -4
- package/lib/esm/utils/formatString/bb-code/findBBCode.js.map +1 -1
- package/lib/esm/utils/formatString/bb-code/formatBBCode.js +37 -39
- package/lib/esm/utils/formatString/bb-code/formatBBCode.js.map +1 -1
- package/lib/esm/utils/formatString/formatString.js +33 -45
- package/lib/esm/utils/formatString/formatString.js.map +1 -1
- package/lib/esm/utils/formatString/formatString.test.js +547 -0
- package/lib/esm/utils/formatString/formatString.test.js.map +1 -0
- package/lib/esm/utils/formatString/markdown/formatMarkdown.js +141 -27
- package/lib/esm/utils/formatString/markdown/formatMarkdown.js.map +1 -1
- package/lib/types/types/format.d.ts +5 -0
- package/lib/types/utils/escape.d.ts +0 -1
- package/lib/types/utils/formatString/bb-code/findBBCode.d.ts +2 -0
- package/lib/types/utils/formatString/bb-code/formatBBCode.d.ts +3 -4
- package/lib/types/utils/formatString/formatString.d.ts +1 -3
- package/lib/types/utils/formatString/formatString.test.d.ts +1 -0
- package/lib/types/utils/formatString/markdown/formatMarkdown.d.ts +3 -1
- package/package.json +6 -4
- package/lib/cjs/utils/formatString/markdown/InternalHTMLRenderer.js +0 -287
- package/lib/cjs/utils/formatString/markdown/InternalHTMLRenderer.js.map +0 -1
- package/lib/cjs/utils/formatString/markdown/formatMarkdownTable.js +0 -86
- package/lib/cjs/utils/formatString/markdown/formatMarkdownTable.js.map +0 -1
- package/lib/esm/utils/formatString/markdown/InternalHTMLRenderer.js +0 -278
- package/lib/esm/utils/formatString/markdown/InternalHTMLRenderer.js.map +0 -1
- package/lib/esm/utils/formatString/markdown/formatMarkdownTable.js +0 -78
- package/lib/esm/utils/formatString/markdown/formatMarkdownTable.js.map +0 -1
- package/lib/types/utils/formatString/markdown/InternalHTMLRenderer.d.ts +0 -5
- package/lib/types/utils/formatString/markdown/formatMarkdownTable.d.ts +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":[],"sources":["../../../src/types/format.ts"],"sourcesContent":["export type TableObject = {\n raw: string;\n csv: string;\n id: string;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/utils/escape.js
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.escapeHtmlInText = exports.MESSAGE_CONVERSION_LINE_BREAK_ESCAPED = exports.MESSAGE_CONVERSION_LINE_BREAK = void 0;
|
|
7
7
|
const escapeHtmlInText = text => text.replace(/</g, '<').replace(/>/g, '>');
|
|
8
8
|
exports.escapeHtmlInText = escapeHtmlInText;
|
|
9
|
-
const unescapeSquareBrackets = text => text.replaceAll('[', '[').replaceAll(']', ']');
|
|
10
|
-
exports.unescapeSquareBrackets = unescapeSquareBrackets;
|
|
11
9
|
const MESSAGE_CONVERSION_LINE_BREAK = exports.MESSAGE_CONVERSION_LINE_BREAK = '<br is-replaced-linebreak>';
|
|
12
10
|
const MESSAGE_CONVERSION_LINE_BREAK_ESCAPED = exports.MESSAGE_CONVERSION_LINE_BREAK_ESCAPED = escapeHtmlInText(MESSAGE_CONVERSION_LINE_BREAK);
|
|
13
11
|
//# sourceMappingURL=escape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","names":["escapeHtmlInText","text","replace","exports","
|
|
1
|
+
{"version":3,"file":"escape.js","names":["escapeHtmlInText","text","replace","exports","MESSAGE_CONVERSION_LINE_BREAK","MESSAGE_CONVERSION_LINE_BREAK_ESCAPED"],"sources":["../../../src/utils/escape.ts"],"sourcesContent":["export const escapeHtmlInText = (text: string): string =>\n text.replace(/</g, '<').replace(/>/g, '>');\n\nexport const MESSAGE_CONVERSION_LINE_BREAK = '<br is-replaced-linebreak>';\nexport const MESSAGE_CONVERSION_LINE_BREAK_ESCAPED = escapeHtmlInText(\n MESSAGE_CONVERSION_LINE_BREAK,\n);\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAIC,IAAY,IACzCA,IAAI,CAACC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAACA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;AAACC,OAAA,CAAAH,gBAAA,GAAAA,gBAAA;AAE9C,MAAMI,6BAA6B,GAAAD,OAAA,CAAAC,6BAAA,GAAG,4BAA4B;AAClE,MAAMC,qCAAqC,GAAAF,OAAA,CAAAE,qCAAA,GAAGL,gBAAgB,CACjEI,6BACJ,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.findFirstBBCode = findFirstBBCode;
|
|
7
|
-
const BB_REGEX =
|
|
7
|
+
const BB_REGEX = /(\[([a-zA-Z0-9_]*)(.*?)\])(.*?)(\[\/\2\])/s;
|
|
8
8
|
// Also matches "\" before quote to fix button for voucher messages
|
|
9
9
|
const PARAMETER_REGEX = /([\w]*?)=\\?["„](.*?)["“]/g;
|
|
10
10
|
// TODO Use external package instead of RegExp to parse BBCode.
|
|
@@ -14,11 +14,11 @@ const PARAMETER_REGEX = /([\w]*?)=\\?["„](.*?)["“]/g;
|
|
|
14
14
|
function findFirstBBCode(inputString) {
|
|
15
15
|
const matches = BB_REGEX.exec(inputString);
|
|
16
16
|
if (matches !== null) {
|
|
17
|
-
const [fullMatch, tag, params, content] = matches;
|
|
17
|
+
const [fullMatch, openingTag, tag, params, content, closingTag] = matches;
|
|
18
18
|
const {
|
|
19
19
|
index
|
|
20
20
|
} = matches;
|
|
21
|
-
if (fullMatch === undefined || tag === undefined || params === undefined || content === undefined) return null;
|
|
21
|
+
if (fullMatch === undefined || tag === undefined || params === undefined || content === undefined || openingTag === undefined || closingTag === undefined) return null;
|
|
22
22
|
const parameters = {};
|
|
23
23
|
let match = null;
|
|
24
24
|
// eslint-disable-next-line no-cond-assign
|
|
@@ -33,7 +33,9 @@ function findFirstBBCode(inputString) {
|
|
|
33
33
|
tag,
|
|
34
34
|
parameters,
|
|
35
35
|
content,
|
|
36
|
-
index
|
|
36
|
+
index,
|
|
37
|
+
openingTag,
|
|
38
|
+
closingTag
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findBBCode.js","names":["BB_REGEX","PARAMETER_REGEX","findFirstBBCode","inputString","matches","exec","fullMatch","tag","params","content","index","undefined","parameters","match","key","value"],"sources":["../../../../../src/utils/formatString/bb-code/findBBCode.ts"],"sourcesContent":["const BB_REGEX =
|
|
1
|
+
{"version":3,"file":"findBBCode.js","names":["BB_REGEX","PARAMETER_REGEX","findFirstBBCode","inputString","matches","exec","fullMatch","openingTag","tag","params","content","closingTag","index","undefined","parameters","match","key","value"],"sources":["../../../../../src/utils/formatString/bb-code/findBBCode.ts"],"sourcesContent":["const BB_REGEX = /(\\[([a-zA-Z0-9_]*)(.*?)\\])(.*?)(\\[\\/\\2\\])/s;\n// Also matches \"\\\" before quote to fix button for voucher messages\nconst PARAMETER_REGEX = /([\\w]*?)=\\\\?[\"„](.*?)[\"“]/g;\n\nexport interface BBCodeMatch {\n fullMatch: string;\n tag: string;\n parameters: Record<string, string>;\n content: string;\n index: number;\n openingTag: string;\n closingTag: string;\n}\n\n// TODO Use external package instead of RegExp to parse BBCode.\n// It is not recommended to use RegExp to parse markup languages like BBCode, because it is not possible to parse nested tags with it.\n\n// Finds and returns the first BBCode tag in the input string.\nexport function findFirstBBCode(inputString: string): BBCodeMatch | null {\n const matches = BB_REGEX.exec(inputString);\n\n if (matches !== null) {\n const [fullMatch, openingTag, tag, params, content, closingTag] = matches;\n const { index } = matches;\n\n if (\n fullMatch === undefined ||\n tag === undefined ||\n params === undefined ||\n content === undefined ||\n openingTag === undefined ||\n closingTag === undefined\n )\n return null;\n\n const parameters: Record<string, string> = {};\n\n let match: RegExpExecArray | null = null;\n // eslint-disable-next-line no-cond-assign\n while ((match = PARAMETER_REGEX.exec(params))) {\n const [, key, value] = match;\n\n if (value) {\n parameters[key || 'url'] = value;\n }\n }\n\n return {\n fullMatch,\n tag,\n parameters,\n content,\n index,\n openingTag,\n closingTag,\n };\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAAA,MAAMA,QAAQ,GAAG,4CAA4C;AAC7D;AACA,MAAMC,eAAe,GAAG,4BAA4B;AAYpD;AACA;;AAEA;AACO,SAASC,eAAeA,CAACC,WAAmB,EAAsB;EACrE,MAAMC,OAAO,GAAGJ,QAAQ,CAACK,IAAI,CAACF,WAAW,CAAC;EAE1C,IAAIC,OAAO,KAAK,IAAI,EAAE;IAClB,MAAM,CAACE,SAAS,EAAEC,UAAU,EAAEC,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,CAAC,GAAGP,OAAO;IACzE,MAAM;MAAEQ;IAAM,CAAC,GAAGR,OAAO;IAEzB,IACIE,SAAS,KAAKO,SAAS,IACvBL,GAAG,KAAKK,SAAS,IACjBJ,MAAM,KAAKI,SAAS,IACpBH,OAAO,KAAKG,SAAS,IACrBN,UAAU,KAAKM,SAAS,IACxBF,UAAU,KAAKE,SAAS,EAExB,OAAO,IAAI;IAEf,MAAMC,UAAkC,GAAG,CAAC,CAAC;IAE7C,IAAIC,KAA6B,GAAG,IAAI;IACxC;IACA,OAAQA,KAAK,GAAGd,eAAe,CAACI,IAAI,CAACI,MAAM,CAAC,EAAG;MAC3C,MAAM,GAAGO,GAAG,EAAEC,KAAK,CAAC,GAAGF,KAAK;MAE5B,IAAIE,KAAK,EAAE;QACPH,UAAU,CAACE,GAAG,IAAI,KAAK,CAAC,GAAGC,KAAK;MACpC;IACJ;IAEA,OAAO;MACHX,SAAS;MACTE,GAAG;MACHM,UAAU;MACVJ,OAAO;MACPE,KAAK;MACLL,UAAU;MACVI;IACJ,CAAC;EACL;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.parseBBCode = void 0;
|
|
6
|
+
exports.unescapeBBCodeSquareBrackets = exports.parseBBCode = exports.escapeBBCodeSquareBrackets = void 0;
|
|
7
7
|
var _findBBCode = require("./findBBCode");
|
|
8
8
|
const BB_CODE_HTML_TAG_PREFIX = 'bb-code-';
|
|
9
9
|
const BLOCK_LEVEL_TAGS = ['center', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
|
|
10
10
|
const INLINE_LEVEL_TAGS = ['b', 'strong', 'i', 'em', 'u', 's', 'span', 'img'];
|
|
11
|
-
const HTML_CODE_PATTERN = /(?:<code>|<code class="inline-code">)[\s\S]*?<\/code>/;
|
|
12
11
|
// Parses BB-Code to HTML recursively.
|
|
13
12
|
// When justEscapeSquareBrackets is true, square brackets are escaped to prevent conflicts between markdown and BB Code.
|
|
14
13
|
// In that case the function only escapes square brackets and doesn't remove line breaks.
|
|
15
14
|
const parseBBCode = (text, options) => {
|
|
16
15
|
const {
|
|
17
|
-
justEscapeSquareBrackets = false,
|
|
18
16
|
customBlockLevelBBCodeTags: customBlockLevelTags = [],
|
|
19
|
-
customInlineLevelBBCodeTags: customInlineLevelTags = []
|
|
17
|
+
customInlineLevelBBCodeTags: customInlineLevelTags = [],
|
|
18
|
+
justEscapeSquareBrackets = false
|
|
20
19
|
} = options || {};
|
|
21
20
|
let html = text;
|
|
22
21
|
|
|
@@ -24,26 +23,19 @@ const parseBBCode = (text, options) => {
|
|
|
24
23
|
let parseBehindIndex = 0;
|
|
25
24
|
while (parseBehindIndex < html.length) {
|
|
26
25
|
const htmlToParse = html.slice(parseBehindIndex);
|
|
27
|
-
const firstCodeElementMatch = HTML_CODE_PATTERN.exec(htmlToParse);
|
|
28
26
|
const firstBBCodeMatch = (0, _findBBCode.findFirstBBCode)(htmlToParse);
|
|
29
27
|
|
|
30
28
|
// Stops parsing if no BB-Code is found.
|
|
31
29
|
if (!firstBBCodeMatch) {
|
|
32
30
|
return html;
|
|
33
31
|
}
|
|
34
|
-
|
|
35
|
-
// Prevents bb-code parsing within code block.
|
|
36
|
-
if (firstCodeElementMatch && firstBBCodeMatch && firstCodeElementMatch.index < firstBBCodeMatch.index) {
|
|
37
|
-
// If a code block is found before a BB-Code tag, BB-Code parsing continues behind the code block.
|
|
38
|
-
parseBehindIndex += firstCodeElementMatch.index + firstCodeElementMatch[0].length;
|
|
39
|
-
// eslint-disable-next-line no-continue
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
32
|
const {
|
|
43
33
|
content,
|
|
44
34
|
fullMatch,
|
|
45
35
|
parameters,
|
|
46
|
-
index
|
|
36
|
+
index,
|
|
37
|
+
openingTag,
|
|
38
|
+
closingTag
|
|
47
39
|
} = firstBBCodeMatch;
|
|
48
40
|
const Tag = firstBBCodeMatch.tag.toLowerCase();
|
|
49
41
|
const isValidTag = [...BLOCK_LEVEL_TAGS, ...customBlockLevelTags, ...INLINE_LEVEL_TAGS, ...customInlineLevelTags].includes(Tag);
|
|
@@ -58,37 +50,45 @@ const parseBBCode = (text, options) => {
|
|
|
58
50
|
}
|
|
59
51
|
|
|
60
52
|
// Converts BB-Code tag's content before converting itself, because it may contain other BB-Codes.
|
|
61
|
-
let parsedContent = parseBBCode(content);
|
|
53
|
+
let parsedContent = parseBBCode(content, options);
|
|
54
|
+
if (justEscapeSquareBrackets) {
|
|
55
|
+
const indexOfFullMatch = html.indexOf(fullMatch);
|
|
56
|
+
const escapedOpeningTag = escapeBBCodeSquareBrackets(openingTag);
|
|
57
|
+
const escapedClosingTag = escapeBBCodeSquareBrackets(closingTag);
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
// Removes leading and trailing line-breaks from within bb code elements, to prevent unwanted spacing.
|
|
60
|
+
// This needs to be done before formatting Markdown, so the Markdown formatting doesn't interpret line breaks unexpectedly.
|
|
65
61
|
parsedContent = parsedContent.replace(/^\n+|\n+$/g, '');
|
|
66
|
-
}
|
|
67
|
-
const indexOfFullMatch = html.indexOf(fullMatch);
|
|
68
|
-
let htmlAfterTag = html.slice(indexOfFullMatch + fullMatch.length);
|
|
69
|
-
|
|
70
|
-
// Removes leading line-break (ONE, NOT ALL) after block level elements, to prevent unwanted spacing.
|
|
71
|
-
if (!justEscapeSquareBrackets && isBlockLevelTag) {
|
|
72
|
-
htmlAfterTag = htmlAfterTag.replace(/^\n/, '');
|
|
73
|
-
}
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const closeTag = justEscapeSquareBrackets ? ']' : '>';
|
|
63
|
+
// Simply escapes the square brackets of the BB-Code opening and closing tag.
|
|
64
|
+
html = html.slice(0, indexOfFullMatch) + escapedOpeningTag + parsedContent + escapedClosingTag + html.slice(indexOfFullMatch + fullMatch.length);
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
// Continues parsing behind the parsed bb-code.
|
|
67
|
+
parseBehindIndex = indexOfFullMatch + escapedOpeningTag.length + parsedContent.length + escapedClosingTag.length;
|
|
68
|
+
} else {
|
|
69
|
+
const indexOfFullMatch = html.indexOf(fullMatch);
|
|
70
|
+
let htmlAfterTag = html.slice(indexOfFullMatch + fullMatch.length);
|
|
81
71
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
// Removes leading line-break (ONE, NOT ALL) after block level elements, to prevent unwanted spacing.
|
|
73
|
+
if (isBlockLevelTag) {
|
|
74
|
+
htmlAfterTag = htmlAfterTag.replace(/^\n/, '');
|
|
75
|
+
}
|
|
76
|
+
const isCustomTag = [...customBlockLevelTags, ...customInlineLevelTags].includes(Tag);
|
|
77
|
+
const htmlTag = isCustomTag ? `${BB_CODE_HTML_TAG_PREFIX}${Tag}` : Tag;
|
|
78
|
+
const openingHtmlTag = `<${htmlTag}${Object.entries(parameters).length > 0 ? ' ' : ''}${Object.entries(parameters).map(([key, value]) => `${key}="${value}"`).join(' ')}>`;
|
|
79
|
+
const closingHtmlTag = `</${htmlTag}>`;
|
|
80
|
+
const element = Tag === 'img' ? openingHtmlTag : openingHtmlTag + parsedContent + closingHtmlTag;
|
|
81
|
+
html = `${html.slice(0, indexOfFullMatch)}${element}${htmlAfterTag}`;
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
// Continues parsing behind the parsed bb-code.
|
|
84
|
+
parseBehindIndex = indexOfFullMatch + element.length;
|
|
85
|
+
}
|
|
90
86
|
}
|
|
91
87
|
return html;
|
|
92
88
|
};
|
|
93
89
|
exports.parseBBCode = parseBBCode;
|
|
90
|
+
const escapeBBCodeSquareBrackets = text => text.replaceAll('[', '‍[‍').replaceAll(']', '‍]‍');
|
|
91
|
+
exports.escapeBBCodeSquareBrackets = escapeBBCodeSquareBrackets;
|
|
92
|
+
const unescapeBBCodeSquareBrackets = text => text.replaceAll('‍[‍', '[').replaceAll('‍]‍', ']');
|
|
93
|
+
exports.unescapeBBCodeSquareBrackets = unescapeBBCodeSquareBrackets;
|
|
94
94
|
//# sourceMappingURL=formatBBCode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatBBCode.js","names":["_findBBCode","require","BB_CODE_HTML_TAG_PREFIX","BLOCK_LEVEL_TAGS","INLINE_LEVEL_TAGS","
|
|
1
|
+
{"version":3,"file":"formatBBCode.js","names":["_findBBCode","require","BB_CODE_HTML_TAG_PREFIX","BLOCK_LEVEL_TAGS","INLINE_LEVEL_TAGS","parseBBCode","text","options","customBlockLevelBBCodeTags","customBlockLevelTags","customInlineLevelBBCodeTags","customInlineLevelTags","justEscapeSquareBrackets","html","parseBehindIndex","length","htmlToParse","slice","firstBBCodeMatch","findFirstBBCode","content","fullMatch","parameters","index","openingTag","closingTag","Tag","tag","toLowerCase","isValidTag","includes","isBlockLevelTag","parsedContent","indexOfFullMatch","indexOf","escapedOpeningTag","escapeBBCodeSquareBrackets","escapedClosingTag","replace","htmlAfterTag","isCustomTag","htmlTag","openingHtmlTag","Object","entries","map","key","value","join","closingHtmlTag","element","exports","replaceAll","unescapeBBCodeSquareBrackets"],"sources":["../../../../../src/utils/formatString/bb-code/formatBBCode.ts"],"sourcesContent":["import { findFirstBBCode } from './findBBCode';\n\nconst BB_CODE_HTML_TAG_PREFIX = 'bb-code-';\n\nconst BLOCK_LEVEL_TAGS = ['center', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];\nconst INLINE_LEVEL_TAGS = ['b', 'strong', 'i', 'em', 'u', 's', 'span', 'img'];\n\nexport interface ParseBBCodesOptions {\n customBlockLevelBBCodeTags?: string[];\n customInlineLevelBBCodeTags?: string[];\n justEscapeSquareBrackets?: boolean;\n}\n\n// Parses BB-Code to HTML recursively.\n// When justEscapeSquareBrackets is true, square brackets are escaped to prevent conflicts between markdown and BB Code.\n// In that case the function only escapes square brackets and doesn't remove line breaks.\nexport const parseBBCode = (text: string, options?: ParseBBCodesOptions) => {\n const {\n customBlockLevelBBCodeTags: customBlockLevelTags = [],\n customInlineLevelBBCodeTags: customInlineLevelTags = [],\n justEscapeSquareBrackets = false,\n } = options || {};\n\n let html = text;\n\n // This index is used to keep track of the position in the html string that is being parsed.\n let parseBehindIndex = 0;\n\n while (parseBehindIndex < html.length) {\n const htmlToParse = html.slice(parseBehindIndex);\n\n const firstBBCodeMatch = findFirstBBCode(htmlToParse);\n\n // Stops parsing if no BB-Code is found.\n if (!firstBBCodeMatch) {\n return html;\n }\n\n const { content, fullMatch, parameters, index, openingTag, closingTag } = firstBBCodeMatch;\n\n const Tag = firstBBCodeMatch.tag.toLowerCase();\n const isValidTag = [\n ...BLOCK_LEVEL_TAGS,\n ...customBlockLevelTags,\n ...INLINE_LEVEL_TAGS,\n ...customInlineLevelTags,\n ].includes(Tag);\n const isBlockLevelTag = [...BLOCK_LEVEL_TAGS, ...customBlockLevelTags].includes(Tag);\n\n // Ignores tags that are not supported.\n if (!isValidTag) {\n // The parsing continues behind the first square bracket of the BB-Code tag.\n parseBehindIndex += index + 1;\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // Converts BB-Code tag's content before converting itself, because it may contain other BB-Codes.\n let parsedContent = parseBBCode(content, options);\n\n if (justEscapeSquareBrackets) {\n const indexOfFullMatch = html.indexOf(fullMatch);\n const escapedOpeningTag = escapeBBCodeSquareBrackets(openingTag);\n const escapedClosingTag = escapeBBCodeSquareBrackets(closingTag);\n\n // Removes leading and trailing line-breaks from within bb code elements, to prevent unwanted spacing.\n // This needs to be done before formatting Markdown, so the Markdown formatting doesn't interpret line breaks unexpectedly.\n parsedContent = parsedContent.replace(/^\\n+|\\n+$/g, '');\n\n // Simply escapes the square brackets of the BB-Code opening and closing tag.\n html =\n html.slice(0, indexOfFullMatch) +\n escapedOpeningTag +\n parsedContent +\n escapedClosingTag +\n html.slice(indexOfFullMatch + fullMatch.length);\n\n // Continues parsing behind the parsed bb-code.\n parseBehindIndex =\n indexOfFullMatch +\n escapedOpeningTag.length +\n parsedContent.length +\n escapedClosingTag.length;\n } else {\n const indexOfFullMatch = html.indexOf(fullMatch);\n\n let htmlAfterTag = html.slice(indexOfFullMatch + fullMatch.length);\n\n // Removes leading line-break (ONE, NOT ALL) after block level elements, to prevent unwanted spacing.\n if (isBlockLevelTag) {\n htmlAfterTag = htmlAfterTag.replace(/^\\n/, '');\n }\n\n const isCustomTag = [...customBlockLevelTags, ...customInlineLevelTags].includes(Tag);\n const htmlTag = isCustomTag ? `${BB_CODE_HTML_TAG_PREFIX}${Tag}` : Tag;\n const openingHtmlTag = `<${htmlTag}${Object.entries(parameters).length > 0 ? ' ' : ''}${Object.entries(\n parameters,\n )\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(' ')}>`;\n const closingHtmlTag = `</${htmlTag}>`;\n\n const element =\n Tag === 'img' ? openingHtmlTag : openingHtmlTag + parsedContent + closingHtmlTag;\n\n html = `${html.slice(0, indexOfFullMatch)}${element}${htmlAfterTag}`;\n\n // Continues parsing behind the parsed bb-code.\n parseBehindIndex = indexOfFullMatch + element.length;\n }\n }\n\n return html;\n};\n\nexport const escapeBBCodeSquareBrackets = (text: string) =>\n text.replaceAll('[', '‍[‍').replaceAll(']', '‍]‍');\n\nexport const unescapeBBCodeSquareBrackets = (text: string) =>\n text.replaceAll('‍[‍', '[').replaceAll('‍]‍', ']');\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,MAAMC,uBAAuB,GAAG,UAAU;AAE1C,MAAMC,gBAAgB,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;AAC9F,MAAMC,iBAAiB,GAA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AC,CAACP,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG4B,MAAM,CAACC,OAAO,CAClGtB,UACJ,CAAC,CACIuB,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK,GAAGD,GAAG,KAAKC,KAAK,GAAG,CAAC,CAC1CC,IAAI,CAAC,GAAG,CAAC,GAAG;MACjB,MAAMC,cAAc,GAAG,KAAKR,OAAO,GAAG;MAEtC,MAAMS,OAAO,GACTxB,GAAG,KAAK,KAAK,GAAGgB,cAAc,GAAGA,cAAc,GAAGV,aAAa,GAAGiB,cAAc;MAEpFpC,IAAI,GAAG,GAAGA,IAAI,CAACI,KAAK,CAAC,CAAC,EAAEgB,gBAAgB,CAAC,GAAGiB,OAAO,GAAGX,YAAY,EAAE;;MAEpE;MACAzB,gBAAgB,GAAGmB,gBAAgB,GAAGiB,OAAO,CAACnC,MAAM;IACxD;EACJ;EAEA,OAAOF,IAAI;AACf,CAAC;AAACsC,OAAA,CAAA9C,WAAA,GAAAA,WAAA;AAEK,MAAM+B,0BAA0B,GAAI9B,IAAY,IACnDA,IAAI,CAAC8C,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,CAACA,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC;AAACD,OAAA,CAAAf,0BAAA,GAAAA,0BAAA;AAEhE,MAAMiB,4BAA4B,GAAI/C,IAAY,IACrDA,IAAI,CAAC8C,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,CAACA,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC;AAACD,OAAA,CAAAE,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ exports.formatStringToHtml = void 0;
|
|
|
7
7
|
var _escape = require("../escape");
|
|
8
8
|
var _formatBBCode = require("./bb-code/formatBBCode");
|
|
9
9
|
var _formatMarkdown = require("./markdown/formatMarkdown");
|
|
10
|
-
var _formatMarkdownTable = require("./markdown/formatMarkdownTable");
|
|
11
10
|
// This function takes a string and returns formatted html as a string.
|
|
12
11
|
const formatStringToHtml = (string, options) => {
|
|
13
12
|
if (!string) {
|
|
@@ -17,71 +16,60 @@ const formatStringToHtml = (string, options) => {
|
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
const {
|
|
20
|
-
escapeHtml: escapeHtmlOption = false,
|
|
21
19
|
parseMarkdown: parseMarkdownOption = true,
|
|
22
|
-
parseMarkdownTables: parseMarkdownTablesOption = false,
|
|
23
20
|
parseBBCode: parseBBCodeOption = false,
|
|
24
21
|
customInlineLevelBBCodeTags = [],
|
|
25
22
|
customBlockLevelBBCodeTags = []
|
|
26
23
|
} = options || {};
|
|
27
24
|
let formattedString = string;
|
|
28
25
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Escape BB-Code square brackets, to prevent conflicts between markdown and BB Code.
|
|
35
|
-
/* Conflict example:
|
|
36
|
-
When Sidekick detects a function call as an entity through NER, then the following text is returned.
|
|
37
|
-
'[nerReplace <params>]function[/nerReplace](<params>)'
|
|
38
|
-
Because '[/nerReplace](<params>)' is a valid Markdown link, the Markdown parser would interpret it as a link
|
|
39
|
-
and thus prevent the BB-Code parser from recognizing the BB-Code. Parsing the BB-Code first would prevent this
|
|
40
|
-
issue. Unfortunately the Markdown parser doesn't support this.
|
|
41
|
-
*/
|
|
42
|
-
const shouldTemporarilyEscapeBBCodeBrackets = parseMarkdownOption && parseBBCodeOption;
|
|
43
|
-
if (shouldTemporarilyEscapeBBCodeBrackets) {
|
|
26
|
+
// Needs to get the tables before escaping html and parsing bb-code, so the original content can be extracted.
|
|
27
|
+
const tables = [];
|
|
28
|
+
if (parseMarkdownOption) {
|
|
44
29
|
try {
|
|
45
|
-
|
|
46
|
-
justEscapeSquareBrackets: true
|
|
47
|
-
});
|
|
30
|
+
tables.push(...(0, _formatMarkdown.getMarkdownTables)(formattedString));
|
|
48
31
|
} catch (error) {
|
|
49
|
-
console.warn('[@chayns-components/format] Warning: Failed to
|
|
32
|
+
console.warn('[@chayns-components/format] Warning: Failed to get markdown tables', error);
|
|
50
33
|
}
|
|
51
34
|
}
|
|
52
35
|
|
|
53
|
-
//
|
|
36
|
+
// Escape HTML entities.
|
|
37
|
+
formattedString = (0, _escape.escapeHtmlInText)(formattedString);
|
|
38
|
+
|
|
39
|
+
// Escape BB-Code, to prevent conflicts between markdown and bb-code. Specifically [b]test[/b]() would be a problem, since markdown interprets parts of this as a link.
|
|
40
|
+
|
|
41
|
+
// Parses markdown to HTML.
|
|
54
42
|
if (parseMarkdownOption) {
|
|
55
43
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
if (parseBBCodeOption) {
|
|
45
|
+
// Escapes BB-Code brackets.
|
|
46
|
+
formattedString = (0, _formatBBCode.parseBBCode)(formattedString, {
|
|
47
|
+
customInlineLevelBBCodeTags,
|
|
48
|
+
customBlockLevelBBCodeTags,
|
|
49
|
+
justEscapeSquareBrackets: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
formattedString = (0, _formatMarkdown.parseMarkdown)(formattedString, parseBBCodeOption);
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
// Remove trailing \n
|
|
55
|
+
formattedString = formattedString.replace(/\n$/, '');
|
|
56
|
+
if (parseBBCodeOption) {
|
|
57
|
+
// Unescapes BB-Code brackets.
|
|
58
|
+
formattedString = (0, _formatBBCode.unescapeBBCodeSquareBrackets)(formattedString);
|
|
59
|
+
}
|
|
69
60
|
} catch (error) {
|
|
70
|
-
console.warn('[@chayns-components/format] Warning: Failed to parse markdown
|
|
61
|
+
console.warn('[@chayns-components/format] Warning: Failed to parse markdown', error);
|
|
71
62
|
}
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
//
|
|
75
|
-
if (shouldTemporarilyEscapeBBCodeBrackets) {
|
|
76
|
-
formattedString = (0, _escape.unescapeSquareBrackets)(formattedString);
|
|
77
|
-
}
|
|
65
|
+
// Parses BB-Code to HTML.
|
|
78
66
|
if (parseBBCodeOption) {
|
|
79
67
|
try {
|
|
80
68
|
formattedString = (0, _formatBBCode.parseBBCode)(formattedString, {
|
|
81
69
|
customInlineLevelBBCodeTags,
|
|
82
|
-
customBlockLevelBBCodeTags
|
|
83
|
-
justEscapeSquareBrackets: false
|
|
70
|
+
customBlockLevelBBCodeTags
|
|
84
71
|
});
|
|
72
|
+
formattedString = (0, _formatBBCode.unescapeBBCodeSquareBrackets)(formattedString);
|
|
85
73
|
} catch (error) {
|
|
86
74
|
console.warn('[@chayns-components/format] Warning: Failed to parse bb-code', error);
|
|
87
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatString.js","names":["_escape","require","_formatBBCode","_formatMarkdown","
|
|
1
|
+
{"version":3,"file":"formatString.js","names":["_escape","require","_formatBBCode","_formatMarkdown","formatStringToHtml","string","options","html","tables","parseMarkdown","parseMarkdownOption","parseBBCode","parseBBCodeOption","customInlineLevelBBCodeTags","customBlockLevelBBCodeTags","formattedString","push","getMarkdownTables","error","console","warn","escapeHtmlInText","justEscapeSquareBrackets","replace","unescapeBBCodeSquareBrackets","exports"],"sources":["../../../../src/utils/formatString/formatString.ts"],"sourcesContent":["import type { TableObject } from '../../types/format';\nimport { escapeHtmlInText } from '../escape';\nimport {\n parseBBCode,\n ParseBBCodesOptions,\n unescapeBBCodeSquareBrackets,\n} from './bb-code/formatBBCode';\nimport { getMarkdownTables, parseMarkdown } from './markdown/formatMarkdown';\n\ninterface FormatStringOptions extends ParseBBCodesOptions {\n parseMarkdown?: boolean;\n parseBBCode?: boolean;\n}\n\ninterface FormatStringResult {\n html: string;\n tables: TableObject[];\n}\n\n// This function takes a string and returns formatted html as a string.\nexport const formatStringToHtml = (\n string: string,\n options?: FormatStringOptions,\n): FormatStringResult => {\n if (!string) {\n return {\n html: '',\n tables: [],\n };\n }\n\n const {\n parseMarkdown: parseMarkdownOption = true,\n parseBBCode: parseBBCodeOption = false,\n customInlineLevelBBCodeTags = [],\n customBlockLevelBBCodeTags = [],\n } = options || {};\n\n let formattedString = string;\n\n // Needs to get the tables before escaping html and parsing bb-code, so the original content can be extracted.\n const tables: TableObject[] = [];\n if (parseMarkdownOption) {\n try {\n tables.push(...getMarkdownTables(formattedString));\n } catch (error) {\n console.warn(\n '[@chayns-components/format] Warning: Failed to get markdown tables',\n error,\n );\n }\n }\n\n // Escape HTML entities.\n formattedString = escapeHtmlInText(formattedString);\n\n // Escape BB-Code, to prevent conflicts between markdown and bb-code. Specifically [b]test[/b]() would be a problem, since markdown interprets parts of this as a link.\n\n // Parses markdown to HTML.\n if (parseMarkdownOption) {\n try {\n if (parseBBCodeOption) {\n // Escapes BB-Code brackets.\n formattedString = parseBBCode(formattedString, {\n customInlineLevelBBCodeTags,\n customBlockLevelBBCodeTags,\n justEscapeSquareBrackets: true,\n });\n }\n\n formattedString = parseMarkdown(formattedString, parseBBCodeOption);\n\n // Remove trailing \\n\n formattedString = formattedString.replace(/\\n$/, '');\n\n if (parseBBCodeOption) {\n // Unescapes BB-Code brackets.\n formattedString = unescapeBBCodeSquareBrackets(formattedString);\n }\n } catch (error) {\n console.warn('[@chayns-components/format] Warning: Failed to parse markdown', error);\n }\n }\n\n // Parses BB-Code to HTML.\n if (parseBBCodeOption) {\n try {\n formattedString = parseBBCode(formattedString, {\n customInlineLevelBBCodeTags,\n customBlockLevelBBCodeTags,\n });\n formattedString = unescapeBBCodeSquareBrackets(formattedString);\n } catch (error) {\n console.warn('[@chayns-components/format] Warning: Failed to parse bb-code', error);\n }\n }\n\n return {\n html: formattedString,\n tables,\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,eAAA,GAAAF,OAAA;AAYA;AACO,MA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