Blockquotes are exceptional, we need to define exactly how they should behave with bidirectional text.
Usually, developers add extra CSS to give blockquotes that border on the left, but when the text direction is right to left, the border should be on the right instead, and that looks problematic 🤔. Thankfully, we don't have to write a script that handles that for us 😌! There is a pure CSS solution that makes the border follow the direction of the first strong character: border-inline-start
!
However, the current design of the plugin prevents border-inline-start
from working as we give every block element the dir attribute. Keep in mind that the blockquote element isn't a direct parent to the text, instead, there is a paragraph element that contains the text inside, and as it also has dir="auto"
, the text is isolated from the blockquote causing the CSS trick to be unfunctional.
We have multiple options and we need to decide which one to choose (suggestions are welcome):
Markdown:
> عربية1 عربية2 English عربية3 عربية4
>
> > عربية1 عربية2 English عربية3 عربية4
>
> > English1 English2 عربية English3 English4
>
> English1 English2 عربية English3 English4
Option 1: No dir="auto"
for the first child of the blockquote element:
<blockquote dir="auto">
<p>عربية1 عربية2 English عربية3 عربية4</p>
<blockquote dir="auto">
<p>عربية1 عربية2 English عربية3 عربية4</p>
</blockquote>
<blockquote dir="auto">
<p>English1 English2 عربية English3 English4</p>
</blockquote>
<p dir="auto">English1 English2 عربية English3 English4</p>
</blockquote>
Option 2: No dir="auto"
for every non-blockquote element (e.g. p, table...):
<blockquote dir="auto">
<p>عربية1 عربية2 English عربية3 عربية4</p>
<blockquote dir="auto">
<p>عربية1 عربية2 English عربية3 عربية4</p>
</blockquote>
<blockquote dir="auto">
<p>English1 English2 عربية English3 English4</p>
</blockquote>
<p>English1 English2 عربية English3 English4</p>
</blockquote>
Option 3: No dir="auto"
for every nested element (Gitlab Approach):
<blockquote dir="auto">
<p>عربية1 عربية2 English عربية3 عربية4</p>
<blockquote>
<p>عربية1 عربية2 English عربية3 عربية4</p>
</blockquote>
<blockquote>
<p>English1 English2 عربية English3 English4</p>
</blockquote>
<p>English1 English2 عربية English3 English4</p>
</blockquote>
Edit: Here is the CSS I used:
blockquote {
border-inline-start: .25em solid #bbbbbb;
padding: 0 .25em;
}
Edit 2: (Just for reference)
Option 4: No dir="auto"
for blockquote elements (Github Approach):
This approach has one bug: The blockquote element itself doesn't get any direction based on its content. there is one workaround which is to give the style to child elements of a blockquote which results in horrible outcomes with lists and tables.