Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misaligned line numbers in diff files with `line_numbers: :inline` #232

pablobm opened this Issue Dec 26, 2018 · 1 comment


None yet
1 participant
Copy link

pablobm commented Dec 26, 2018

Say we have a diff file, test.diff:

--- file1	2018-12-26 11:14:56.000000000 +0000
+++ file2	2018-12-26 11:15:08.000000000 +0000
@@ -1,4 +1,3 @@

And we run CodeRay with the following options:

CodeRay.scan("test.diff"), :diff).page(css: :class, line_numbers: :inline)

The resulting HTML+CSS shows the line numbers misaligned, as follows:


The following example is the same output, with the CSS rules width: 40em; margin: auto; applied to the .CodeRay block to highlight "wrapped-over" line numbers and content:


This is the expected behaviour, achieved by not using the option line_numbers: :inline:



This comment has been minimized.

Copy link

pablobm commented Dec 26, 2018

At first inspection, it would appear that the CSS properties for .CodeRay .line don't play well with the line numbers. This class is applied to the lines with colour background to allow the colour cover the whole line. When these properties are removed, the problem disappears, but the colour stops covering the whole line:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.