'How to fix the accident format with line number with Sphinx v4.5.0?
Originally, my codes in Sphinx v3.5.4 are quite well. I used the following codes.
.. code-block:: python
:caption: ex2.py: step 3
:name: ex2.py
:linenos:
:lineno-start: 1
:emphasize-lines: 2-5
def Sum(iN):
if (iN == 0):
return(0)
else:
return(iN + Sum(iN - 1))
iMax = 10
for i in range(1, iMax):
print(i, ':', Sum(i))
Then, the Sphinx will output normally as shown as below.
1 def Sum(iN):
2 if (iN == 0):
3 return(0)
4 else:
5 return(iN + Sum(iN - 1))
6
7 iMax = 10
8 for i in range(1, iMax):
9 print(i, ':', Sum(i))
However, after rendered from the Sphinx v4.5.0, my example code is shown as below.
1 def Sum(iN):
2
if (iN == 0):
3
return(0)
4
else:
5
return(iN + Sum(iN - 1))
6
7 iMax = 10
8 for i in range(1, iMax):
9 print(i, ':', Sum(i))
Basically, I remove the :lineno: parameter, the accident line-break condition is disappear. Anyway, it might be come with line-number feature. Is there anyone has any solution to solve this problem?
Note that I used the following required modules in my environment.
sphinx==4.5.0
graphviz==0.19.1
sphinxcontrib-plantuml==0.23
sphinxcontrib-blockdiag==2.0.0
sphinxcontrib-actdiag==2.0.0
sphinxcontrib-nwdiag==2.0.0
sphinxcontrib-seqdiag==2.0.0
sphinxbootstrap4theme>=0.6.0
sphinxcontrib.bibtex==2.4.2
sphinxcontrib.httpdomain==1.8.0
sphinx-autorun==1.1.1
sphinx-copybutton==0.5.0
hieroglyph==2.1.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
