[PATCH linux-doc v2] docs/doc-guide: Clarify how to write tables

Joe Stringer posted 1 patch 2 years, 7 months ago
There is a newer version of this series
Documentation/doc-guide/sphinx.rst | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
[PATCH linux-doc v2] docs/doc-guide: Clarify how to write tables
Posted by Joe Stringer 2 years, 7 months ago
Prior to this commit, the kernel docs writing guide spent over a page
describing exactly how *not* to write tables into the kernel docs,
without providing a example about the desired format.

This patch provides a positive example first in the guide so that it's
harder to miss, then leaves the existing less desirable approach below
for contributors to follow if they have some stronger justification for
why to use that approach.

Signed-off-by: Joe Stringer <joe@isovalent.com>
---
v2: Simplify recommendation for either simple or grid table syntax
    Remove example, link to rST user reference
---
 Documentation/doc-guide/sphinx.rst | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index 23edb427e76f..77ac7dc27715 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -313,9 +313,18 @@ the documentation build system will automatically turn a reference to
 function name exists.  If you see ``c:func:`` use in a kernel document,
 please feel free to remove it.
 
+Tables
+------
+
+ReStructuredText provides several options for table syntax. Kernel style for
+tables is prefer *simple table* syntax or *grid table* syntax. See the
+`reStructuredText user reference for table syntax`_ for more details.
+
+.. _reStructuredText user reference for table syntax:
+   https://docutils.sourceforge.io/docs/user/rst/quickref.html#tables
 
 list tables
------------
+~~~~~~~~~~~
 
 The list-table formats can be useful for tables that are not easily laid
 out in the usual Sphinx ASCII-art formats.  These formats are nearly
-- 
2.34.1
Re: [PATCH linux-doc v2] docs/doc-guide: Clarify how to write tables
Posted by Randy Dunlap 2 years, 7 months ago
Hi,

On 4/22/23 10:52, Joe Stringer wrote:
> Prior to this commit, the kernel docs writing guide spent over a page
> describing exactly how *not* to write tables into the kernel docs,
> without providing a example about the desired format.
> > This patch provides a positive example first in the guide so that it's
> harder to miss, then leaves the existing less desirable approach below
> for contributors to follow if they have some stronger justification for
> why to use that approach.
> 
> Signed-off-by: Joe Stringer <joe@isovalent.com>
> ---
> v2: Simplify recommendation for either simple or grid table syntax
>     Remove example, link to rST user reference
> ---
>  Documentation/doc-guide/sphinx.rst | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
> index 23edb427e76f..77ac7dc27715 100644
> --- a/Documentation/doc-guide/sphinx.rst
> +++ b/Documentation/doc-guide/sphinx.rst
> @@ -313,9 +313,18 @@ the documentation build system will automatically turn a reference to
>  function name exists.  If you see ``c:func:`` use in a kernel document,
>  please feel free to remove it.
>  
> +Tables
> +------
> +
> +ReStructuredText provides several options for table syntax. Kernel style for
> +tables is prefer *simple table* syntax or *grid table* syntax. See the

   tables is to prefer
or
   tables prefers

Otherwise LGTM. It's good to have positive examples, not just negative ones.

Thanks.

> +`reStructuredText user reference for table syntax`_ for more details.
> +
> +.. _reStructuredText user reference for table syntax:
> +   https://docutils.sourceforge.io/docs/user/rst/quickref.html#tables
>  
>  list tables
> ------------
> +~~~~~~~~~~~
>  
>  The list-table formats can be useful for tables that are not easily laid
>  out in the usual Sphinx ASCII-art formats.  These formats are nearly

-- 
~Randy
Re: [PATCH linux-doc v2] docs/doc-guide: Clarify how to write tables
Posted by Joe Stringer 2 years, 7 months ago
On Sat, Apr 22, 2023 at 11:31 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi,
>
> On 4/22/23 10:52, Joe Stringer wrote:
> > Prior to this commit, the kernel docs writing guide spent over a page
> > describing exactly how *not* to write tables into the kernel docs,
> > without providing a example about the desired format.
> > > This patch provides a positive example first in the guide so that it's
> > harder to miss, then leaves the existing less desirable approach below
> > for contributors to follow if they have some stronger justification for
> > why to use that approach.
> >
> > Signed-off-by: Joe Stringer <joe@isovalent.com>
> > ---
> > v2: Simplify recommendation for either simple or grid table syntax
> >     Remove example, link to rST user reference
> > ---
> >  Documentation/doc-guide/sphinx.rst | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
> > index 23edb427e76f..77ac7dc27715 100644
> > --- a/Documentation/doc-guide/sphinx.rst
> > +++ b/Documentation/doc-guide/sphinx.rst
> > @@ -313,9 +313,18 @@ the documentation build system will automatically turn a reference to
> >  function name exists.  If you see ``c:func:`` use in a kernel document,
> >  please feel free to remove it.
> >
> > +Tables
> > +------
> > +
> > +ReStructuredText provides several options for table syntax. Kernel style for
> > +tables is prefer *simple table* syntax or *grid table* syntax. See the
>
>    tables is to prefer
> or
>    tables prefers
>
> Otherwise LGTM. It's good to have positive examples, not just negative ones.

Thanks, I'll fix this up and send a fresh version.