@lobehub/ui 2.9.0 → 2.9.1

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
- var brRegex = /<\s*br\s*\/?>/gi;
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;
@@ -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 [remarkBr].concat(_toConsumableArray(remarkPluginsAhead), _toConsumableArray(memoPlugins), _toConsumableArray(remarkPlugins));
33
+ return [].concat(_toConsumableArray(remarkPluginsAhead), _toConsumableArray(memoPlugins), _toConsumableArray(remarkPlugins));
33
34
  }, [remarkPlugins, memoPlugins, remarkPluginsAhead]);
34
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",