Syntax highlighting issue
Konstantin Ryabitsev
konstantin at linuxfoundation.org
Wed Aug 26 18:11:14 CEST 2020
On Wed, Aug 26, 2020 at 05:59:06PM +0200, Mateja Maric wrote:
> I use cgit on my server (https://git.matejamaric.com) and syntax
> highlighting doesn't work for some reason.
>
> My config file is fine (I think) and python-pygments package is installed.
>
> The weirdest thing is that when I view page source, styling and html span
> tags are there, but code is still not colored for some reason.
If you look at the dev console, you will see the reason:
Refused to apply inline style because it violates the following Content
Security Policy directive: "default-src 'self'". Either the
'unsafe-inline' keyword, a hash
('sha256-icLlI0jX3/L5wqZp69+gNqGNNMcU6bh4T+qqxWv/2as='), or a nonce
('nonce-...') is required to enable inline execution. Note also that
'style-src' was not explicitly set, so 'default-src' is used as a
fallback.
You need to change the Content-Security-Policy header to set style-src
to allow inline styles. E.g. this is on git.kernel.org:
Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src https:
-K
More information about the CGit
mailing list