From 9e5734cf76585705e259ae6c3585980ce8b994c1 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 30 Sep 2025 23:18:20 +0200 Subject: feat(markdown): code block and better handle of inline code --- mardown/ast_paragraph.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'mardown/ast_paragraph.go') diff --git a/mardown/ast_paragraph.go b/mardown/ast_paragraph.go index 6149c30..e9855a7 100644 --- a/mardown/ast_paragraph.go +++ b/mardown/ast_paragraph.go @@ -7,8 +7,7 @@ import ( ) var ( - ErrInvalidParagraph = errors.New("invalid paragraph") - ErrInvalidCodeBlockPosition = errors.Join(ErrInvalidParagraph, errors.New("invalid code block position")) + ErrInvalidParagraph = errors.New("invalid paragraph") ) type astParagraph struct { @@ -61,19 +60,12 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, error) { n = 0 //TODO: handle case lexerCode: - n = 0 - if len(lxs.Current().Value) == 3 { - if n == 0 { - return nil, ErrInvalidCodeBlockPosition - } - lxs.current-- // because we do not use it before the next - return tree, nil - } - mod, err := modifier(lxs) + b, err := code(lxs) if err != nil { return nil, err } - tree.content = append(tree.content, mod) + tree.content = append(tree.content, b) + return tree, nil } } return tree, nil -- cgit v1.2.3