Re: [PATCH v2] docs: dt: Make references and mention kernel abstractions

From: Akira Yokosawa
Date: Mon May 08 2023 - 11:10:11 EST


Hi,

On Date: Mon, 8 May 2023 21:13:05 +0700, Bagas Sanjaya wrote:
> On Sat, May 06, 2023 at 03:09:11PM -0700, Randy Dunlap wrote:
>> For @linux-doc: Is there something in ReST that does auto section numbering
>> so that this renumbering does not have to be repeated in the future?
>>
>
> There is sectnum:: directive which does the job. In the kernel docs,

Just for you info:

In Sphinx documentation at:
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#directives

has a warning which reads:

Warning
Do not use the directives sectnum, header and footer.

Sphinx prefers the the :numbered: option of the toctree:: directive.
See https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree

This directive applies to the documentation as a whole, not to each .rst
file.

An example is at:
https://www.kernel.org/doc/html/latest/process/development-process.html

Just my two cents.

Thanks, Akira

> however, it is customarily used together with contents:: directive to
> generate toctree for current doc. In order for this to work as expected,
> you need also to rearrange section heading levels, like:
>
> ---- >8 ----
> diff --git a/Documentation/devicetree/usage-model.rst b/Documentation/devicetree/usage-model.rst
> index 87f522d5feba81..890dde293540f9 100644
> --- a/Documentation/devicetree/usage-model.rst
> +++ b/Documentation/devicetree/usage-model.rst
> @@ -1,5 +1,8 @@
> .. SPDX-License-Identifier: GPL-2.0
>
> +.. contents::
> +.. sectnum::
> +
> ========================
> Linux and the Devicetree
> ========================