forked from forgejo/forgejo
Vendor Update (#16121)
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
f088dc4ea1
commit
86e2789960
819 changed files with 38072 additions and 34969 deletions
31
vendor/github.com/yuin/goldmark-highlighting/highlighting.go
generated
vendored
31
vendor/github.com/yuin/goldmark-highlighting/highlighting.go
generated
vendored
|
@ -112,6 +112,9 @@ type Config struct {
|
|||
// Supported styles are defined under https://github.com/alecthomas/chroma/tree/master/formatters.
|
||||
Style string
|
||||
|
||||
// Pass in a custom Chroma style. If this is not nil, the Style string will be ignored
|
||||
CustomStyle *chroma.Style
|
||||
|
||||
// If set, will try to guess language if none provided.
|
||||
// If the guessing fails, we will fall back to a text lexer.
|
||||
// Note that while Chroma's API supports language guessing, the implementation
|
||||
|
@ -150,6 +153,8 @@ func (c *Config) SetOption(name renderer.OptionName, value interface{}) {
|
|||
switch name {
|
||||
case optStyle:
|
||||
c.Style = value.(string)
|
||||
case optCustomStyle:
|
||||
c.CustomStyle = value.(*chroma.Style)
|
||||
case optFormatOptions:
|
||||
if value != nil {
|
||||
c.FormatOptions = value.([]chromahtml.Option)
|
||||
|
@ -200,6 +205,7 @@ func WithHTMLOptions(opts ...html.Option) Option {
|
|||
}
|
||||
|
||||
const optStyle renderer.OptionName = "HighlightingStyle"
|
||||
const optCustomStyle renderer.OptionName = "HighlightingCustomStyle"
|
||||
|
||||
var highlightLinesAttrName = []byte("hl_lines")
|
||||
|
||||
|
@ -227,6 +233,23 @@ func WithStyle(style string) Option {
|
|||
return &withStyle{style}
|
||||
}
|
||||
|
||||
type withCustomStyle struct {
|
||||
value *chroma.Style
|
||||
}
|
||||
|
||||
func (o *withCustomStyle) SetConfig(c *renderer.Config) {
|
||||
c.Options[optCustomStyle] = o.value
|
||||
}
|
||||
|
||||
func (o *withCustomStyle) SetHighlightingOption(c *Config) {
|
||||
c.CustomStyle = o.value
|
||||
}
|
||||
|
||||
// WithStyle is a functional option that changes highlighting style.
|
||||
func WithCustomStyle(style *chroma.Style) Option {
|
||||
return &withCustomStyle{style}
|
||||
}
|
||||
|
||||
const optCSSWriter renderer.OptionName = "HighlightingCSSWriter"
|
||||
|
||||
type withCSSWriter struct {
|
||||
|
@ -316,7 +339,7 @@ func (o *withFormatOptions) SetConfig(c *renderer.Config) {
|
|||
if _, ok := c.Options[optFormatOptions]; !ok {
|
||||
c.Options[optFormatOptions] = []chromahtml.Option{}
|
||||
}
|
||||
c.Options[optStyle] = append(c.Options[optFormatOptions].([]chromahtml.Option), o.value...)
|
||||
c.Options[optFormatOptions] = append(c.Options[optFormatOptions].([]chromahtml.Option), o.value...)
|
||||
}
|
||||
|
||||
func (o *withFormatOptions) SetHighlightingOption(c *Config) {
|
||||
|
@ -385,7 +408,11 @@ func (r *HTMLRenderer) renderFencedCodeBlock(w util.BufWriter, source []byte, no
|
|||
|
||||
chromaFormatterOptions := make([]chromahtml.Option, len(r.FormatOptions))
|
||||
copy(chromaFormatterOptions, r.FormatOptions)
|
||||
style := styles.Get(r.Style)
|
||||
|
||||
style := r.CustomStyle
|
||||
if style == nil {
|
||||
style = styles.Get(r.Style)
|
||||
}
|
||||
nohl := false
|
||||
|
||||
var info []byte
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue