Mandarancio / scidown

SciDown processing library in C

Home Page:https://github.com/Mandarancio/scidown/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve support for right-to-left languages

fabiocolacio opened this issue · comments

steps can be taken to improve support for right-to-left languages.

As suggested by @ronhasson, adding the attribute dir="auto" to lists can improve the look of right-to-left text in lists.

As mentioned in fabiocolacio/Marker pull#182

I think the line we need to change is:

hoedown_buffer_put(ob, (const uint8_t *)(flags & HOEDOWN_LIST_ORDERED ? "<ol>\n" : "<ul>\n"), 5);

but you probably know the code better than me.

the dir="auto" attribute has to be added to all tags, only to list or on the <html> tag as shown here?

only to the list is enough.
it will make it so each list will change direction based on the first item's lang direction

adding this to the html will make all the page either LTR or RTL ( you won't be able to combine both ).
and I don't think adding this to all the tags will be necessary (maybe some of them wont accept the attribute?).

I pushed the changes, I added the dir only to the lists (both ul and ol). I also pushed the changes in marker, please test it and let me know if does work :)

The lists look perfect.

@\toc unfortunately, doesn't

screenshot from 2018-04-07 13-06-52

Since 1 and 1.1 are RTL the list should too.
It seems the ul doesnt conatin the dir="auto"

Tables have the same problem and more, when you type in Hebrew the function generates the table correctly but when the html engine shows it, the columns are in reverse order(from right to left).

The solution is also to attach dir="auto" to the <table> elements too.

The second problem with tables is they are always sticking to the left side of the page,
I know you can change the text alignment with the |:----:| but I have no Idea how to make them stick to the right when needed.

Ok I will add the dir="auto" to the toc (that is generated independently from the normal list, and that's why it doesn't have it) and to the table :)

I added the the dir="auto" tag to toc and table elements and updated marker with it. @ronhasson Let me know if everything is fine now

I really don't want to bother you, (and sorry I disappeared )
I can't see the dir="auto" in the ul of the @tos .

I could swear it worked before. maybe it was when I installed it manually in the past or maybe I'm imagining it and its just because I haven't used @tos in a long time.