-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(ui): support bidirectional chat markdown #11944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mjnaderi
wants to merge
5
commits into
Kilo-Org:main
Choose a base branch
from
mjnaderi:fix-chat-bidi-markdown
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5730d1
fix(ui): support bidirectional chat markdown
mjnaderi a8bb361
fix(ui): address bidi markdown review feedback
mjnaderi 47eb5a1
fix(ui): distinguish user message bubbles
mjnaderi 0ea9d14
fix(ui): simplify markdown bidi direction
mjnaderi 3df328a
fix(ui): isolate markdown math direction
mjnaderi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "kilo-code": patch | ||
| --- | ||
|
|
||
| Support bidirectional text in chat messages so right-to-left and mixed-language conversations render in the correct direction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Single
dir="auto"on the outer container defeats per-block bidi resolution for mixed-language contentThis commit removes
markBidiand its per-blockdir="auto"application entirely, replacing it with onedir="auto"on the root[data-component="markdown"]div. Per the HTMLdir="auto"algorithm, an element's resolved direction is based on the first strongly-directional character found in its subtree (skipping descendants that carry their own explicitdir, e.g. the<code>/<pre>frommarked.tsx). Since paragraphs, headings, blockquotes, lists, and tables no longer carry their owndirattribute, they no longer resolve direction independently — they simply inherit the single direction computed once for the whole container from whichever text happens to come first.This directly undoes the goal described in this PR ("Persian/Arabic/Hebrew paragraphs render RTL and English paragraphs render LTR" within the same mixed-language message, per the reviewer test steps). A message with an English paragraph followed by a Persian paragraph will now render both with the same (English-first) direction, and the blockquote/list/table logical-property CSS in
markdown.css(border-inline-start,padding-inline-start,text-align: start) will follow that single inherited direction rather than each block's own content — the exact failure mode the deletedmarkBidicomment warned about, just inverted (now under-marking instead of over-marking).Worth reconsidering per-top-level-block
dir="auto"(asmarkBididid) rather than a single container-level attribute, or confirming this tradeoff was intentional for the mixed-content case.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.