Skip to content

Commit d509fba

Browse files
committed
Fix deactivating syntax highlight
1 parent 6f7336a commit d509fba

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ type Config struct {
9393
OnComplete template.JS `json:"-"`
9494

9595
// An object with the activate and theme properties.
96-
SyntaxHighlight *SyntaxHighlightConfig `json:"syntaxHighlight,omitempty"`
96+
SyntaxHighlight *SyntaxHighlightConfig `json:"-"`
9797

9898
// Controls whether the "Try it out" section should be enabled by default.
9999
// default: false
@@ -199,6 +199,13 @@ type SyntaxHighlightConfig struct {
199199
Theme string `json:"theme,omitempty"`
200200
}
201201

202+
func (shc SyntaxHighlightConfig) Value() interface{} {
203+
if shc.Activate {
204+
return shc
205+
}
206+
return false
207+
}
208+
202209
type OAuthConfig struct {
203210
// ID of the client sent to the OAuth2 provider.
204211
// default: ""

index.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const indexTmpl string = `
6161
{{- end}}
6262
];
6363
config.filter = {{.Filter.Value}}
64+
config.syntaxHighlight = {{.SyntaxHighlight.Value}}
6465
{{if .TagsSorter}}
6566
config.tagsSorter = {{.TagsSorter}}
6667
{{end}}

0 commit comments

Comments
 (0)