UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 644 B
{"version":3,"file":"rehypeKatexDir.mjs","names":[],"sources":["../../../src/Markdown/plugins/rehypeKatexDir.ts"],"sourcesContent":["import type { Node } from 'unist';\nimport { visit } from 'unist-util-visit';\n\n// katex-directive\n// 给 class=\"katex\" 的节点加上 dir=\"ltr\" 属性\n\nexport const rehypeKatexDir = () => (tree: Node) => {\n visit(tree, 'element', (node: any) => {\n if (node.properties?.className?.includes('katex')) {\n node.properties.dir = 'ltr';\n }\n });\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB,SAAe;CAClD,MAAM,MAAM,YAAY,SAAc;EACpC,IAAI,KAAK,YAAY,WAAW,SAAS,OAAO,GAC9C,KAAK,WAAW,MAAM;CAE1B,CAAC;AACH"}