{"record":{"id":"430035f79a6f8b2e","repo":"gohugoio/hugo","slug":"invalid-value-for-syntaxhighlight-q","errorCode":null,"errorMessage":"invalid value for syntaxHighlight: %q","messagePattern":"invalid value for syntaxHighlight: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"markup/rst/rst_config/config.go","lineNumber":32,"sourceCode":"// Package rst_config holds reStructuredText related configuration.\npackage rst_config\n\nimport \"fmt\"\n\n// Default holds Hugo's default reStructuredText configuration.\nvar Default = Config{\n\tSyntaxHighlight: \"long\",\n}\n\n// Config configures reStructuredText.\ntype Config struct {\n\t// Configures Pygments syntax highlighting. Valid values are \"short\", \"long\" (default) and \"none\".\n\tSyntaxHighlight string\n}\n\nfunc (c *Config) Init() error {\n\tif c.SyntaxHighlight != \"short\" && c.SyntaxHighlight != \"long\" && c.SyntaxHighlight != \"none\" {\n\t\treturn fmt.Errorf(\"invalid value for syntaxHighlight: %q\", c.SyntaxHighlight)\n\t}\n\treturn nil\n}\n","sourceCodeStart":14,"sourceCodeEnd":36,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/markup/rst/rst_config/config.go#L14-L36","documentation":"Returned by rst_config.Config.Init() when SyntaxHighlight is not one of the three allowed values \"short\", \"long\", \"none\". These map directly to rst2html's --syntax-highlight argument; an invalid value would be passed to the external tool, so Hugo rejects it at config-load time rather than at render time.","triggerScenarios":"Setting markup.rst.syntaxHighlight (or the RST Config struct) to any string other than \"short\", \"long\", or \"none\", then calling Config.Init() (via markup_config.Decode during Hugo startup).","commonSituations":"Old tutorials referencing values like \"html\"/\"html5\" that rst2html no longer accepts; case typo ('Long'); trailing whitespace; copy-pasting the Pygments style name instead of the rst2html mode.","solutions":["Set [markup.rst] syntaxHighlight to \"short\", \"long\" (default), or \"none\".","Omit the key to get the default \"long\".","Restart Hugo to confirm the config decodes cleanly."],"exampleFix":"# before\n[markup.rst]\nsyntaxHighlight = \"html\"\n\n# after\n[markup.rst]\nsyntaxHighlight = \"none\"","handlingStrategy":"validation","validationCode":"func validRstSyntaxHighlight(v string) bool {\n    switch v {\n    case \"short\", \"long\", \"none\":\n        return true\n    }\n    return false\n}","typeGuard":"func isRstSyntaxHighlight(v string) bool {\n    switch v {\n    case \"short\", \"long\", \"none\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := rstCfg.Init(); err != nil {\n    // default to \"long\" and retry if the user-supplied value was invalid\n    rstCfg.SyntaxHighlight = \"long\"\n}","preventionTips":["Document syntaxHighlight as enum short|long|none next to the config key.","Run `hugo config` to catch the error locally before pushing."],"tags":["config","rst","validation","enum","syntax-highlighting"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}