@djangocfg/ui-tools 2.1.92 → 2.1.94

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.mjs CHANGED
@@ -4900,6 +4900,9 @@ var createMarkdownComponents = /* @__PURE__ */ __name((isUser = false, isCompact
4900
4900
  };
4901
4901
  }, "createMarkdownComponents");
4902
4902
  var hasMarkdownSyntax = /* @__PURE__ */ __name((text) => {
4903
+ if (text.trim().includes("\n")) {
4904
+ return true;
4905
+ }
4903
4906
  const markdownPatterns = [
4904
4907
  /^#{1,6}\s/m,
4905
4908
  // Headers
@@ -4940,12 +4943,13 @@ var MarkdownMessage = /* @__PURE__ */ __name(({
4940
4943
  isUser = false,
4941
4944
  isCompact = false
4942
4945
  }) => {
4946
+ const trimmedContent = content.trim();
4943
4947
  const components = React17.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
4944
4948
  const textSizeClass = isCompact ? "text-xs" : "text-sm";
4945
4949
  const proseClass = isCompact ? "prose-xs" : "prose-sm";
4946
- const isPlainText = !hasMarkdownSyntax(content);
4950
+ const isPlainText = !hasMarkdownSyntax(trimmedContent);
4947
4951
  if (isPlainText) {
4948
- return /* @__PURE__ */ jsx("span", { className: `${textSizeClass} leading-relaxed break-words ${className}`, children: content });
4952
+ return /* @__PURE__ */ jsx("span", { className: `${textSizeClass} leading-relaxed break-words ${className}`, children: trimmedContent });
4949
4953
  }
4950
4954
  return /* @__PURE__ */ jsx(
4951
4955
  "div",
@@ -4968,7 +4972,7 @@ var MarkdownMessage = /* @__PURE__ */ __name(({
4968
4972
  {
4969
4973
  remarkPlugins: [remarkGfm],
4970
4974
  components,
4971
- children: content
4975
+ children: trimmedContent
4972
4976
  }
4973
4977
  )
4974
4978
  }