chore: update gomark.wasm

This commit is contained in:
Steven 2024-03-01 19:31:00 +08:00
parent 8eb01adb6f
commit 898b3c3779
3 changed files with 62 additions and 67 deletions

Binary file not shown.

View file

@ -62,66 +62,67 @@ interface Props {
node: Node;
}
const Renderer: React.FC<Props> = ({ index, node }: Props) => {
switch (node.type) {
const Renderer: React.FC<Props> = ({ index, node: rawNode }: Props) => {
const { type, node } = rawNode;
switch (type) {
case NodeType.LINE_BREAK:
return <LineBreak index={index} />;
case NodeType.PARAGRAPH:
return <Paragraph index={index} {...(node.paragraphNode as ParagraphNode)} />;
return <Paragraph index={index} {...(node as ParagraphNode)} />;
case NodeType.CODE_BLOCK:
return <CodeBlock index={index} {...(node.codeBlockNode as CodeBlockNode)} />;
return <CodeBlock index={index} {...(node as CodeBlockNode)} />;
case NodeType.HEADING:
return <Heading index={index} {...(node.headingNode as HeadingNode)} />;
return <Heading index={index} {...(node as HeadingNode)} />;
case NodeType.HORIZONTAL_RULE:
return <HorizontalRule index={index} {...(node.horizontalRuleNode as HorizontalRuleNode)} />;
return <HorizontalRule index={index} {...(node as HorizontalRuleNode)} />;
case NodeType.BLOCKQUOTE:
return <Blockquote index={index} {...(node.blockquoteNode as BlockquoteNode)} />;
return <Blockquote index={index} {...(node as BlockquoteNode)} />;
case NodeType.ORDERED_LIST:
return <OrderedList index={index} {...(node.orderedListNode as OrderedListNode)} />;
return <OrderedList index={index} {...(node as OrderedListNode)} />;
case NodeType.UNORDERED_LIST:
return <UnorderedList {...(node.unorderedListNode as UnorderedListNode)} />;
return <UnorderedList {...(node as UnorderedListNode)} />;
case NodeType.TASK_LIST:
return <TaskList index={index} {...(node.taskListNode as TaskListNode)} />;
return <TaskList index={index} {...(node as TaskListNode)} />;
case NodeType.MATH_BLOCK:
return <Math {...(node.mathBlockNode as MathNode)} block={true} />;
return <Math {...(node as MathNode)} block={true} />;
case NodeType.TABLE:
return <Table {...(node.tableNode as TableNode)} />;
return <Table {...(node as TableNode)} />;
case NodeType.EMBEDDED_CONTENT:
return <EmbeddedContent {...(node.embeddedContentNode as EmbeddedContentNode)} />;
return <EmbeddedContent {...(node as EmbeddedContentNode)} />;
case NodeType.TEXT:
return <Text {...(node.textNode as TextNode)} />;
return <Text {...(node as TextNode)} />;
case NodeType.BOLD:
return <Bold {...(node.boldNode as BoldNode)} />;
return <Bold {...(node as BoldNode)} />;
case NodeType.ITALIC:
return <Italic {...(node.italicNode as ItalicNode)} />;
return <Italic {...(node as ItalicNode)} />;
case NodeType.BOLD_ITALIC:
return <BoldItalic {...(node.boldItalicNode as BoldItalicNode)} />;
return <BoldItalic {...(node as BoldItalicNode)} />;
case NodeType.CODE:
return <Code {...(node.codeNode as CodeNode)} />;
return <Code {...(node as CodeNode)} />;
case NodeType.IMAGE:
return <Image {...(node.imageNode as ImageNode)} />;
return <Image {...(node as ImageNode)} />;
case NodeType.LINK:
return <Link {...(node.linkNode as LinkNode)} />;
return <Link {...(node as LinkNode)} />;
case NodeType.AUTO_LINK:
return <Link {...(node.autoLinkNode as AutoLinkNode)} />;
return <Link {...(node as AutoLinkNode)} />;
case NodeType.TAG:
return <Tag {...(node.tagNode as TagNode)} />;
return <Tag {...(node as TagNode)} />;
case NodeType.STRIKETHROUGH:
return <Strikethrough {...(node.strikethroughNode as StrikethroughNode)} />;
return <Strikethrough {...(node as StrikethroughNode)} />;
case NodeType.MATH:
return <Math {...(node.mathNode as MathNode)} />;
return <Math {...(node as MathNode)} />;
case NodeType.HIGHLIGHT:
return <Highlight {...(node.highlightNode as HighlightNode)} />;
return <Highlight {...(node as HighlightNode)} />;
case NodeType.ESCAPING_CHARACTER:
return <EscapingCharacter {...(node.escapingCharacterNode as EscapingCharacterNode)} />;
return <EscapingCharacter {...(node as EscapingCharacterNode)} />;
case NodeType.SUBSCRIPT:
return <Subscript {...(node.subscriptNode as SubscriptNode)} />;
return <Subscript {...(node as SubscriptNode)} />;
case NodeType.SUPERSCRIPT:
return <Superscript {...(node.superscriptNode as SuperscriptNode)} />;
return <Superscript {...(node as SuperscriptNode)} />;
case NodeType.REFERENCED_CONTENT:
return <ReferencedContent {...(node.referencedContentNode as ReferencedContentNode)} />;
return <ReferencedContent {...(node as ReferencedContentNode)} />;
case NodeType.SPOILER:
return <Spoiler {...(node.spoilerNode as SpoilerNode)} />;
return <Spoiler {...(node as SpoilerNode)} />;
default:
return null;
}

View file

@ -1,9 +1,4 @@
/* eslint-disable */
export const protobufPackage = "gomark.node.v1";
export enum NodeType {
NODE_UNSPECIFIED = "NODE_UNSPECIFIED",
LINE_BREAK = "LINE_BREAK",
PARAGRAPH = "PARAGRAPH",
CODE_BLOCK = "CODE_BLOCK",
@ -33,44 +28,43 @@ export enum NodeType {
SUPERSCRIPT = "SUPERSCRIPT",
REFERENCED_CONTENT = "REFERENCED_CONTENT",
SPOILER = "SPOILER",
UNRECOGNIZED = "UNRECOGNIZED",
}
export interface Node {
type: NodeType;
lineBreakNode?: LineBreakNode | undefined;
paragraphNode?: ParagraphNode | undefined;
codeBlockNode?: CodeBlockNode | undefined;
headingNode?: HeadingNode | undefined;
horizontalRuleNode?: HorizontalRuleNode | undefined;
blockquoteNode?: BlockquoteNode | undefined;
orderedListNode?: OrderedListNode | undefined;
unorderedListNode?: UnorderedListNode | undefined;
taskListNode?: TaskListNode | undefined;
mathBlockNode?: MathBlockNode | undefined;
tableNode?: TableNode | undefined;
embeddedContentNode?: EmbeddedContentNode | undefined;
textNode?: TextNode | undefined;
boldNode?: BoldNode | undefined;
italicNode?: ItalicNode | undefined;
boldItalicNode?: BoldItalicNode | undefined;
codeNode?: CodeNode | undefined;
imageNode?: ImageNode | undefined;
linkNode?: LinkNode | undefined;
autoLinkNode?: AutoLinkNode | undefined;
tagNode?: TagNode | undefined;
strikethroughNode?: StrikethroughNode | undefined;
escapingCharacterNode?: EscapingCharacterNode | undefined;
mathNode?: MathNode | undefined;
highlightNode?: HighlightNode | undefined;
subscriptNode?: SubscriptNode | undefined;
superscriptNode?: SuperscriptNode | undefined;
referencedContentNode?: ReferencedContentNode | undefined;
spoilerNode?: SpoilerNode | undefined;
node:
| LineBreakNode
| ParagraphNode
| CodeBlockNode
| HeadingNode
| HorizontalRuleNode
| BlockquoteNode
| OrderedListNode
| UnorderedListNode
| TaskListNode
| MathBlockNode
| TableNode
| EmbeddedContentNode
| TextNode
| BoldNode
| ItalicNode
| BoldItalicNode
| CodeNode
| ImageNode
| LinkNode
| AutoLinkNode
| TagNode
| StrikethroughNode
| EscapingCharacterNode
| MathNode
| HighlightNode
| SubscriptNode
| SuperscriptNode
| ReferencedContentNode
| SpoilerNode;
}
export interface LineBreakNode {
}
export interface LineBreakNode {}
export interface ParagraphNode {
children: Node[];