"Unknown section" error because of something in a Literal block

Open
#412 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the supplied docstring with Sphinx 5.0.2 and numpydoc 1.4.0, comparing the warning and HTML output with the two documented workarounds. Done means the literal block no longer produces an “Unknown section” warning and renders correctly without requiring either workaround.

Written by the indexing model from the issue text.

Description

I have the following docstring:

Returns the quadric with matrix ::

     I |
    ---+-----
       | 0 1
       | 1 0

Returns
-------
Quadric

Building this, I get the warning Unknown section I | in the docstring of.... The html looks like this:

Screenshot 2022-06-23 at 15 14 38

So clearly something is wrong there too.

I've found two workarounds: Either add a character to the end of the first line of the block, as in

 I |.
---+-----
   | 0 1
   | 1 0

or remove the leading space from the first line, as in

I  |
---+-----
   | 0 1
   | 1 0

Tested with sphinx 5.0.2, numpydoc 1.4.0.

Dominant language
Python
Stars
355
Forks
181
Avg merge
1d 9h
Merged PRs (30d)
3

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.

More from numpy/numpydoc

All issues in numpy/numpydoc

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.