Re: [PATCH] kernel-doc: better handle '::' sequences

From: Matthew Wilcox
Date: Tue Mar 30 2021 - 09:07:22 EST


On Tue, Mar 30, 2021 at 02:43:45PM +0200, Markus Heiser wrote:
>
> Am 30.03.21 um 13:35 schrieb Jani Nikula:
> > > If the introduction were "/*rST" instead of "/**", would we have
> > > consensus? It gives us a path to let people intermix kernel-doc and
> > > hawkmoth comments in the same file, which would be amazing.
>
> > If you want to allow two syntaxes for documentation comments (current
> > kernel-doc and pure reStructuredText with just the comment markers and
> > indentation removed) I think the natural first step would be to modify
> > kernel-doc the perl script to support that. It would probably even be
> > trivial.
>
> My 2cent: to tag the markup of the documentation, in python they
> use a variable named __docformat__ [PEP-258] / e.g.:
>
> __docformat__ = "restructuredtext en"
>
> [PEP-258] https://www.python.org/dev/peps/pep-0258/#choice-of-docstring-format

I don't think we need to do that. We can use

.. kernel-doc:: foo.c

to indicate the comments are in kernel-doc format and

.. hawkmoth:: bar.c

to indicate the comments are in hawkmoth format. Of course, that means
we have to choose for an entire .c file whether it's in hawkmoth or
kernel-doc format, but that's also true for pep-258.

> > Perhaps the bare minimum is running rustdoc first, and generating the
> > results into Sphinx static pages [1], to make them part of the
> > whole. Even if the HTML style might be different.
>
> Cross referencing will be problematic, I think.

That would be a second step. I'd rather see the rst files gain the
ability to have:

.. rustdoc:: quux.rs

to bring the markdown into the sphinx system.