Highlighting & blank lines

When I put code blocks I’m having issues with an added blank line in the beginning and at the end. They occur for example if I:

  • use {linenos = table}
  • add left and right padding to <code>

Does anybody have an idea how to solve this?

Could you please provide an example and screenshot to help me to understand the issue? I couldn’t reproduce it.

Just put

```tex {linenos=table}                                                                                   

where you need to remove the dot at the end. (I didn’t find another way to put the backticks there.)

Do you mean the gap of line #1?

Well, in your picture are multiple issues:

  • a blank line before and after the code block
  • the gap in front of the line number
  • line numbers in the wrong line

Hmm, it’s a CSS issue.

You can avoid separating the line nos by setting the following configuration.

    lineNos = true
    lineNumbersInTable = false

Then the padding won’t break the layout.

If I add left and right padding to <code> it still breaks, even without line numbers.

You’ll need to remove {linenos=table} from the code blocks as well, I guess it will override the site configuration (markup.highlight.lineNumbersInTable).

That’s clear… it still renders wrongly

Could you please check the configuration? The issue is gone from my env.

there is a blank line at the top and at the bottom, no?

It’s just another CSS issue, which can be fixed by changing the display property, for example.

pre code {
    padding-left: 1rem;
    padding-right: 1rem;
    display: block;
1 Like

Indeed that solves it. But why doesn’t work Chroma out of the box…?!

It seems to work fine by default without any additional style (padding left and right).

  • we just spoke about linenos = table breaking it
  • it should stay stable when somebody changes the padding

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