mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 23:22:47 +08:00
chore: remove check underscores
This commit is contained in:
parent
ddc89029b7
commit
e1977df14b
5 changed files with 4 additions and 10 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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{
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue