From e1977df14b100780aa45be4d45811bbcd0d09268 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 26 Jan 2024 21:23:36 +0800 Subject: [PATCH] chore: remove check underscores --- plugin/gomark/parser/bold.go | 2 +- plugin/gomark/parser/bold_italic.go | 2 +- plugin/gomark/parser/horizontal_rule.go | 2 +- plugin/gomark/parser/horizontal_rule_test.go | 6 ------ plugin/gomark/parser/italic.go | 2 +- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/plugin/gomark/parser/bold.go b/plugin/gomark/parser/bold.go index 698fa5b8..401f217e 100644 --- a/plugin/gomark/parser/bold.go +++ b/plugin/gomark/parser/bold.go @@ -22,7 +22,7 @@ func (*BoldParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { return nil, 0 } prefixTokenType := prefixTokens[0].Type - if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { + if prefixTokenType != tokenizer.Asterisk { return nil, 0 } diff --git a/plugin/gomark/parser/bold_italic.go b/plugin/gomark/parser/bold_italic.go index b8305880..d34d0ad2 100644 --- a/plugin/gomark/parser/bold_italic.go +++ b/plugin/gomark/parser/bold_italic.go @@ -21,7 +21,7 @@ func (*BoldItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { return nil, 0 } prefixTokenType := prefixTokens[0].Type - if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { + if prefixTokenType != tokenizer.Asterisk { return nil, 0 } diff --git a/plugin/gomark/parser/horizontal_rule.go b/plugin/gomark/parser/horizontal_rule.go index 0edf4e3d..4a9c0e79 100644 --- a/plugin/gomark/parser/horizontal_rule.go +++ b/plugin/gomark/parser/horizontal_rule.go @@ -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 { 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 &ast.HorizontalRule{ diff --git a/plugin/gomark/parser/horizontal_rule_test.go b/plugin/gomark/parser/horizontal_rule_test.go index dffc064c..c2faa39d 100644 --- a/plugin/gomark/parser/horizontal_rule_test.go +++ b/plugin/gomark/parser/horizontal_rule_test.go @@ -41,12 +41,6 @@ func TestHorizontalRuleParser(t *testing.T) { text: "-*-", horizontalRule: nil, }, - { - text: "___", - horizontalRule: &ast.HorizontalRule{ - Symbol: "_", - }, - }, } for _, test := range tests { diff --git a/plugin/gomark/parser/italic.go b/plugin/gomark/parser/italic.go index 3c93a8d0..9b586c04 100644 --- a/plugin/gomark/parser/italic.go +++ b/plugin/gomark/parser/italic.go @@ -20,7 +20,7 @@ func (*ItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { } prefixTokens := matchedTokens[:1] - if prefixTokens[0].Type != tokenizer.Asterisk && prefixTokens[0].Type != tokenizer.Underscore { + if prefixTokens[0].Type != tokenizer.Asterisk { return nil, 0 } prefixTokenType := prefixTokens[0].Type