numpy / numpy/numpydoc

Can we have subsections in Examples?

Open
#390 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

For a docstrings with several examples, it would be nice to be able to clearly separate them:

Examples
-------------

Here we show two examples of our awesome function.

First example
~~~~~~~~~~

foo

Second example
~~~~~~~~~~~~~

bar

Just tried it and it seems to break the doc build:

/home/br/repos/scipy/scipy/doc/source/reference/generated/scipy.interpolate.RegularGridInterpolator.rst:33: CRITICAL: Unexpected section title.

Interpolation and extrapolation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [  2%] reference/generated/scipy.interpolate.Akima1DInterpolator.__calwriting output... [  3%] 

<snip>

dumping object inventory... done
build finished with problems, 1 warning.
make: *** [Makefile:118: html-scipyorg] Error 1

To illustrate the origin: note the As a second example, we... transition in
http://scipy.github.io/devdocs/reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator

Not sure if it's even that good of an idea, or how difficult it is to implement.

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 with the generated documentation example at scipy.interpolate.RegularGridInterpolator.rst and reproduce the documented Sphinx build failure shown in the issue. Trace how numpydoc handles multiple Examples sections and determine whether subsection titles can be supported; done means the example builds without the Unexpected section title error and the intended subsections render clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.