Skip to content

Commit 699d36a

Browse files
committed
feat: support RTL text (#6)
1 parent 8777140 commit 699d36a

File tree

4 files changed

+55
-49
lines changed

4 files changed

+55
-49
lines changed

build.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ async function build() {
246246
true,
247247
generateWebpackCallback(() => finishOutput('-without-katex')),
248248
)
249+
await new Promise((r) => setTimeout(r, 2000))
249250
await runWebpack(
250251
false,
251252
generateWebpackCallback(() => finishOutput('')),

src/components/InputBox/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function InputBox({ onSubmit, enabled }) {
2121

2222
return (
2323
<textarea
24+
dir="auto"
2425
ref={inputRef}
2526
disabled={!enabled}
2627
className="interact-input"

src/components/MarkdownRender/markdown-without-katex.jsx

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,32 @@ export function MarkdownRender(props) {
3232
rel: 'nofollow noopener noreferrer',
3333
}
3434
return (
35-
<ReactMarkdown
36-
remarkPlugins={[remarkGfm]}
37-
rehypePlugins={[
38-
rehypeRaw,
39-
[
40-
rehypeHighlight,
41-
{
42-
detect: true,
43-
ignoreMissing: true,
44-
},
45-
],
46-
]}
47-
components={{
48-
a: (props) => (
49-
<a href={props.href} {...linkProperties}>
50-
{props.children}
51-
</a>
52-
),
53-
pre: Pre,
54-
}}
55-
{...props}
56-
>
57-
{props.children}
58-
</ReactMarkdown>
35+
<div dir="auto">
36+
<ReactMarkdown
37+
remarkPlugins={[remarkGfm]}
38+
rehypePlugins={[
39+
rehypeRaw,
40+
[
41+
rehypeHighlight,
42+
{
43+
detect: true,
44+
ignoreMissing: true,
45+
},
46+
],
47+
]}
48+
components={{
49+
a: (props) => (
50+
<a href={props.href} {...linkProperties}>
51+
{props.children}
52+
</a>
53+
),
54+
pre: Pre,
55+
}}
56+
{...props}
57+
>
58+
{props.children}
59+
</ReactMarkdown>
60+
</div>
5961
)
6062
}
6163

src/components/MarkdownRender/markdown.jsx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,33 @@ export function MarkdownRender(props) {
3535
rel: 'nofollow noopener noreferrer',
3636
}
3737
return (
38-
<ReactMarkdown
39-
remarkPlugins={[remarkMath, remarkGfm]}
40-
rehypePlugins={[
41-
rehypeKatex,
42-
rehypeRaw,
43-
[
44-
rehypeHighlight,
45-
{
46-
detect: true,
47-
ignoreMissing: true,
48-
},
49-
],
50-
]}
51-
components={{
52-
a: (props) => (
53-
<a href={props.href} {...linkProperties}>
54-
{props.children}
55-
</a>
56-
),
57-
pre: Pre,
58-
}}
59-
{...props}
60-
>
61-
{props.children}
62-
</ReactMarkdown>
38+
<div dir="auto">
39+
<ReactMarkdown
40+
remarkPlugins={[remarkMath, remarkGfm]}
41+
rehypePlugins={[
42+
rehypeKatex,
43+
rehypeRaw,
44+
[
45+
rehypeHighlight,
46+
{
47+
detect: true,
48+
ignoreMissing: true,
49+
},
50+
],
51+
]}
52+
components={{
53+
a: (props) => (
54+
<a href={props.href} {...linkProperties}>
55+
{props.children}
56+
</a>
57+
),
58+
pre: Pre,
59+
}}
60+
{...props}
61+
>
62+
{props.children}
63+
</ReactMarkdown>
64+
</div>
6365
)
6466
}
6567

0 commit comments

Comments
 (0)