first commit

This commit is contained in:
fengxxc
2021-11-28 19:11:49 +08:00
commit 3d2ffb4ba9
5 changed files with 231 additions and 0 deletions

33
parse/model.go Normal file
View File

@@ -0,0 +1,33 @@
package parse
type Article struct {
title string
meta string
tags string
content []Block
}
type Block struct {
tokens []Token
}
type Token struct {
ttype TokenType
text string
attrs map[string]string
}
type TokenType int32
const (
TITLE TokenType = iota // 标题
LINK // 链接
NORMAL_TEXT // 文字
STRONG_TEXT // 强调文字
ITALIC_TEXT // 斜体文字
IMAGE // 图片
TABLE // 表格
CODE_INLINE // 代码 内联
CODE_BLOCK // 代码 块
CITE // 引用
)