The SerializedConfig
object that is provided during template rendering does not include all of the elements of the source Config
object. In particular, an element that would be useful to a theme I’m working on is exposing the markdown
configuration.
I’d use this to allow the theme’s base template to automatically include the syntax-highlighting CSS files, something like this:
{% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
<link rel="stylesheet" type="text/css" href="/syntax-theme-dark.css" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" href="/syntax-theme-light.css" media="(prefers-color-scheme: light)" />
{% endif %}
which makes Lighthouse happier than using CSS imports and should marginally improve performance.
There’s a workaround, for sure - the site using the theme can be allowed to insert this code using a block.
I’d be happy to work on this and open a PR if the project is open to it.