feat: add markdown footnote

This commit is contained in:
kangfenmao 2024-08-01 15:18:09 +08:00
parent c9a964d8f8
commit b04b0cc8a6
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,8 @@ const resources = {
regenerate: 'Regenerate', regenerate: 'Regenerate',
provider: 'Provider', provider: 'Provider',
you: 'You', you: 'You',
save: 'Save' save: 'Save',
footnotes: 'Footnotes'
}, },
button: { button: {
add: 'Add', add: 'Add',
@ -209,7 +210,8 @@ const resources = {
copy: '复制', copy: '复制',
regenerate: '重新生成', regenerate: '重新生成',
provider: '提供商', provider: '提供商',
you: '用户' you: '用户',
footnote: '引用内容'
}, },
button: { button: {
add: '添加', add: '添加',

View File

@ -31,12 +31,13 @@ const Markdown: FC<Props> = ({ message }) => {
<ReactMarkdown <ReactMarkdown
className="markdown" className="markdown"
remarkPlugins={[remarkGfm, remarkMath]} remarkPlugins={[remarkGfm, remarkMath]}
remarkRehypeOptions={{ footnoteLabel: t('common.footnote'), footnoteLabelTagName: 'h4' }}
rehypePlugins={[rehypeKatex]} rehypePlugins={[rehypeKatex]}
components={{ code: CodeBlock as any, a: Link as any }}> components={{ code: CodeBlock as any, a: Link as any }}>
{getMessageContent(message)} {getMessageContent(message)}
</ReactMarkdown> </ReactMarkdown>
) )
}, [getMessageContent, message]) }, [getMessageContent, message, t])
} }
export default Markdown export default Markdown