mathpix-markdown-it
mathpix-markdown-it copied to clipboard
PR into master from dev/olga/add-dir-auto
branch: dev/olga/add-dir-auto
- Added
textDirectionoption 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:
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);:
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);:
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.:
Arabic text:
By default, the dir attribute will not be added:
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);:
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);:
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.:
TODO:
- [X] Add tests
- [X] Update Readme