diff options
Diffstat (limited to 'markdown')
| -rw-r--r-- | markdown/ast.go | 4 | ||||
| -rw-r--r-- | markdown/ast_heading.go | 8 | ||||
| -rw-r--r-- | markdown/ast_modifier.go | 2 | ||||
| -rw-r--r-- | markdown/ast_paragraph.go | 2 | ||||
| -rw-r--r-- | markdown/lexer.go | 8 |
5 files changed, 12 insertions, 12 deletions
diff --git a/markdown/ast.go b/markdown/ast.go index 2e073ee..f409ccb 100644 --- a/markdown/ast.go +++ b/markdown/ast.go @@ -62,11 +62,11 @@ func getBlock(lxs *lexers, newLine bool) (block, *ParseError) { var b block var err *ParseError switch lxs.Current().Type { - case lexerHeader: + case lexerHeading: if !newLine { b, err = paragraph(lxs, false) } else { - b, err = header(lxs) + b, err = heading(lxs) } case lexerExternal: if newLine && lxs.Current().Value == "![" { diff --git a/markdown/ast_heading.go b/markdown/ast_heading.go index 5ad7adb..206ff94 100644 --- a/markdown/ast_heading.go +++ b/markdown/ast_heading.go @@ -10,12 +10,12 @@ import ( var ErrInvalidHeader = errors.New("invalid header") -type astHeader struct { +type astHeading struct { level uint content *astParagraph } -func (a *astHeader) Eval(opt *Option) (template.HTML, *ParseError) { +func (a *astHeading) Eval(opt *Option) (template.HTML, *ParseError) { if a.level > 6 { return "", &ParseError{lxs: lexers{}, internal: ErrInvalidCodeFormat} } @@ -30,8 +30,8 @@ func (a *astHeader) Eval(opt *Option) (template.HTML, *ParseError) { ).Render(), nil } -func header(lxs *lexers) (*astHeader, *ParseError) { - b := &astHeader{level: uint(len(lxs.Current().Value))} +func heading(lxs *lexers) (*astHeading, *ParseError) { + b := &astHeading{level: uint(len(lxs.Current().Value))} if !lxs.Next() { return nil, &ParseError{lxs: *lxs, internal: ErrInvalidHeader} } diff --git a/markdown/ast_modifier.go b/markdown/ast_modifier.go index 635fbc0..7672c0c 100644 --- a/markdown/ast_modifier.go +++ b/markdown/ast_modifier.go @@ -68,7 +68,7 @@ func modifier(lxs *lexers) (*astModifier, error) { var s string for lxs.Next() { switch lxs.Current().Type { - case lexerLiteral, lexerHeader, lexerList: + case lexerLiteral, lexerHeading, lexerList: s += lxs.Current().Value case lexerModifier: if mod.super && []rune(mod.symbols)[0] == []rune(lxs.Current().Value)[0] && diff --git a/markdown/ast_paragraph.go b/markdown/ast_paragraph.go index b945741..eddba0a 100644 --- a/markdown/ast_paragraph.go +++ b/markdown/ast_paragraph.go @@ -53,7 +53,7 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, *ParseError) { return tree, nil } tree.content = append(tree.content, astLiteral(lxs.Current().Value)) - case lexerLiteral, lexerHeader: + case lexerLiteral, lexerHeading: s := lxs.Current().Value // replace line break by space if n > 0 && len(tree.content) != 0 { diff --git a/markdown/lexer.go b/markdown/lexer.go index 30587e4..b68bbf9 100644 --- a/markdown/lexer.go +++ b/markdown/lexer.go @@ -14,9 +14,9 @@ const ( lexerCode lexerType = "code" - lexerHeader lexerType = "header" - lexerQuote lexerType = "quote" - lexerList lexerType = "list" + lexerHeading lexerType = "header" + lexerQuote lexerType = "quote" + lexerList lexerType = "list" lexerExternal lexerType = "external" @@ -115,7 +115,7 @@ func lex(s string) *lexers { fn(c, lexerBreak, nil) case '#': newLine = false - fn(c, lexerHeader, nil) + fn(c, lexerHeading, nil) case '>': newLine = false fn(c, lexerQuote, nil) |
