Source File
auto_link.go
Belonging Package
github.com/yuin/goldmark/parser
package parserimport ()type autoLinkParser struct {}var defaultAutoLinkParser = &autoLinkParser{}// NewAutoLinkParser returns a new InlineParser that parses autolinks// surrounded by '<' and '>' .func () InlineParser {return defaultAutoLinkParser}func ( *autoLinkParser) () []byte {return []byte{'<'}}func ( *autoLinkParser) ( ast.Node, text.Reader, Context) ast.Node {, := .PeekLine():= util.FindEmailIndex([1:]):= ast.AutoLinkType(ast.AutoLinkEmail)if < 0 {= util.FindURLIndex([1:])= ast.AutoLinkURL}if < 0 {return nil}++if >= len() || [] != '>' {return nil}:= ast.NewTextSegment(text.NewSegment(.Start+1, .Start+)).Advance( + 1)return ast.NewAutoLink(, )}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |