Repository navigation
BidiLens: an MIT toolkit and corpus for mixed RTL/LTR AI output #35557
CodeinScrubs
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I maintain BidiLens, a new MIT-licensed toolkit for a recurring AI-interface problem: text is logically correct in the model output, but mixed RTL/LTR prose is displayed in the wrong visual order.
A compact example is:
Reactis logically word 1, the Persian sentence follows it, and the period should appear at the visual left edge. Common first-strong solutions (dir="auto"andunicode-bidi: plaintext) seeReactand choose an LTR paragraph base. A global RTL rule has the opposite regression on English-majority messages, code, paths, and controls.BidiLens uses a host-adaptable policy:
The v0.1.1 release includes 12 focused packages covering core analysis, DOM, React, Vue, Svelte, Web Components, Markdown, HTML, terminal output, CLI, a shared spec, and Playwright verification. The repository includes 918 schema-validated direction fixtures and documents security, accessibility, performance, migration, and remaining limitations.
This is not a claim that one JavaScript package belongs everywhere. In a Rust terminal host such as the Codex CLI, the corpus and policy may be more useful than the runtime package; UAX #9, grapheme/style mapping, shaping, and terminal capabilities need a native design. In a browser/webview, the DOM/React adapters can be integrated at the render boundary without changing stored conversations or model output.
Current integration evidence:
I would value review from Codex renderer/i18n maintainers and users of Persian, Arabic, Hebrew, Urdu, Kurdish, and other RTL scripts. I am happy to prepare a focused patch against any public renderer component the team identifies.
Known limits are stated rather than hidden: native-speaker review of the generated technical corpus is still pending; terminal shaping depends on host capabilities; and no renderer can reconstruct source that was already corrupted or stored in visual order.
Maintainer disclosure: I am the BidiLens maintainer. This is an invitation to review and pilot an independent open-source project, not an OpenAI endorsement.
All reactions