mivinci / hugo-theme-minima

A clean and minimal Hugo theme.
https://mivinci.github.io/hugo-theme-minima
MIT License
132 stars 37 forks source link

Missing support for line highlighting #20

Closed Wirone closed 2 years ago

Wirone commented 2 years ago

Hi, first of all thank you for the theme 🙂 I've started using it, but there is one feature that I miss: line highlighting.

Consider this:

```php {hl_lines=[5]}
<?php

class Foo {
    public function shout(): string {
        die('BAR!');
    }
}

die('BAR!'); should be highlighted, but it's not because support for .chroma .hl is missing. I was able to override syntax.scss and add it but it's not that easy since code's content is not full-width and it looks weird:

image

Probably I need to override whole SASS config and use hugo gen chromastyles for syntax highlighting. Thanks in advance for fixing it.

mivinci commented 2 years ago

Ahh… thanks for your feedback! I'll go figure out what these things are and how they work. But I guess it's not possible to fix the line highlighting because those line numbers and codes are in two separate columns generated by hugo, I can do nothing to change it's generated HTML code, but probably I'm missing something. Anyways, I will try to make it right.

Wirone commented 2 years ago

For the record, with noClasses = true it's somehow working:

image

It looks slightly worse because line height is not working. But it is also rendered with 2 tds (line numbers + code) and it's full-width. So most probably it's possible to achieve it with classes 😉

Wirone commented 2 years ago

PS: I was able to slightly improve line highlighting by overriding syntax.scss and adding:

.chroma .hl {
  background-color: #585858;
}

.chroma .lnt {
  display: inline;
}
image

Line number is also highlighted and for now it should be enough. But with full-width it would look much better IMHO 🙂

mivinci commented 2 years ago

Sorry for the delay. I just got time to deal with this. Now a full-width line highlighting is available. #5a2a7cc SSC37SNQEYFO@1DFJ)CTB@T

Wirone commented 2 years ago

Thanks! 🍻