chore: remove check underscores

This commit is contained in:
Steven 2024-01-26 21:23:36 +08:00
parent ddc89029b7
commit e1977df14b
5 changed files with 4 additions and 10 deletions

View file

@ -22,7 +22,7 @@ func (*BoldParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
return nil, 0 return nil, 0
} }
prefixTokenType := prefixTokens[0].Type prefixTokenType := prefixTokens[0].Type
if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { if prefixTokenType != tokenizer.Asterisk {
return nil, 0 return nil, 0
} }

View file

@ -21,7 +21,7 @@ func (*BoldItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
return nil, 0 return nil, 0
} }
prefixTokenType := prefixTokens[0].Type prefixTokenType := prefixTokens[0].Type
if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { if prefixTokenType != tokenizer.Asterisk {
return nil, 0 return nil, 0
} }

View file

@ -22,7 +22,7 @@ func (*HorizontalRuleParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
if matchedTokens[0].Type != matchedTokens[1].Type || matchedTokens[0].Type != matchedTokens[2].Type || matchedTokens[1].Type != matchedTokens[2].Type { if matchedTokens[0].Type != matchedTokens[1].Type || matchedTokens[0].Type != matchedTokens[2].Type || matchedTokens[1].Type != matchedTokens[2].Type {
return nil, 0 return nil, 0
} }
if matchedTokens[0].Type != tokenizer.Hyphen && matchedTokens[0].Type != tokenizer.Underscore && matchedTokens[0].Type != tokenizer.Asterisk { if matchedTokens[0].Type != tokenizer.Hyphen && matchedTokens[0].Type != tokenizer.Asterisk {
return nil, 0 return nil, 0
} }
return &ast.HorizontalRule{ return &ast.HorizontalRule{

View file

@ -41,12 +41,6 @@ func TestHorizontalRuleParser(t *testing.T) {
text: "-*-", text: "-*-",
horizontalRule: nil, horizontalRule: nil,
}, },
{
text: "___",
horizontalRule: &ast.HorizontalRule{
Symbol: "_",
},
},
} }
for _, test := range tests { for _, test := range tests {

View file

@ -20,7 +20,7 @@ func (*ItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
} }
prefixTokens := matchedTokens[:1] prefixTokens := matchedTokens[:1]
if prefixTokens[0].Type != tokenizer.Asterisk && prefixTokens[0].Type != tokenizer.Underscore { if prefixTokens[0].Type != tokenizer.Asterisk {
return nil, 0 return nil, 0
} }
prefixTokenType := prefixTokens[0].Type prefixTokenType := prefixTokens[0].Type