{"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/8a468df065a75c1c7cf9f6850f32148746590ea5/markup/rst/rst_config/config.go#L14-L36","documentation":"`rst_config.Config.Init` validates the `markup.rst.syntaxHighlight` setting, which is passed through to Docutils as `--syntax-highlight=<value>`. Only \"short\", \"long\" (the default, mapping to Pygments' long class names) and \"none\" are accepted; anything else fails config initialization before any page renders.","triggerScenarios":"Setting `markup.rst.syntaxHighlight` in hugo.toml/yaml/json to any string other than \"short\", \"long\", or \"none\" — e.g. \"true\", \"pygments\", \"Short\" (case-sensitive), or an empty string explicitly set.","commonSituations":"Confusing this Docutils-specific option with Hugo's own `markup.highlight` settings and pasting values like a style name; boolean-style values from assuming it's an on/off switch; capitalization typos in the config file.","solutions":["Set markup.rst.syntaxHighlight to exactly \"short\", \"long\", or \"none\" (lowercase).","Remove the key entirely to get the default \"long\".","If you meant to configure Chroma/goldmark highlighting, use the markup.highlight section instead."],"exampleFix":"# before (hugo.toml)\n[markup.rst]\nsyntaxHighlight = \"pygments\"\n# after\n[markup.rst]\nsyntaxHighlight = \"short\"","handlingStrategy":"validation","validationCode":"switch cfg.SyntaxHighlight {\ncase \"none\", \"short\", \"long\":\n    // ok\ndefault:\n    return fmt.Errorf(\"markup.rst.syntaxHighlight must be none, short, or long; got %q\", cfg.SyntaxHighlight)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set markup.rst.syntaxHighlight only to a documented value (e.g. \"short\" or \"long\")","Validate site config with `hugo config` after edits","Don't reuse Chroma highlight option values here — the RST converter has its own enum"],"tags":["hugo","rst","config","validation","syntax-highlighting"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}