Skip to content

Commit 2294259

Browse files
committed
rtl in sandbox preview
1 parent cff8961 commit 2294259

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/MDX/InlineCode.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ function InlineCode({
1414
}: JSX.IntrinsicElements['code'] & InlineCodeProps) {
1515
return (
1616
<code
17-
dir="ltr" // This is needed to prevent the code from inheriting the RTL direction of <html> in case of RTL languages to avoid like `()console.log` to be rendered as `console.log()`
17+
// dir="ltr" // This is needed to prevent the code from inheriting the RTL direction of <html> in case of RTL languages to avoid like `()console.log` to be rendered as `console.log()`
18+
dir={typeof props.children !== "string" ? "ltr" : ["[", "]"].includes(props.children) ? "rtl" : "ltr"}
1819
className={cn(
1920
'inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline',
2021
{

src/components/MDX/Sandpack/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ root.render(
4040
'/public/index.html': {
4141
hidden: true,
4242
code: `<!DOCTYPE html>
43-
<html lang="en">
43+
<html lang="ar">
4444
<head>
4545
<meta charset="UTF-8">
4646
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4747
<title>Document</title>
4848
</head>
49-
<body>
49+
<body dir="rtl">
5050
<div id="root"></div>
5151
</body>
5252
</html>`,

0 commit comments

Comments
 (0)