feat: implement code block parser (#1727)

This commit is contained in:
boojack
2023-05-24 00:31:37 +08:00
committed by GitHub
parent 42c653e1a4
commit 65890bc257
5 changed files with 191 additions and 0 deletions

View File

@ -6,6 +6,7 @@ const (
Underline TokenType = "_"
Star TokenType = "*"
Hash TokenType = "#"
Backtick TokenType = "`"
Newline TokenType = "\n"
Space TokenType = " "
)
@ -38,6 +39,8 @@ func Tokenize(text string) []*Token {
tokens = append(tokens, NewToken(Hash, "#"))
case '\n':
tokens = append(tokens, NewToken(Newline, "\n"))
case '`':
tokens = append(tokens, NewToken(Backtick, "`"))
case ' ':
tokens = append(tokens, NewToken(Space, " "))
default: