halogenica / beautifulhugo

Theme for the Hugo static website generator
Other
1.14k stars 601 forks source link

Odd code syntax highlighting when using `useHLJS = true` and Chroma #418

Open robamu opened 2 years ago

robamu commented 2 years ago

Hello,

Hugo version: hugo v0.91.2+extended linux/amd64 BuildDate=2021-12-23T20:50:11Z OS: Ubuntu 21.04

Pygments and Python3 are installed.

I have issue with problematic syntax highlighting right now. My config.toml looks like this:

baseURL = "https://robamu.github.io"
languageCode = 'en-us'
title = 'robs blog'
theme = "beautifulhugo"
disqusShortname = "https-robamu-github-io"

pygmentsStyle = "pygments"
pygmentsUseClasses = true
pygmentsCodeFences = true
pygmentsCodefencesGuessSyntax = true

enableGitInfo = true

[markup]
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = true

[Params]
  title = "robs blog"
  keyword = "coding, rust, c++, python, aerospace, satellites"
  about_me = true
  commit = false
  comments = true
  useHLJS = false
  # useHLJS = true
  readingTime = true
  socialShare = true
  showRelatedPosts = true
  delayDisqus = true
  # Google Programmable Search Engine
  gcse = "49f27010d1fda4554"
  # Footer section
  [params.footer]
    enable = true

...

If I use useHLJS = false, the rust code block seems to be rendered fine

rust-code-block

However, the console markup on another page is problematic now. There is no slidebar, and some stuff is cut-off:

console-markup

If I use useHLJS = true, the rendering for the Rust code doesnt seem to work anymore:

bland

but now the console snippet looks like I want it to be

console-snippet

slidebar is there and the colors look better as well.

Do you have any ideas what might be the issue? How to best debug this?

This is the example rust codeblock:

```rs
/// Use the SPI clock as the conversion clock
fn adc_example_externally_clocked(spi: SpiBase, mut delay: Delay) -> ! {
    let mut adc = max11619_externally_clocked_no_wakeup(spi)
        .expect("Creating externally clocked MAX11619 device failed");
    if READ_MODE == ReadMode::AverageN {
        adc.averaging(
            AveragingConversions::FourConversions,
            AveragingResults::FourResults,
        )
        .expect("Error setting up averaging register");
    }
    let mut cmd_buf: [u8; 32] = [0; 32];
    let mut counter = 0;
    ...
}
```

and this is the example console code block

```console
[Raspberry Pi 4] rmueller@power-pinguin:~/Rust/rpi-rs-crosscompile(main)$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `python3 bld-deploy-remote.py -t -r --source target/armv7-unknown-linux-gnueabihf/debug/rpi-rs-crosscompile`
Running transfer command: sshpass  scp target/armv7-unknown-linux-gnueabihf/debug/rpi-rs-crosscompile pi@raspberrypi.local:"/tmp/rpi-rs-crosscompile"
Running target application: sshpass  ssh pi@raspberrypi.local /tmp/rpi-rs-crosscompile
 __________________________
< Hello fellow Rustaceans! >
 --------------------------
        \
         \
            _~^~^~_
        \) /  o o  \ (/
          '_   -   _'
          / '-----' \

```