Skip to content
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

PR into master from dev/olga/add-dir-auto #332

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

OlgaRedozubova
Copy link
Contributor

@OlgaRedozubova OlgaRedozubova commented Jun 25, 2024

branch: dev/olga/add-dir-auto

  • Added textDirection option to add the dir global attribute is an enumerated attribute that indicates the directionality of the element's text.
    By default, this is not set, and the dir attribute will not be added

When setting option:
textDirection={TextDirection.auto}
textDirection={TextDirection.ltr}
textDirection={TextDirection.rtl}

The dir attribute with the appropriate value will be added to all tokens for all mmd rendering rules.

For example:

By default, the dir attribute will not be added:
Screenshot 2024-07-25 at 20 13 33

textDirection={TextDirection.ltr} which means left to right and is to be used for languages that are written from the left to the right (like English);:
Screenshot 2024-07-25 at 20 16 23

textDirection={TextDirection.rtl} which means right to left and is to be used for languages that are written from the right to the left (like Arabic);:
Screenshot 2024-07-25 at 20 17 17

textDirection={TextDirection.auto} which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.:
Screenshot 2024-07-25 at 20 15 24


Arabic text:

By default, the dir attribute will not be added:

Screenshot 2024-07-25 at 20 51 02

textDirection={TextDirection.ltr} which means left to right and is to be used for languages that are written from the left to the right (like English);:
Screenshot 2024-07-25 at 20 50 19

textDirection={TextDirection.rtl} which means right to left and is to be used for languages that are written from the right to the left (like Arabic);:

Screenshot 2024-07-25 at 20 49 21

textDirection={TextDirection.auto} which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.:

Screenshot 2024-07-25 at 20 48 27

TODO:

  • Add tests
  • Update Readme

@OlgaRedozubova OlgaRedozubova self-assigned this Jun 25, 2024
@OlgaRedozubova OlgaRedozubova marked this pull request as ready for review July 25, 2024 18:02
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.

1 participant