GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: Arabic/Hebrew lines in md/text code fences are forced left-to-right (and coding-font ligatures overprint them) · Issue #42017 · pingdotgg/t3code

[Bug]: Arabic/Hebrew lines in md/text code fences are forced left-to-right (and coding-font ligatures overprint them) #42017

New issue
Copy link
New issue
Copy link
Backlog
Backlog
[Bug]: Arabic/Hebrew lines in md/text code fences are forced left-to-right (and coding-font ligatures overprint them)#42017
Copy link

Description

@zayani
zayani
opened on Nov 24, 2026
Issue body actions

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Chat / Markdown rendering (fenced code blocks)

Steps to reproduce

  1. Have the assistant reply with a prose fence (md, markdown, text or a fence with no language) whose lines are Arabic or Hebrew, for example:

    ```md
    تدخل **كندة** القاعة. الرؤوس تلتفت.
    > **كندة**
    > صباح الخير. اليوم سأغيّر رأيكم.
    ::: **تقاطع مع** :::
    English line stays left.
    ```
    
  2. Look at the rendered block.

Expected behavior

A prose fence is written text, not source code. Each line should get its own direction, so Arabic lines read right to left and right-aligned, and English lines in the same block stay left to right. Real code fences (ts, py, …) should stay LTR as they are now.

Actual behavior

MarkdownCodeBlock puts dir="ltr" on every fence, prose fences included (apps/web/src/components/chat/MarkdownCodeBlock.tsx, the wrapper with className="chat-markdown-codeblock …"). As a result, Arabic lines in a md / text block:

  • end with the full stop on the wrong side (تدخل **كندة** القاعة. shows the . at the left),
  • have **, > and ::: reordered against the words around them,
  • are left-aligned.

A second issue shows up once such a line is RTL: coding fonts with contextual alternates (Fira Code, Cascadia Code…) draw **, --, .. and ::: as ligatures whose glyphs are shifted into the neighbouring cell. That only works left to right. Between Arabic words those glyphs land on the wrong side and overprint the Arabic letters.

Upstream has already fixed this for paragraphs, lists, quotes and inline code (markdownTextDirection.ts, #22777, #26095, #36876). Prose fences are the remaining gap.

Suggested fix

I've been running this as a local CSS patch on the desktop app and it works. Code fences are untouched.

/* Prose fences: each newline-separated line is its own bidi paragraph. */
.chat-markdown-codeblock:is(
  [data-language="md" i], [data-language="markdown" i], [data-language="mdx" i],
  [data-language="text" i], [data-language="txt" i],
  [data-language="plaintext" i], [data-language="plain" i]
) pre {
  unicode-bidi: plaintext;
  text-align: start;
}

/* Coding-font ligatures are drawn assuming LTR and overprint RTL letters. */
.chat-markdown-codeblock:is(/* same list */) pre :is(code, span) {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

unicode-bidi: plaintext on the <pre> treats each line as a separate bidi paragraph. Shiki's .line spans are inline, so they don't get in the way, and text-align: start then follows each line. The fence header (language label, copy button) is outside the <pre> and keeps its LTR layout. Another option is to drop dir="ltr" for these languages and set the direction per line the way markdownTextDirection.ts does for blocks.

Impact

Minor bug or occasional failure

Version or commit

0.1.12-nightly.20261122.5085 (desktop); still present on main at 60682f7

Environment

Windows 11 Pro, desktop app (Electron)

Logs or stack traces

No response

Screenshots, recordings, or supporting files

No response

Workaround

A local CSS injection into the renderer's index.html.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.