mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: implement part of html renderer
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/usememos/memos/plugin/gomark/ast"
|
||||
"github.com/usememos/memos/plugin/gomark/parser/tokenizer"
|
||||
)
|
||||
@ -27,13 +29,13 @@ func (*HorizontalRuleParser) Match(tokens []*tokenizer.Token) (int, bool) {
|
||||
return 3, true
|
||||
}
|
||||
|
||||
func (p *HorizontalRuleParser) Parse(tokens []*tokenizer.Token) ast.Node {
|
||||
func (p *HorizontalRuleParser) Parse(tokens []*tokenizer.Token) (ast.Node, error) {
|
||||
size, ok := p.Match(tokens)
|
||||
if size == 0 || !ok {
|
||||
return nil
|
||||
return nil, errors.New("not matched")
|
||||
}
|
||||
|
||||
return &ast.HorizontalRule{
|
||||
Symbol: tokens[0].Type,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user