feat: implement auto link parser

This commit is contained in:
Steven
2023-12-27 08:44:51 +08:00
parent 6fac116d8c
commit c8d7f93dca
14 changed files with 418 additions and 179 deletions

View File

@ -1,4 +1,5 @@
import {
AutoLinkNode,
BlockquoteNode,
BoldItalicNode,
BoldNode,
@ -20,6 +21,7 @@ import {
TextNode,
UnorderedListNode,
} from "@/types/proto/api/v2/markdown_service";
import AutoLink from "./AutoLink";
import Blockquote from "./Blockquote";
import Bold from "./Bold";
import BoldItalic from "./BoldItalic";
@ -78,6 +80,8 @@ const Renderer: React.FC<Props> = ({ node }: Props) => {
return <Image {...(node.imageNode as ImageNode)} />;
case NodeType.LINK:
return <Link {...(node.linkNode as LinkNode)} />;
case NodeType.AUTO_LINK:
return <AutoLink {...(node.autoLinkNode as AutoLinkNode)} />;
case NodeType.TAG:
return <Tag {...(node.tagNode as TagNode)} />;
case NodeType.STRIKETHROUGH: