Source File
emphasis.go
Belonging Package
github.com/yuin/goldmark/parser
package parser
import (
)
type emphasisDelimiterProcessor struct {
}
func ( *emphasisDelimiterProcessor) ( byte) bool {
return == '*' || == '_'
}
func ( *emphasisDelimiterProcessor) (, *Delimiter) bool {
return .Char == .Char
}
func ( *emphasisDelimiterProcessor) ( int) ast.Node {
return ast.NewEmphasis()
}
var defaultEmphasisDelimiterProcessor = &emphasisDelimiterProcessor{}
type emphasisParser struct {
}
var defaultEmphasisParser = &emphasisParser{}
func () InlineParser {
return defaultEmphasisParser
}
func ( *emphasisParser) () []byte {
return []byte{'*', '_'}
}
func ( *emphasisParser) ( ast.Node, text.Reader, Context) ast.Node {
:= .PrecendingCharacter()
, := .PeekLine()
:= ScanDelimiter(, , 1, defaultEmphasisDelimiterProcessor)
if == nil {
return nil
}
.Segment = .WithStop(.Start + .OriginalLength)
.Advance(.OriginalLength)
.PushDelimiter()
return
![]() |
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. |