Am I able to add line numbers to a code block despite the theme?

I am currently using the them “Coder” and using ``` will insert a code block but without any lines, in other themes I’ve seen it with lines.

Is there anything I can do about this or not?

Thank you so much.

If you want to see line numbers, enable line numbers in the site configuration.

[markup.highlight]
linenos = true

https://gohugo.io/getting-started/configuration-markup/#highlight

Hey thanks for your reply, I can see that it does work when I put it in my hugo.toml but I have 2 concerns.

  1. How can I apply this to only one specific post?

  2. I tried to do this but it resulted in a big faulty code block in the middle of my post, I’ll add a picture below. If you know why this happen that would be great.

https://imgur.com/a/W39N2BB

Thank you very much for your help again.

```somelang {linenos=true}
xxx
```

I don’t know what that means.

Yes sorry I didn’t know how to explain it lol

If you take a look at the imgur link I included you can see what I mean.

Anyways if you can’t thanks for your help nonetheless

Edit: Nevermind, changed the true to inline and it worked perfectly, thanks for your help man!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.