getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
14k stars 965 forks source link

Sintax highlighting of `?Sized` rust code is invalid #2416

Open sgued opened 10 months ago

sgued commented 10 months ago

Bug Report

Environment

Zola version: 18.0

Expected Behavior

In a rust code block, in a template, ?Sized is valid and should be highlighted correctly.

image

Current Behavior

image

Step to reproduce

Build a site with syntax highlighting enable, and include the following valid rust code block:

pub struct Testing<T: ?Sized> {
    testing: T,
}

Workaround

This workaround fully disables highlighting of "invalid" code, so it may not be suitable for everyone. Use css styles and add the following CSS, loaded after the syntax theme itself:

// Fix bad syntax highlighting of ?Sized
.z-invalid {
  color: inherit;
  background-color: inherit;
}

.z-illegal {
  color: inherit;
  background-color: inherit;
}
Keats commented 10 months ago

It's a known issue: https://github.com/getzola/zola/issues/1787