gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.76k stars 7.53k forks source link

highlightling: Remove noHl (which has undefined behaviour) #9885

Open hofbi opened 2 years ago

hofbi commented 2 years ago

What version of Hugo are you using (hugo version)?

$ hugo version
0.95

Does this issue reproduce with the latest release?

I am using the docker version, so waiting for https://github.com/klakegg/docker-hugo/pull/64 to be merged

Problem

Based on https://github.com/wowchemy/wowchemy-hugo-themes/issues/2708, we observed

<span> instances are being inserted by Hugo which we would assume shouldn't happen when Hugo is configured with noHl: true. It's either a Hugo bug with the noHl option or there's an opportunity for Hugo team to allow the Hugo code block parser to be used to detect Mermaid diagram code blocks without highlighting any code or injecting any <span>.

The <span> instances being inserted cause rendering issues for code blocks in markdown slides.

bep commented 2 years ago

I must admit that I don't know what noHl was meant to mean. I suspect it was something we dragged over from Pygments. Maybe @jmooring could shed some light on this, but currently

If hl=true:

  1. If you have a known lang/lexer, we always highlights
  2. Else, we just wrap the code in a pre.
jmooring commented 2 years ago

I don't know what noHl was meant to mean

Same here, but I do know that the behavior changed a bit when we removed https://github.com/yuin/goldmark-highlighting in v0.93.0.

This option/attribute has never been documented, other than its presence in docs.json. If it were up to me, I'd remove the option and see what breaks in the wild.

bep commented 2 years ago

@hofbi I understand that the action suggested above does not solve your issue.