sphinx-doc / sphinx-doc/sphinx

`:number-lines: 0` for includes does not work correctly with docutils 0.22

Open
#14,261 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docutils type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Because of this change: https://github.com/live-clones/docutils/commit/f39ac1413e56a330c8fea6e0d080fed0ff2b8483

.. include:: ...
   :code: python
   :number-lines: 0

.. include:: ...
   :literal:
   :number-lines: 0

Now numbering starts at 1 rather than 0

This is because the value parsed from the directive option has now changed from a None|str to None|int,
previously int("0" or 1) turned into 0, but now 0 or 1 turns into 1

How to Reproduce

...

Environment Information
...
Sphinx extensions

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the include directive handles the :number-lines: option with docutils 0.22. Reproduce the two examples from the issue, then add or update a regression test confirming that :number-lines: 0 starts numbering at zero for both code and literal includes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.