Junyi-99 / hugo-theme-anubis2

Anubis2 is a simple but elegant theme for Hugo blog engine
https://hugo-theme-anubis2.netlify.app/
MIT License
44 stars 15 forks source link

Line numbers don't show up in code blocks #37

Closed gsingh93 closed 5 months ago

gsingh93 commented 5 months ago

If I enable linenos for a code block, the line numbers don't show up:

```c {linenos=true,hl_lines=[1,"3-4"]}
int main() {
    int a;
    int b;
    int c;
}

How it looks:
<img width="769" alt="image" src="https://github.com/Junyi-99/hugo-theme-anubis2/assets/1012677/1b8ad1c1-170e-480d-939b-6372a5543bf5">

Checking the HTML shows that they're there, but the color matches the background. I tested with the "friendly" and "monokai" themes.

Only somewhat related, but I think there are extra borders being generated with `linenos=true` that don't look good by default, would be nice to have better styling here.
gsingh93 commented 5 months ago

Interestingly, line numbers show up with this configuration in config.toml:

[markup.highlight]
noClasses = false

And then generating the styles with hugo gen chromastyles. But it still doesn't look great, could use some improved styling:

image
Junyi-99 commented 5 months ago

Thank you for the explanation as I have not tested this before so I don't know if the number is not working.

I'll solve this when I have time.

Junyi-99 commented 5 months ago

Interestingly, line numbers show up with this configuration in config.toml:

[markup.highlight]
noClasses = false

And then generating the styles with hugo gen chromastyles. But it still doesn't look great, could use some improved styling: image

If markup.highlight.noClasses=false is used in the site configuration, a stylesheet is required. However, there is a problem with the base style, so the provided stylesheet does not work.

Junyi-99 commented 5 months ago

The branch feat-experimental-config contains the latest fix, but it still need some tests to be merged into main.

Here is the preview of the latest fix:

image
Junyi-99 commented 5 months ago

the change has been merged.