Prism JS Line Numbers Strangeness

I have added Prism JS syntax highlighting to my theme.

I compiled prism on the pris js site to include various languages and some plugins (including copy to clipboard and line numbers)

On post.hbs I have added to the top:

Screenshot 2020-02-17 at 22.45.31

To the bottom I have added:

Here is the output on the front-end:

As you can see, the line 1 is blank and the last line has no number (it should be line 12)

I have checked the code entry and there is no blank line at the top.

Anybody come across this before or know of a solution?

Hey there. That’s odd, looks like it could be misaligned and something is pushing the code down. Do you have a link to the page so I can debug it? Could be solved with some CSS :slight_smile:

1 Like

Thanks for the reply.

It was indeed the theme’s css that was adding padding to the pre>code

Sometimes we overthink these things and miss the obvious:-)

1 Like

If you could share your found solution it might help others!

It was theme specific on a custom theme.

So, if someone comes across a similar problem in future, always check the theme css for padding on the pre and code elements

3 Likes