Source File
auto_link.go
Belonging Package
github.com/yuin/goldmark/parser
package parser
import (
)
type autoLinkParser struct {
}
var defaultAutoLinkParser = &autoLinkParser{}
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.3.2-preview. (GOOS=darwin 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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |