chore: Update translations

This commit is contained in:
2024-01-20 22:26:15 +00:00
parent 96467bd979
commit ae2c44ff2b
5 changed files with 47 additions and 34 deletions

View File

@ -14,7 +14,6 @@ interface MarkdownProps {
}
const Markdown = forwardRef<HTMLDivElement, MarkdownProps>((props: MarkdownProps, ref) => {
function renderToken(t: Token): ReactNode {
try {
switch (t.type) {
@ -76,18 +75,26 @@ const Markdown = forwardRef<HTMLDivElement, MarkdownProps>((props: MarkdownProps
return <s>{t.tokens ? t.tokens.map(renderToken) : t.raw}</s>;
}
case "table": {
return <table className="table-auto border-collapse">
<thead>
<tr>
{(t.header as Tokens.TableCell[]).map(v => <th className="border">{v.tokens ? v.tokens.map(renderToken) : v.text}</th>)}
</tr>
</thead>
<tbody>
{(t.rows as Tokens.TableCell[][]).map(v => <tr>
{v.map(d => <td className="border px-2 py-1">{d.tokens ? d.tokens.map(renderToken) : d.text}</td>)}
</tr>)}
</tbody>
</table>;
return (
<table className="table-auto border-collapse">
<thead>
<tr>
{(t.header as Tokens.TableCell[]).map(v => (
<th className="border">{v.tokens ? v.tokens.map(renderToken) : v.text}</th>
))}
</tr>
</thead>
<tbody>
{(t.rows as Tokens.TableCell[][]).map(v => (
<tr>
{v.map(d => (
<td className="border px-2 py-1">{d.tokens ? d.tokens.map(renderToken) : d.text}</td>
))}
</tr>
))}
</tbody>
</table>
);
}
default: {
if ("tokens" in t) {
@ -104,7 +111,6 @@ const Markdown = forwardRef<HTMLDivElement, MarkdownProps>((props: MarkdownProps
}
}
const parsed = useMemo(() => {
return marked.lexer(props.content);
}, [props.content, props.tags]);