small fixes

This commit is contained in:
Ren Amamiya
2023-09-04 17:18:28 +07:00
parent c74a81cfdb
commit 98d2ccfc86
2 changed files with 15 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import ReactMarkdown from 'react-markdown';
import { Link } from 'react-router-dom';
import remarkGfm from 'remark-gfm';
import {
@@ -37,6 +38,15 @@ export function TextNote({ content }: { content: string }) {
className="markdown"
remarkPlugins={[remarkGfm]}
components={{
a: ({ href }) => {
const cleanURL = new URL(href);
cleanURL.search = '';
return (
<Link to={href} target="_blank">
{cleanURL.hostname + cleanURL.pathname}
</Link>
);
},
del: ({ children }) => {
const key = children[0] as string;
if (typeof key !== 'string') return;