Storing markup override settings in the theme settings

I’m trying to compartmentalise all the settings that I mean to use to change the look and feel of my website within the theme folder. However, when I use these settings in my theme’s hugo.toml file, they do not work:

[markup]
  [markup.highlight]
    noClasses = false
    codeFences = true
    guessSyntax = true

If I put them at the top level (the site level) hugo.toml, they do work, but now were do I put the new CSS file? Out of place at the top level as well?

Maybe I’m going about making a theme for my code blocks all wrong. Is there a better way?

See https://gohugo.io/configuration/introduction/#merge-configuration-settings.

1 Like

This helped me keep the markup settings in the theme settings, but it still requires the site-level settings to be changed in order for the theme to work correctly. I’ll take it, but it would be better if a user could just install a theme and have it work as intended without setting anything more than the theme setting at the top level.

The default markup merge setting (none) prevents theme/module authors from doing things like:

[markup.goldmark.renderer]
unsafe = true

That’s just one example… there are many.

1 Like

I’ll just document the edge case in the event that somebody actually cares enough to use my theme. Let’s be honest: it’s most likely that nobody ever will.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.