numpydoc icon indicating copy to clipboard operation
numpydoc copied to clipboard

Support subsections in main description or in notes

Open anntzer opened this issue 6 years ago • 8 comments

It would be nice if it was possible to have subsections either in the "main" description or in the Notes section. Right now Matplotlib just uses bold to delineate such sections (e.g. in https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.plot.html#matplotlib.axes.Axes.plot "plotting labeled data"), which is not so nice semantically.

In theory, rst supports any kind of underlining to mark subsections (and sections), but numpydoc can probably mandate e.g. using ~~~ (or whatever looks nice to the devs). Also, rst just creates the section hierarchy following the order in which the various kinds of underlines occur, so I guess this may be problematic (assuming we want to keep compatibility with plain rst, which I think is nice to have) for subsections in the main description (but fine for the Notes section, at least).

anntzer avatar May 01 '19 10:05 anntzer

Agreed this would be nice, I'm always a little bit sad when I have to do **Subsection title**.

larsoner avatar May 01 '19 11:05 larsoner

Actually, now that I look at it, perhaps one can just use either the .. topic:: or the .. rubric:: rst directives (http://docutils.sourceforge.net/docs/ref/rst/directives.html#topic, http://docutils.sourceforge.net/docs/ref/rst/directives.html#rubric) and call it a day without needing specific support from numpydoc. (If so, perhaps this could be suggested in numpydoc's docs, as these directives are not very well-known, I'd say.)

anntzer avatar May 01 '19 22:05 anntzer

The indentation due to those directives y

On Thu., 2 May 2019, 8:21 am Antony Lee, [email protected] wrote:

Actually, now that I look at it, perhaps one can just use either the .. topic:: or the .. rubric:: rst directives ( http://docutils.sourceforge.net/docs/ref/rst/directives.html#topic, http://docutils.sourceforge.net/docs/ref/rst/directives.html#rubric) and call it a day without needing specific support from numpydoc. (If so, perhaps this could be suggested in numpydoc's docs, as these directives are not very well-known, I'd say.)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/numpy/numpydoc/issues/216#issuecomment-488459335, or mute the thread https://github.com/notifications/unsubscribe-auth/AAATH273R47XR3GL5JDTXYLPTIJWNANCNFSM4HJSYIBQ .

jnothman avatar May 02 '19 00:05 jnothman

looks like your message was cropped

anntzer avatar May 02 '19 10:05 anntzer

The indentation would be a bit disruptive perhaps in pydoc view relative to headings

jnothman avatar May 02 '19 11:05 jnothman

.. rubric:: is not followed by an indent block, it's basically a standalone title.

anntzer avatar May 02 '19 15:05 anntzer

Ahh right. Not the most transparent of ReST syntaxes, but perfect here. Add it to an example / format documentation and we can delay deciding on more engineering.

jnothman avatar May 02 '19 23:05 jnothman

I tested .. rubric:: Title and the output for me at least is very similar to **Title**. And .. topic:: did not work because of some complaint about not being in the main body.

larsoner avatar May 03 '19 15:05 larsoner