remote text

This commit is contained in:
josc146
2023-05-19 22:18:38 +08:00
parent 21c200d767
commit 5a0514c72d
7 changed files with 80 additions and 13 deletions

View File

@@ -5,6 +5,21 @@ import remarkGfm from 'remark-gfm';
import remarkBreaks from 'remark-breaks';
import {FC} from 'react';
import {ReactMarkdownOptions} from 'react-markdown/lib/react-markdown';
import {BrowserOpenURL} from '../../wailsjs/runtime';
const Hyperlink: FC<any> = ({href, children}) => {
return (
<span
style={{color: '#8ab4f8', cursor: 'pointer'}}
onClick={() => {
BrowserOpenURL(href);
}}
>
{/*@ts-ignore*/}
{children}
</span>
);
};
export const MarkdownRender: FC<ReactMarkdownOptions> = (props) => {
return (
@@ -21,6 +36,9 @@ export const MarkdownRender: FC<ReactMarkdownOptions> = (props) => {
}
]
]}
components={{
a: Hyperlink
}}
>
{props.children}
</ReactMarkdown>