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

Code-blocks with line nos - lines and line numbers don't line up. #419

Closed
TonyFlury opened this issue May 3, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@TonyFlury
Copy link

commented May 3, 2017

Using the rtd Theme with this source :

.. code-block:: python
    :linenos:

    import tkinter as tk
    root = tk.Tk()
    w = tk.Label(root, text='Hello, world!')
    w.pack()
    root.mainloop()

The resultant rendered page has this :

mismatch

@TonyFlury

This comment has been minimized.

Copy link
Author

commented May 3, 2017

It seems to be that the line nos are rendered with a line height of 1.5 - and generated html seems to also state the same line height value for the code, but there seems to be a clash between the line heights set in the theme :

These two CSS rules get appled to the code block

.rst-content .highlight > pre {
line-height: normal;
}

and :

 div[class^="highlight"] pre {
         ....
     line-height: 1.5;
        ....
 }

but the line-height: normal; takes precedence; changing the line-height value in the first rule results in correctly aligining line nos and code.

return42 added a commit to return42/sphkerneldoc that referenced this issue Jun 15, 2017

CSS theme: fixed a line-height missmatch in RTD theme.
ref:  readthedocs/sphinx_rtd_theme#419

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

return42 added a commit to return42/boilerplate that referenced this issue Jun 15, 2017

RTD theme: readthedocs/sphinx_rtd_theme#419
Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de>
@Blendify

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2017

This is a duplicate of #417

@Blendify Blendify closed this Jun 19, 2017

ColinIanKing pushed a commit to ColinIanKing/linux-next-mirror that referenced this issue Jul 18, 2017

docs RTD theme: code-block with line nos - lines and line numbers don…
…'t line up.

In a code-block with line numbers (option :lineno:) there is a
misalignment of the rendered source code lines on the right side and the
line numbers on the left side.

  readthedocs/sphinx_rtd_theme#419

Since this issue is reported to the RTD theme project, it might be fixed
in the future (take this as a interim solution).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
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.