feat: support RTL text (#6)

This commit is contained in:
josc146
2023-03-18 23:42:31 +08:00
parent 54edc2c269
commit 90a19df56e
4 changed files with 55 additions and 49 deletions
+1
View File
@@ -246,6 +246,7 @@ async function build() {
true,
generateWebpackCallback(() => finishOutput('-without-katex')),
)
await new Promise((r) => setTimeout(r, 2000))
await runWebpack(
false,
generateWebpackCallback(() => finishOutput('')),
+1
View File
@@ -21,6 +21,7 @@ export function InputBox({ onSubmit, enabled }) {
return (
<textarea
dir="auto"
ref={inputRef}
disabled={!enabled}
className="interact-input"
@@ -32,30 +32,32 @@ export function MarkdownRender(props) {
rel: 'nofollow noopener noreferrer',
}
return (
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true,
},
],
]}
components={{
a: (props) => (
<a href={props.href} {...linkProperties}>
{props.children}
</a>
),
pre: Pre,
}}
{...props}
>
{props.children}
</ReactMarkdown>
<div dir="auto">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true,
},
],
]}
components={{
a: (props) => (
<a href={props.href} {...linkProperties}>
{props.children}
</a>
),
pre: Pre,
}}
{...props}
>
{props.children}
</ReactMarkdown>
</div>
)
}
+27 -25
View File
@@ -35,31 +35,33 @@ export function MarkdownRender(props) {
rel: 'nofollow noopener noreferrer',
}
return (
<ReactMarkdown
remarkPlugins={[remarkMath, remarkGfm]}
rehypePlugins={[
rehypeKatex,
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true,
},
],
]}
components={{
a: (props) => (
<a href={props.href} {...linkProperties}>
{props.children}
</a>
),
pre: Pre,
}}
{...props}
>
{props.children}
</ReactMarkdown>
<div dir="auto">
<ReactMarkdown
remarkPlugins={[remarkMath, remarkGfm]}
rehypePlugins={[
rehypeKatex,
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true,
},
],
]}
components={{
a: (props) => (
<a href={props.href} {...linkProperties}>
{props.children}
</a>
),
pre: Pre,
}}
{...props}
>
{props.children}
</ReactMarkdown>
</div>
)
}