UNPKG

@lobehub/ui

Version:

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

1 lines 698 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// eslint-disable-next-line unicorn/consistent-function-scoping\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;AAClD,OAAM,MAAM,YAAY,SAAc;AACpC,MAAI,KAAK,YAAY,WAAW,SAAS,QAAQ,CAC/C,MAAK,WAAW,MAAM;GAExB"}