@uzum-tech/ui 2.3.5 → 2.3.6
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/dist/index.js +5967 -64
- package/dist/index.mjs +5967 -64
- package/dist/index.prod.js +4 -2
- package/dist/index.prod.mjs +4 -2
- package/es/_utils/markdown/constants.d.ts +27 -0
- package/es/_utils/markdown/constants.mjs +26 -0
- package/es/_utils/markdown/create-markdown-renderer.d.ts +3 -0
- package/es/_utils/markdown/create-markdown-renderer.mjs +65 -0
- package/es/_utils/markdown/index.d.ts +2 -0
- package/es/_utils/markdown/index.mjs +1 -0
- package/es/_utils/markdown/interface.d.ts +14 -0
- package/es/_utils/markdown/interface.mjs +7 -0
- package/es/_utils/markdown/render-markdown.d.ts +3 -0
- package/es/_utils/markdown/render-markdown.mjs +31 -0
- package/es/_utils/markdown/rulers/clamp-heading.d.ts +2 -0
- package/es/_utils/markdown/rulers/clamp-heading.mjs +25 -0
- package/es/_utils/markdown/rulers/equals-divider.d.ts +2 -0
- package/es/_utils/markdown/rulers/equals-divider.mjs +19 -0
- package/es/_utils/markdown/rulers/prune-empty-blocks.d.ts +2 -0
- package/es/_utils/markdown/rulers/prune-empty-blocks.mjs +31 -0
- package/es/_utils/markdown/rulers/strikethrough.d.ts +3 -0
- package/es/_utils/markdown/rulers/strikethrough.mjs +38 -0
- package/es/_utils/markdown/rulers/strip-html.d.ts +2 -0
- package/es/_utils/markdown/rulers/strip-html.mjs +7 -0
- package/es/chat/src/Chat.d.ts +515 -23
- package/es/chat/src/Chat.mjs +2 -0
- package/es/chat/src/ChatListItems.d.ts +172 -4
- package/es/chat/src/ChatListItems.mjs +3 -2
- package/es/chat/src/ChatMainArea.d.ts +200 -5
- package/es/chat/src/ChatMainArea.mjs +27 -13
- package/es/chat/src/ChatMessages.d.ts +198 -3
- package/es/chat/src/ChatMessages.mjs +20 -2
- package/es/chat/src/ChatParts/Sidebar.d.ts +28 -0
- package/es/chat/src/interface.d.ts +56 -0
- package/es/chat/src/interface.mjs +8 -0
- package/es/chat/styles/dark.d.ts +14 -0
- package/es/chat/styles/light.d.ts +19 -0
- package/es/chat/styles/light.mjs +5 -0
- package/es/components.d.ts +1396 -418
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +1 -1
- package/es/data-table/src/TableParts/Header.mjs +1 -1
- package/es/data-table/src/use-sorter.d.ts +2 -5
- package/es/data-table/src/use-table-data.d.ts +1 -4
- package/es/layout/src/LayoutSider.d.ts +1 -1
- package/es/message-bubble/index.d.ts +1 -0
- package/es/message-bubble/src/MessageBubble.d.ts +78 -6
- package/es/message-bubble/src/MessageBubble.mjs +49 -7
- package/es/message-bubble/src/interface.d.ts +36 -0
- package/es/message-bubble/src/interface.mjs +8 -0
- package/es/message-bubble/src/styles/index.cssr.mjs +17 -1
- package/es/message-bubble/styles/dark.d.ts +9 -0
- package/es/message-bubble/styles/light.d.ts +18 -0
- package/es/message-bubble/styles/light.mjs +10 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_utils/markdown/constants.d.ts +27 -0
- package/lib/_utils/markdown/constants.js +55 -0
- package/lib/_utils/markdown/create-markdown-renderer.d.ts +3 -0
- package/lib/_utils/markdown/create-markdown-renderer.js +84 -0
- package/lib/_utils/markdown/index.d.ts +2 -0
- package/lib/_utils/markdown/index.js +6 -0
- package/lib/_utils/markdown/interface.d.ts +14 -0
- package/lib/_utils/markdown/interface.js +10 -0
- package/lib/_utils/markdown/render-markdown.d.ts +3 -0
- package/lib/_utils/markdown/render-markdown.js +38 -0
- package/lib/_utils/markdown/rulers/clamp-heading.d.ts +2 -0
- package/lib/_utils/markdown/rulers/clamp-heading.js +30 -0
- package/lib/_utils/markdown/rulers/equals-divider.d.ts +2 -0
- package/lib/_utils/markdown/rulers/equals-divider.js +28 -0
- package/lib/_utils/markdown/rulers/prune-empty-blocks.d.ts +2 -0
- package/lib/_utils/markdown/rulers/prune-empty-blocks.js +40 -0
- package/lib/_utils/markdown/rulers/strikethrough.d.ts +3 -0
- package/lib/_utils/markdown/rulers/strikethrough.js +43 -0
- package/lib/_utils/markdown/rulers/strip-html.d.ts +2 -0
- package/lib/_utils/markdown/rulers/strip-html.js +15 -0
- package/lib/chat/src/Chat.d.ts +515 -23
- package/lib/chat/src/Chat.js +2 -0
- package/lib/chat/src/ChatListItems.d.ts +172 -4
- package/lib/chat/src/ChatListItems.js +7 -2
- package/lib/chat/src/ChatMainArea.d.ts +200 -5
- package/lib/chat/src/ChatMainArea.js +26 -14
- package/lib/chat/src/ChatMessages.d.ts +198 -3
- package/lib/chat/src/ChatMessages.js +11 -4
- package/lib/chat/src/ChatParts/Sidebar.d.ts +28 -0
- package/lib/chat/src/interface.d.ts +56 -0
- package/lib/chat/src/interface.js +6 -0
- package/lib/chat/styles/dark.d.ts +14 -0
- package/lib/chat/styles/light.d.ts +19 -0
- package/lib/chat/styles/light.js +5 -0
- package/lib/components.d.ts +1014 -36
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +1 -1
- package/lib/data-table/src/TableParts/Header.js +1 -1
- package/lib/data-table/src/use-sorter.d.ts +2 -5
- package/lib/data-table/src/use-table-data.d.ts +1 -4
- package/lib/layout/src/LayoutSider.d.ts +1 -1
- package/lib/message-bubble/index.d.ts +1 -0
- package/lib/message-bubble/src/MessageBubble.d.ts +78 -6
- package/lib/message-bubble/src/MessageBubble.js +39 -7
- package/lib/message-bubble/src/interface.d.ts +36 -0
- package/lib/message-bubble/src/interface.js +6 -0
- package/lib/message-bubble/src/styles/index.cssr.js +17 -1
- package/lib/message-bubble/styles/dark.d.ts +9 -0
- package/lib/message-bubble/styles/light.d.ts +18 -0
- package/lib/message-bubble/styles/light.js +10 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -1
- package/web-types.json +29 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createMarkdownRenderer = createMarkdownRenderer;
|
|
7
|
+
const markdown_it_1 = __importDefault(require("markdown-it"));
|
|
8
|
+
const clamp_heading_1 = __importDefault(require("./rulers/clamp-heading"));
|
|
9
|
+
const equals_divider_1 = __importDefault(require("./rulers/equals-divider"));
|
|
10
|
+
const prune_empty_blocks_1 = __importDefault(require("./rulers/prune-empty-blocks"));
|
|
11
|
+
const strikethrough_1 = __importDefault(require("./rulers/strikethrough"));
|
|
12
|
+
const strip_html_1 = __importDefault(require("./rulers/strip-html"));
|
|
13
|
+
function applyFeatureRendererOverrides(md, enabled) {
|
|
14
|
+
const unwrap = () => '';
|
|
15
|
+
if (!enabled.has('bold')) {
|
|
16
|
+
md.renderer.rules.strong_open = unwrap;
|
|
17
|
+
md.renderer.rules.strong_close = unwrap;
|
|
18
|
+
}
|
|
19
|
+
if (!enabled.has('italic')) {
|
|
20
|
+
md.renderer.rules.em_open = unwrap;
|
|
21
|
+
md.renderer.rules.em_close = unwrap;
|
|
22
|
+
}
|
|
23
|
+
if (!enabled.has('strikethrough')) {
|
|
24
|
+
md.renderer.rules.s_open = unwrap;
|
|
25
|
+
md.renderer.rules.s_close = unwrap;
|
|
26
|
+
}
|
|
27
|
+
if (!enabled.has('blockquote')) {
|
|
28
|
+
md.renderer.rules.blockquote_open = unwrap;
|
|
29
|
+
md.renderer.rules.blockquote_close = unwrap;
|
|
30
|
+
}
|
|
31
|
+
if (!enabled.has('orderedList')) {
|
|
32
|
+
md.renderer.rules.ordered_list_open = unwrap;
|
|
33
|
+
md.renderer.rules.ordered_list_close = unwrap;
|
|
34
|
+
}
|
|
35
|
+
if (!enabled.has('bulletList')) {
|
|
36
|
+
md.renderer.rules.bullet_list_open = unwrap;
|
|
37
|
+
md.renderer.rules.bullet_list_close = unwrap;
|
|
38
|
+
}
|
|
39
|
+
if (!enabled.has('divider')) {
|
|
40
|
+
md.renderer.rules.hr = unwrap;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function createMarkdownRenderer(resolved) {
|
|
44
|
+
const enabled = new Set(resolved.features);
|
|
45
|
+
const markdown = new markdown_it_1.default('zero', {
|
|
46
|
+
html: false,
|
|
47
|
+
linkify: false,
|
|
48
|
+
breaks: resolved.breaks,
|
|
49
|
+
typographer: false
|
|
50
|
+
});
|
|
51
|
+
markdown.enable([
|
|
52
|
+
'emphasis',
|
|
53
|
+
'strikethrough',
|
|
54
|
+
'heading',
|
|
55
|
+
'list',
|
|
56
|
+
'blockquote',
|
|
57
|
+
'hr',
|
|
58
|
+
'newline',
|
|
59
|
+
'escape',
|
|
60
|
+
'link',
|
|
61
|
+
'image',
|
|
62
|
+
'autolink'
|
|
63
|
+
]);
|
|
64
|
+
markdown.core.ruler.before('normalize', 'u_strip_html', strip_html_1.default);
|
|
65
|
+
markdown.block.ruler.before('paragraph', 'u_equals_divider', equals_divider_1.default, {
|
|
66
|
+
alt: ['paragraph', 'reference', 'blockquote', 'list']
|
|
67
|
+
});
|
|
68
|
+
markdown.inline.ruler.before('strikethrough', 'u_strikethrough', strikethrough_1.default);
|
|
69
|
+
if (!enabled.has('heading')) {
|
|
70
|
+
markdown.disable('heading');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
markdown.core.ruler.after('block', 'u_clamp_heading', (0, clamp_heading_1.default)(resolved.maxHeadingLevel));
|
|
74
|
+
}
|
|
75
|
+
markdown.core.ruler.push('u_prune_empty_blocks', prune_empty_blocks_1.default);
|
|
76
|
+
markdown.validateLink = () => true;
|
|
77
|
+
markdown.renderer.rules.link_open = () => '';
|
|
78
|
+
markdown.renderer.rules.link_close = () => '';
|
|
79
|
+
markdown.renderer.rules.image = () => '';
|
|
80
|
+
markdown.renderer.rules.html_block = () => '';
|
|
81
|
+
markdown.renderer.rules.html_inline = () => '';
|
|
82
|
+
applyFeatureRendererOverrides(markdown, enabled);
|
|
83
|
+
return markdown;
|
|
84
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeMarkdown = exports.renderMarkdown = void 0;
|
|
4
|
+
var render_markdown_1 = require("./render-markdown");
|
|
5
|
+
Object.defineProperty(exports, "renderMarkdown", { enumerable: true, get: function () { return render_markdown_1.renderMarkdown; } });
|
|
6
|
+
Object.defineProperty(exports, "sanitizeMarkdown", { enumerable: true, get: function () { return render_markdown_1.sanitizeMarkdown; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum TOKEN_TYPE {
|
|
2
|
+
HEADING_OPEN = "heading_open",
|
|
3
|
+
HEADING_CLOSE = "heading_close",
|
|
4
|
+
PARAGRAPH_OPEN = "paragraph_open",
|
|
5
|
+
PARAGRAPH_CLOSE = "paragraph_close"
|
|
6
|
+
}
|
|
7
|
+
export interface MarkdownOptions {
|
|
8
|
+
features?: MarkdownFeature[];
|
|
9
|
+
maxHeadingLevel?: number;
|
|
10
|
+
breaks?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedMarkdownOptions extends Required<MarkdownOptions> {
|
|
13
|
+
}
|
|
14
|
+
export type MarkdownFeature = 'bold' | 'italic' | 'strikethrough' | 'heading' | 'orderedList' | 'bulletList' | 'blockquote' | 'divider';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOKEN_TYPE = void 0;
|
|
4
|
+
var TOKEN_TYPE;
|
|
5
|
+
(function (TOKEN_TYPE) {
|
|
6
|
+
TOKEN_TYPE["HEADING_OPEN"] = "heading_open";
|
|
7
|
+
TOKEN_TYPE["HEADING_CLOSE"] = "heading_close";
|
|
8
|
+
TOKEN_TYPE["PARAGRAPH_OPEN"] = "paragraph_open";
|
|
9
|
+
TOKEN_TYPE["PARAGRAPH_CLOSE"] = "paragraph_close";
|
|
10
|
+
})(TOKEN_TYPE || (exports.TOKEN_TYPE = TOKEN_TYPE = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMarkdown = renderMarkdown;
|
|
4
|
+
exports.sanitizeMarkdown = sanitizeMarkdown;
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const create_markdown_renderer_1 = require("./create-markdown-renderer");
|
|
7
|
+
const rendererCache = new Map();
|
|
8
|
+
function normalizeOptions(options) {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
return {
|
|
11
|
+
features: [...((_a = options === null || options === void 0 ? void 0 : options.features) !== null && _a !== void 0 ? _a : constants_1.ALL_MARKDOWN_FEATURES)],
|
|
12
|
+
maxHeadingLevel: Math.min(constants_1.MAX_HEADING_LEVEL, Math.max(1, (_b = options === null || options === void 0 ? void 0 : options.maxHeadingLevel) !== null && _b !== void 0 ? _b : constants_1.MAX_HEADING_LEVEL)),
|
|
13
|
+
breaks: (_c = options === null || options === void 0 ? void 0 : options.breaks) !== null && _c !== void 0 ? _c : true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getMarkdownRenderer(options) {
|
|
17
|
+
const normalizedOptions = normalizeOptions(options);
|
|
18
|
+
const instance = rendererCache.get(normalizedOptions);
|
|
19
|
+
if (!instance) {
|
|
20
|
+
const renderer = (0, create_markdown_renderer_1.createMarkdownRenderer)(normalizedOptions);
|
|
21
|
+
rendererCache.set(normalizedOptions, renderer);
|
|
22
|
+
return renderer;
|
|
23
|
+
}
|
|
24
|
+
return instance;
|
|
25
|
+
}
|
|
26
|
+
function renderMarkdown(content, options) {
|
|
27
|
+
if (!content)
|
|
28
|
+
return '';
|
|
29
|
+
return getMarkdownRenderer(options).render(content).trim();
|
|
30
|
+
}
|
|
31
|
+
function sanitizeMarkdown(content, options) {
|
|
32
|
+
if (!content)
|
|
33
|
+
return '';
|
|
34
|
+
let text = renderMarkdown(content, options).replace(constants_1.ANY_HTML_TAG_REGEX, ' ');
|
|
35
|
+
for (const [pattern, replacement] of constants_1.HTML_ENTITY_REPLACEMENTS)
|
|
36
|
+
text = text.replace(pattern, replacement);
|
|
37
|
+
return text.replace(constants_1.WHITESPACE_REGEX, ' ').trim();
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createClampHeadingRule;
|
|
4
|
+
const interface_1 = require("../interface");
|
|
5
|
+
function toParagraph(token, type) {
|
|
6
|
+
token.type = type;
|
|
7
|
+
token.tag = 'p';
|
|
8
|
+
token.markup = '';
|
|
9
|
+
}
|
|
10
|
+
function createClampHeadingRule(maxLevel) {
|
|
11
|
+
return (state) => {
|
|
12
|
+
for (let index = 0; index < state.tokens.length; index++) {
|
|
13
|
+
const openToken = state.tokens[index];
|
|
14
|
+
if (openToken.type !== interface_1.TOKEN_TYPE.HEADING_OPEN)
|
|
15
|
+
continue;
|
|
16
|
+
const level = Number(openToken.tag.slice(1));
|
|
17
|
+
if (!Number.isFinite(level) || level <= maxLevel)
|
|
18
|
+
continue;
|
|
19
|
+
const inlineToken = state.tokens[index + 1];
|
|
20
|
+
const closeToken = state.tokens[index + 2];
|
|
21
|
+
toParagraph(openToken, interface_1.TOKEN_TYPE.PARAGRAPH_OPEN);
|
|
22
|
+
if ((closeToken === null || closeToken === void 0 ? void 0 : closeToken.type) === interface_1.TOKEN_TYPE.HEADING_CLOSE) {
|
|
23
|
+
toParagraph(closeToken, interface_1.TOKEN_TYPE.PARAGRAPH_CLOSE);
|
|
24
|
+
}
|
|
25
|
+
if ((inlineToken === null || inlineToken === void 0 ? void 0 : inlineToken.type) === 'inline') {
|
|
26
|
+
inlineToken.content = `${'#'.repeat(level)} ${inlineToken.content}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = equalsDivider;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function equalsDivider(state, startLine, endLine, silent) {
|
|
6
|
+
if (state.sCount[startLine] - state.blkIndent >= constants_1.MAX_DIVIDER_INDENT)
|
|
7
|
+
return false;
|
|
8
|
+
let position = state.bMarks[startLine] + state.tShift[startLine];
|
|
9
|
+
const max = state.eMarks[startLine];
|
|
10
|
+
let count = 0;
|
|
11
|
+
while (position < max) {
|
|
12
|
+
const charCode = state.src.charCodeAt(position);
|
|
13
|
+
if (charCode === constants_1.CHAR_CODES.EQUALS)
|
|
14
|
+
count++;
|
|
15
|
+
else if (charCode !== constants_1.CHAR_CODES.SPACE && charCode !== constants_1.CHAR_CODES.TAB)
|
|
16
|
+
return false;
|
|
17
|
+
position++;
|
|
18
|
+
}
|
|
19
|
+
if (count < constants_1.MIN_DIVIDER_MARKERS)
|
|
20
|
+
return false;
|
|
21
|
+
if (silent)
|
|
22
|
+
return true;
|
|
23
|
+
state.line = startLine + 1;
|
|
24
|
+
const token = state.push('hr', 'hr', 0);
|
|
25
|
+
token.map = [startLine, state.line];
|
|
26
|
+
token.markup = '='.repeat(count);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = pruneEmptyBlocksCoreRule;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const interface_1 = require("../interface");
|
|
6
|
+
function inlineHasVisibleContent(children) {
|
|
7
|
+
if (!children || children.length === 0)
|
|
8
|
+
return false;
|
|
9
|
+
for (const child of children) {
|
|
10
|
+
if (child.type === 'text') {
|
|
11
|
+
if (child.content.trim().length > 0)
|
|
12
|
+
return true;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (!constants_1.INVISIBLE_INLINE_TOKEN_TYPES.includes(child.type))
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function pruneEmptyBlocksCoreRule(state) {
|
|
21
|
+
const { tokens } = state;
|
|
22
|
+
for (let index = 0; index < tokens.length; index++) {
|
|
23
|
+
const openToken = tokens[index];
|
|
24
|
+
const isPrunableBlock = openToken.type === interface_1.TOKEN_TYPE.PARAGRAPH_OPEN
|
|
25
|
+
|| openToken.type === interface_1.TOKEN_TYPE.HEADING_OPEN;
|
|
26
|
+
if (!isPrunableBlock)
|
|
27
|
+
continue;
|
|
28
|
+
const inlineToken = tokens[index + 1];
|
|
29
|
+
const closeToken = tokens[index + 2];
|
|
30
|
+
const closeType = openToken.type === interface_1.TOKEN_TYPE.PARAGRAPH_OPEN
|
|
31
|
+
? interface_1.TOKEN_TYPE.PARAGRAPH_CLOSE
|
|
32
|
+
: interface_1.TOKEN_TYPE.HEADING_CLOSE;
|
|
33
|
+
if ((inlineToken === null || inlineToken === void 0 ? void 0 : inlineToken.type) !== 'inline' || (closeToken === null || closeToken === void 0 ? void 0 : closeToken.type) !== closeType)
|
|
34
|
+
continue;
|
|
35
|
+
if (!inlineHasVisibleContent(inlineToken.children)) {
|
|
36
|
+
tokens.splice(index, constants_1.EMPTY_BLOCK_TOKEN_COUNT);
|
|
37
|
+
index -= 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../constants");
|
|
4
|
+
function strikethroughInlineRule(state, silent) {
|
|
5
|
+
const max = state.posMax;
|
|
6
|
+
const start = state.pos;
|
|
7
|
+
if (state.src.charCodeAt(start) !== constants_1.CHAR_CODES.TILDE)
|
|
8
|
+
return false;
|
|
9
|
+
if (silent)
|
|
10
|
+
return false;
|
|
11
|
+
if (start + 2 >= max)
|
|
12
|
+
return false;
|
|
13
|
+
state.pos = start + 1;
|
|
14
|
+
let found = false;
|
|
15
|
+
while (state.pos < max) {
|
|
16
|
+
if (state.src.charCodeAt(state.pos) === constants_1.CHAR_CODES.TILDE) {
|
|
17
|
+
found = true;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
state.md.inline.skipToken(state);
|
|
21
|
+
}
|
|
22
|
+
if (!found || start + 1 === state.pos) {
|
|
23
|
+
state.pos = start;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const content = state.src.slice(start + 1, state.pos);
|
|
27
|
+
if (content.includes(constants_1.MARKDOWN_SYMBOL.NEWLINE)) {
|
|
28
|
+
state.pos = start;
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
state.posMax = state.pos;
|
|
32
|
+
state.pos = start + 1;
|
|
33
|
+
let token = state.push('s_open', constants_1.MARKDOWN_SYMBOL.STRIKETHROUGH_TAG, 1);
|
|
34
|
+
token.markup = constants_1.MARKDOWN_SYMBOL.TILDE;
|
|
35
|
+
token = state.push('text', '', 0);
|
|
36
|
+
token.content = content.replace(/\\(.)/g, '$1');
|
|
37
|
+
token = state.push('s_close', constants_1.MARKDOWN_SYMBOL.STRIKETHROUGH_TAG, -1);
|
|
38
|
+
token.markup = constants_1.MARKDOWN_SYMBOL.TILDE;
|
|
39
|
+
state.pos = state.posMax + 1;
|
|
40
|
+
state.posMax = max;
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
exports.default = strikethroughInlineRule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = stripHtmlCoreRule;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function stripHtml(source) {
|
|
6
|
+
return source
|
|
7
|
+
.replace(constants_1.HTML_COMMENT_REGEX, '')
|
|
8
|
+
.replace(constants_1.HTML_CDATA_REGEX, '')
|
|
9
|
+
.replace(constants_1.HTML_RAW_BLOCK_REGEX, '')
|
|
10
|
+
.replace(constants_1.HTML_DECLARATION_REGEX, '')
|
|
11
|
+
.replace(constants_1.HTML_TAG_REGEX, '');
|
|
12
|
+
}
|
|
13
|
+
function stripHtmlCoreRule(state) {
|
|
14
|
+
state.src = stripHtml(state.src);
|
|
15
|
+
}
|