-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
💥 feat: force code blocks LTR rendering #412
Conversation
@TheAwiteb I'd appreciate it if you could take a look and share your thoughts here |
✅ Deploy Preview for tabi-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I agree with |
Also, I don't think there is a need for it. There is no need to hard code the direction. You can add a div with the direction you want before the code block.
|
fdee8fb
to
ed8097f
Compare
Thanks for your thoughts, @TheAwiteb! I think it makes sense to support the most common use cases, both for RTL and LTR users. Would it be fair to assume more than half of the time, the author of a page will want LTR code block? The To me, forcing code blocks to LTR but not inline code makes sense. Thoughts, @mohammad-amin-khajeh? |
If you force it in CSS I don't think you can make it RTL right? So the |
You're right. I'm thinking of:
Would love your thoughts, @TheAwiteb @mohammad-amin-khajeh |
For me, this is better
Not all code blocks in a post need to be RTL, it can be both, LTR and RTL |
I feel like this will get repetitive and tedious quickly, because most people I assume(writing in an rtl language that is) would want to have their codeblocks ltr. I suggest making codeblocks ltr by default, while also having a shortcode that behaves like |
How about:
|
Shortcode looks better, something like this
|
I will add the shortcode. Would a default LTR codeblock setting make sense / satisfy most users? Again, with the option to unset / override for the whole site/section/specific page. Essentially, the question is: would most RTL website owners expect their codeblocks to be LTR by default? |
I can't speak of everyone here. But I don't think I personally will ever change it to RTL if it were LTR by default. So to me it makes total sense if LTR was the default. |
Yes |
ed8097f
to
da5b228
Compare
- Add new config option `force_codeblock_ltr` (default: true) - Implement CSS to force LTR rendering of code blocks when enabled - Update documentation to include new option BREAKING CHANGE: Code blocks default to LTR. Set `force_codeblock_ltr = false` to keep previous behaviour.
da5b228
to
35614b0
Compare
I will review the PR soon. The shortcode(s) to force LTR/RTL will come in another PR. |
- Introduce new `force_text_direction` shortcode - Overrides global `force_codeblock_ltr` setting and document direction - Accepts "ltr" or "rtl" as direction parameter Related: #412
BREAKING CHANGE: Code blocks default to LTR. Set `force_codeblock_ltr = false` to keep previous behaviour.
💥 Breaking change
Code blocks now default to LTR rendering, regardless of the page's text direction. RTL language users who relied on RTL code blocks will need to explicitly set
force_codeblock_ltr = false
to maintain their current behaviour.Summary
Adds a new configuration option
force_codeblock_ltr
to control the text direction of code blocks. When enabled (default), it forces left-to-right (LTR) rendering for all code content, including code blocks and inline code.The setting follows the hierarchy.
Related issue
Fixes #411.
Changes
force_codeblock_ltr
(default: true)Type of change
Checklist
theme.toml
with a sane default for the featureconfig.toml
commentstheme.toml
comments