al-folio icon indicating copy to clipboard operation
al-folio copied to clipboard

Right to left writting is now possible

Open arashgmn opened this issue 2 years ago • 9 comments

This branch helps the template's internationalization by providing right-to-left (rtl) scripting.

The default layout and all its derivates now automatically change their direction and alignment if a language with right-to-left scripting is specified in the front matter. The feature detects the following right-to-left languages (can be extended in _config.yml):

  • Arabic (ar)
  • Aramaic (arc)
  • Azeri (az)
  • Dhivehi/Maldivian (dv)
  • Hebrew (he)
  • Kurdish (ku)
  • Persian (fa)
  • Urdu (ur)

An example post is also provided in the Blog.

arashgmn avatar Oct 15 '22 09:10 arashgmn

The most recent push, fixes the location of the vertical line of blockquote with &:

[dir=rtl] & {
        border-right: 5px solid var(--global-theme-color);
        border-left: none;

Note: It seems to me that the lateral border highlighting is repeated in _base.scss. Namely, there's a command at line 41 and another one at the very end line 661. I'm not sure why is that. So, I added [dir=rtl] & {... to both.

arashgmn avatar Oct 26 '22 21:10 arashgmn

@arashgmn, thanks again for the implementation of rtl support and for pushing a fix for the blockquote, it looks great! I'll take another pass, perhaps make some small adjustments to the code, and merge.

alshedivat avatar Oct 30 '22 00:10 alshedivat

Happy to help. And thanks for the awesome template!

arashgmn avatar Oct 30 '22 12:10 arashgmn

Also, we have a great font for writing Persian (Farsi) called Vazirmatn. It would be very good if we can somehow add custom fonts to this site. I'll just leave it as an idea.

pourmand1376 avatar Dec 25 '22 20:12 pourmand1376

Also, we have a great font for writing Persian (Farsi) called Vazirmatn. It would be very good if we can somehow add custom fonts to this site. I'll just leave it as an idea.

In the same blog I posted earlier, I use Noto Naskh Arabic (check _include/head.html). It can be changed to Vazirmatn easily.

The tricky part is to ensure ltr and rtl posts have the correct fonts. I used some layman's solutions to what didn'work, and it nearly works fine. The only exception is that the codes-block font is modified to the default ltr font except mono. This I couldn't fix, unfortunately. Would be happy to fix this one if you had any ideas.

arashgmn avatar Jan 01 '23 18:01 arashgmn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 02 '23 19:03 stale[bot]

Any update on this? Should I modify anything?

arashgmn avatar Mar 06 '23 09:03 arashgmn

I am not the best one to verify this, since I have no idea what are the rules when using left-to-right writing. @alshedivat @pourmand1376

george-gca avatar Mar 31 '23 02:03 george-gca

Hi, I synced my fork to include the nice sidebar feature and adapted my repo. My new commits include the followings:

  1. Adding "Vazirmatn" font for rtl content,
  2. ensuring the post-tags are always ltr (it looks better this way),
  3. removing deprecated attributes defined for the earlier version,
  4. correct highlighting of the sidebar headers for active title or hover (by default, the vertical bar is placed on the right),
  5. ensuring that the code blocks are always ltr, left-aligned and in monospace.

In addition, I added one new post to demonstrate that the sidebar indeed works an rtl language.

Cheers, Arash

arashgmn avatar May 06 '23 17:05 arashgmn