Opened 11 years ago

Closed 5 years ago

#4586 enhancement closed wontfix (wontfix)

Code-listings generated by lore2sphinx should include line-numbers

Reported by: Screwtape Owned by:
Priority: normal Milestone: Lore to Sphinx
Component: core Keywords: documentation
Cc: khorn, Thijs Triemstra Branch:


exarkun, in ticket #4566 comment 5:

One thing I noticed while reviewing this, though, is that code listings no longer have line numbers. Could you file a ticket for that?

It looks like Lore puts line-numbers on <pre class="python"> blocks, but not on python-interpreter or shell blocks.

From what I can see in the Sphinx docs, this can be enabled on a per-document basis with a fragment of code like:

.. highlight:: python
   :linenothreshold: 1

...but it would be even better if that could be set as a project-wide setting; I'm not sure if that's possible.

Change History (5)

comment:1 Changed 11 years ago by khorn

This can also be set for individual code blocks like so:

.. code-block:: python

   Code goes here...

As far as a project-wide setting for :linenothreshold:, I don't think this is possible (at least not yet).

Also, I believe the "highlight" directive only works on blocks that begin with "::", rather than ".. code-block", but I'm not positive about that.

comment:2 Changed 11 years ago by <automation>

Owner: Glyph deleted

comment:3 Changed 11 years ago by Thijs Triemstra

Cc: Thijs Triemstra added
Milestone: Lore to Sphinx

comment:4 Changed 10 years ago by khorn

After some investigation, it seems that the "linenothreshold" option of the "highlight" directive only works on automatically-highlighted blocks, which as far as I can tell means blocks beginning with "::" and blocks included with the "literalinclude" directive.

Blocks created with "code-block" directives do not recognize the "linenothreshold" option. Line numbers can be enabled on them, but need to be done so individually.

It shouldn't be too difficult to get lore2sphinx to generate the proper options for the "code-block" directives to show line numbers if we decide we want it to.

comment:5 Changed 5 years ago by Glyph

Resolution: wontfix
Status: newclosed

lore2sphinx is as good as it's gonna get, so closing these tickets that reference it.

Note: See TracTickets for help on using tickets.