Skip to content

highlight_themes_css workflow are seriously bugged #2995

@bitinn

Description

@bitinn

Bug Report

Environment

Zola version: 0.21

Expected Behavior

  1. changing config.toml should refresh css files defined by highlight_themes_css

  2. if a template reference the css files, it should generate the css files before the site build and get_url links check

Current Behavior

  1. theme attribute changes in highlight_themes_css are not reflected in a zola serve environment, the only way to trigger a refresh is by deleting those css files, changing highlight_theme = "css" to a theme name (which zola will then regenerate these 2 files)

  2. if we zola build or zola serve a site with following config, and have a template linking to the filenames using get_url, automatic link checking will cause the build to fail with errors, quoted below:

highlight_theme = "css"
highlight_themes_css = [
  { theme = "two-dark", filename = "code-dark.css" },
  { theme = "solarized-light", filename = "code-light.css" },
]
        {% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
              {% for theme in config.markdown.highlight_themes_css %}
                  {% if theme.filename is containing("dark") %}
                      {% set scheme = "dark" %}
                  {% else %}
                      {% set scheme = "light" %}
                  {% endif %}
                  <link rel="stylesheet" href="{{ get_url(path=theme.filename, cachebust=true) }}" media="(prefers-color-scheme: {{ scheme }})" />
              {% endfor %}
        {% endif %}
Error: Reason: Failed to render 'archive.html'
Error: Reason: Function call 'get_url' failed
Error: Reason: `get_url`: Could not find or open file code-dark.css

Step to reproduce

See above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions