Skip to content

Show Arabic and Hebrew replies right-to-left while code and paths stay left-to-right - #1996

Merged
currentbits merged 2 commits into
mainfrom
coder/readable-mixed-rtl-markdown
Nov 11, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/readable-mixed-rtl-markdown

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Agent replies mixing Arabic or Hebrew with English now read in the right direction. Each paragraph, list, quote and table takes its direction from its first real letter, and inline code, code blocks, file paths and bare URLs stay left-to-right. Closes #1939.

Changes

  • Paragraphs, headings and table cells use the browser's own first-letter rule (dir="auto").
  • Lists, blockquotes and tables get their direction from a small first-letter check that skips code (blockDir). The browser rule ignores children that carry their own dir, which left Arabic quotes with the bar on the left and Arabic tables with columns in LTR order.
  • Inline code, fences, path links, thread-id links and bare URLs are marked dir="ltr", so they stay intact and don't decide the paragraph's direction. A reply starting with `src/app.ts` followed by Arabic still reads right-to-left.
  • List indent, quote bar and cell alignment use logical CSS properties so they flip with direction.

Verification

  • tsc --noEmit clean, vite build passes, npm run test:renderer: 3963 pass, 0 fail. New tests cover direction attributes, code being skipped, list start and task-list class surviving.
  • jsdom doesn't compute dir="auto", so I rendered 9 fixtures (mixed punctuation, inline code and paths, Hebrew with path + URL, English with Arabic/Hebrew words, RTL lists with links, ordered list, blockquote, table, code block) in headless Chromium. All render correctly.
  • Not tested: the live Electron app with real Arabic/Hebrew agent output.

Notes for reviewers

  • A list takes one direction for all its items (the first item's), so markers and indent stay on one side.
  • File paths that don't resolve to a real file stay plain text and can still set a paragraph's direction if they come first.

claude-opus-5-5 via Claude Code

🤖 Generated with Claude Code

#1939)

Text blocks take dir=auto; lists, quotes and tables resolve first-strong
direction skipping code; inline code, fences, path links and bare URLs
stay left-to-right.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:10:50.563680Z a3d5ba7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3d5ba79ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +356 to +359
if (node.tagName === "code" || node.tagName === "pre") return "auto";
for (const child of node.children ?? []) {
const dir = blockDir(child);
if (dir !== "auto") return dir;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip isolated bare URLs when determining container direction

For Arabic or Hebrew content beginning with a bare URL, such as > https://example.com ثم راجع التعليمات, blockDir descends into the link and returns ltr from its URL text. However, MarkdownLink now gives that same link dir="ltr", so the paragraph's browser-driven direction scan skips it and resolves to RTL. This leaves the quote bar on the wrong side; the same issue puts list markers and table columns in LTR order when their first content is a URL followed by RTL prose. Exclude bare-URL anchors from the container scan, consistently with their rendered isolation.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit d66e192 into main Nov 11, 2026
14 checks passed
@currentbits
currentbits deleted the coder/readable-mixed-rtl-markdown branch November 11, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Readable mixed Arabic/English and Hebrew/English paragraphs

1 participant