@lobehub/ui 1.164.6 → 1.164.7

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.
@@ -28,6 +28,7 @@ import Link from "../mdx/mdxComponents/Link";
28
28
  import Video from "../mdx/mdxComponents/Video";
29
29
  import { CodeFullFeatured, CodeLite } from "./CodeBlock";
30
30
  import { useStyles as useMarkdownStyles } from "./markdown.style";
31
+ import { rehypeKatexDir } from "./rehypePlugin";
31
32
  import { useStyles } from "./style";
32
33
  import { escapeBrackets, escapeMhchem, fixMarkdownBold } from "./utils";
33
34
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -108,7 +109,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
108
109
  }, [].concat(_toConsumableArray(Object.values(components || {})), _toConsumableArray(Object.values(componentProps || {})), [enableImageGallery, enableMermaid, fullFeaturedCodeBlock]));
109
110
  var innerRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : [rehypePlugins];
110
111
  var memoRehypePlugins = useMemo(function () {
111
- return [allowHtml && rehypeRaw, enableLatex && rehypeKatex].concat(_toConsumableArray(innerRehypePlugins)).filter(Boolean);
112
+ return [allowHtml && rehypeRaw, enableLatex && rehypeKatex, enableLatex && rehypeKatexDir].concat(_toConsumableArray(innerRehypePlugins)).filter(Boolean);
112
113
  }, [allowHtml, enableLatex].concat(_toConsumableArray(innerRehypePlugins)));
113
114
  var innerRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : [remarkPlugins];
114
115
  var memoRemarkPlugins = useMemo(function () {
@@ -0,0 +1,2 @@
1
+ import type { Node } from 'unist';
2
+ export declare const rehypeKatexDir: () => (tree: Node) => void;
@@ -0,0 +1,16 @@
1
+ // katex-directive
2
+ // 给 class="katex" 的节点加上 dir="ltr" 属性
3
+
4
+ import { visit } from 'unist-util-visit';
5
+
6
+ // eslint-disable-next-line unicorn/consistent-function-scoping
7
+ export var rehypeKatexDir = function rehypeKatexDir() {
8
+ return function (tree) {
9
+ visit(tree, 'element', function (node) {
10
+ var _node$properties;
11
+ if ((_node$properties = node.properties) !== null && _node$properties !== void 0 && (_node$properties = _node$properties.className) !== null && _node$properties !== void 0 && _node$properties.includes('katex')) {
12
+ node.properties.dir = 'ltr';
13
+ }
14
+ });
15
+ };
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.164.6",
3
+ "version": "1.164.7",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",