@lobehub/ui 2.9.0 → 2.9.2
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.
|
@@ -14,12 +14,13 @@ import { visit } from 'unist-util-visit';
|
|
|
14
14
|
*/
|
|
15
15
|
export var remarkBr = function remarkBr() {
|
|
16
16
|
return function (tree) {
|
|
17
|
-
// First try to process html nodes that might contain br tags
|
|
17
|
+
// First try to process html nodes that might contain ONLY br tags
|
|
18
18
|
visit(tree, 'html', function (node, index, parent) {
|
|
19
19
|
if (!node.value || typeof node.value !== 'string') return;
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
// Only handle standalone br tags, not complex HTML containing br tags
|
|
22
|
+
var brRegex = /^\s*<\s*br\s*\/?>\s*$/gi;
|
|
21
23
|
if (brRegex.test(node.value)) {
|
|
22
|
-
console.log('Found br tag in HTML node:', node.value);
|
|
23
24
|
// Replace the html node with a break node
|
|
24
25
|
parent.children.splice(index, 1, {
|
|
25
26
|
type: 'break'
|
|
@@ -37,7 +38,6 @@ export var remarkBr = function remarkBr() {
|
|
|
37
38
|
// Check if the text contains <br> or <br/> tags
|
|
38
39
|
var brRegex = /<\s*br\s*\/?>/gi;
|
|
39
40
|
if (!brRegex.test(node.value)) return;
|
|
40
|
-
console.log('Found br tag in text:', node.value);
|
|
41
41
|
|
|
42
42
|
// Reset regex lastIndex for split operation
|
|
43
43
|
brRegex.lastIndex = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var sage = {
|
|
2
|
-
dark: ['#000000', '#
|
|
3
|
-
darkA: ['rgba(255, 255, 255, 0.02)', 'rgba(236,
|
|
4
|
-
light: ['#ffffff', '#
|
|
5
|
-
lightA: ['rgba(0, 0, 0, 0.015)', 'rgba(
|
|
2
|
+
dark: ['#000000', '#1a1b1c', '#232526', '#2d2f30', '#383a3a', '#424545', '#4d5050', '#585c5c', '#636766', '#6e7371', '#797f7c', '#b5bab6', '#ffffff'],
|
|
3
|
+
darkA: ['rgba(255, 255, 255, 0.02)', 'rgba(236, 246, 255, 0.11)', 'rgba(233, 246, 253, 0.15)', 'rgba(237, 248, 253, 0.19)', 'rgba(243, 252, 252, 0.23)', 'rgba(236, 246, 246, 0.28)', 'rgba(241, 250, 250, 0.32)', 'rgba(238, 249, 249, 0.37)', 'rgba(241, 251, 248, 0.41)', 'rgba(239, 250, 246, 0.46)', 'rgba(242, 254, 248, 0.5)', 'rgba(248, 255, 250, 0.73)', 'rgba(255, 255, 255, 1)'],
|
|
4
|
+
light: ['#ffffff', '#f5faf4', '#e7ece6', '#d7ddd7', '#c9cfc9', '#bbc1bc', '#aeb4b0', '#a0a6a2', '#939996', '#868c89', '#797f7c', '#484b4b', '#111111'],
|
|
5
|
+
lightA: ['rgba(0, 0, 0, 0.015)', 'rgba(55, 155, 35, 0.05)', 'rgba(15, 65, 5, 0.1)', 'rgba(5, 43, 5, 0.16)', 'rgba(10, 37, 10, 0.22)', 'rgba(3, 25, 6, 0.27)', 'rgba(2, 21, 9, 0.32)', 'rgba(5, 21, 10, 0.38)', 'rgba(4, 18, 11, 0.43)', 'rgba(3, 15, 9, 0.48)', 'rgba(2, 13, 7, 0.53)', 'rgba(1, 5, 5, 0.72)', 'rgba(1, 2, 3, 0.9)']
|
|
6
6
|
};
|
|
7
7
|
export default sage;
|
|
@@ -21,14 +21,15 @@ export var useMarkdownRemarkPlugins = function useMarkdownRemarkPlugins() {
|
|
|
21
21
|
remarkPlugins = _useMarkdownContext$r === void 0 ? [] : _useMarkdownContext$r,
|
|
22
22
|
_useMarkdownContext$r2 = _useMarkdownContext.remarkPluginsAhead,
|
|
23
23
|
remarkPluginsAhead = _useMarkdownContext$r2 === void 0 ? [] : _useMarkdownContext$r2,
|
|
24
|
-
variant = _useMarkdownContext.variant
|
|
24
|
+
variant = _useMarkdownContext.variant,
|
|
25
|
+
allowHtml = _useMarkdownContext.allowHtml;
|
|
25
26
|
var isChatMode = variant === 'chat';
|
|
26
27
|
var memoPlugins = useMemo(function () {
|
|
27
|
-
return [[remarkGfm, {
|
|
28
|
+
return [!allowHtml && remarkBr, [remarkGfm, {
|
|
28
29
|
singleTilde: false
|
|
29
30
|
}], enableLatex && remarkMath, enableCustomFootnotes && remarkCustomFootnotes, isChatMode && remarkBreaks].filter(Boolean);
|
|
30
|
-
}, [isChatMode, enableLatex, enableCustomFootnotes]);
|
|
31
|
+
}, [allowHtml, isChatMode, enableLatex, enableCustomFootnotes]);
|
|
31
32
|
return useMemo(function () {
|
|
32
|
-
return [
|
|
33
|
+
return [].concat(_toConsumableArray(remarkPluginsAhead), _toConsumableArray(memoPlugins), _toConsumableArray(remarkPlugins));
|
|
33
34
|
}, [remarkPlugins, memoPlugins, remarkPluginsAhead]);
|
|
34
35
|
};
|