]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/blob
0a8b93ad547207d6ed71e840feee0391f7792f86
[pkg/ggml/sources/llama.cpp] /
1 /**
2 * Rehype plugin to provide comprehensive RTL support by adding dir="auto"
3 * to all text-containing elements.
4 *
5 * This operates directly on the HAST tree, ensuring that all elements
6 * (including those not in a predefined list) receive the attribute.
7 */
8
9 import type { Plugin } from 'unified';
10 import type { Root, Element } from 'hast';
11 import { visit } from 'unist-util-visit';
12
13 /**
14 * Rehype plugin to add dir="auto" to all elements that have children.
15 * This provides bidirectional text support for mixed RTL/LTR content.
16 */
17 export const rehypeRtlSupport: Plugin<[], Root> = () => {
18 return (tree: Root) => {
19 visit(tree, 'element', (node: Element) => {
20 if (node.children && node.children.length > 0) {
21 node.properties = {
22 ...node.properties,
23 dir: 'auto'
24 };
25 }
26 });
27 };
28 };