zola icon indicating copy to clipboard operation
zola copied to clipboard

Using embedding in custom sublime syntaxes causes panic

Open marier-nico opened this issue 2 years ago • 1 comments

Bug Report

Environment

Zola version: 0.14.1

Expected Behavior

Zola builds the site without any errors.

Current Behavior

I get the following panic : thread '<unnamed>' panicked at 'Can only call resolve on linked references: ByScope { scope: <source.bash>, sub_context: None }', /build/.cargo/registry/src/github.com-1ecc6299db9ec823/syntect-4.6.0/src/parsing/syntax_definition.rs:191:18

I did some digging, and my best guess as to what's causing the panic is that syntect can't see the existing bash syntax, or maybe it's not made aware of it. I'm not sure of how Zola is using syntect or how syntect works, so I don't really have a more precise idea, but I think that might be it. At the very least, I'm almost certain the embed in the sublime-syntax is triggering the issue here.

Step to reproduce

  • Run zola init to make a new basic project (and enable code highlighting)
  • Create content/_index.md and inside create a code block with the crontab language (it's important to have the script part because that's where the bash embed is used)
    ```crontab
    0 0  *   *   *     /some/script
    ```
  • Edit config.toml to add extra_syntaxes = ["syntaxes"] under the [markdown] section
  • Create syntaxes/Crontab.sublime-syntax with the contents of this file
  • In syntaxes/Crontab.sublime-syntax, replace source.shell with source.bash on lines 201 and 210
  • Run zola build

marier-nico avatar Sep 01 '21 00:09 marier-nico

Related to #1678 which shows a workaround

jalil-salame avatar Apr 26 '24 19:04 jalil-salame