Mauro Carvalho Chehab
ab9150972f
docs: kdoc_output: better handle lists
...
On several functions, the return values are inside a bullet
list. Also, on some places, there are numbered lists as well.
Use a troff markup to format them, to avoid placing everything
on a single line.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <edea87623550a51086c23c9af0edc5e9fcce0ed6.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:39 -06:00
Mauro Carvalho Chehab
908ae13b18
docs: kdoc_output: add support to handle code blocks
...
It is common to have code blocks inside kernel-doc markups.
By default, troff will group all lines altogether, producing a
very weird output. If a code block is detected by disabling
filling inside code blocks, re-enabling it afterwards.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <fb6f16ad345f7ec1b1ebe4c5ec7ea3d9cd6de4fb.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:39 -06:00
Mauro Carvalho Chehab
4ec130cff6
docs: kdoc_output: add a logic to handle tables inside kernel-doc markups
...
specially when DOC is used, it is not uncommon to have tables
inside a kernel-doc markup.
Add support for simple tables and complex grid tables when output
in groff format.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <442ad76442c325044eb9f34a155d5f484341fb35.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
cde7c96f88
docs: kdoc_output: Change the logic to handle man highlight
...
The code inside ManFormat code to output man pages is too simple:
it produces very bad results when the content has tables or code
blocks.
Change the way lines are parsed there to allow adding extra
logic to handle some special cases.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <6ae2301a40b3fcb4381dd9dda8c75d14f9616b46.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
e4dadcf510
docs: kdoc_output: pick a better default for modulename
...
Instead of placing the same data for modulename for all generated
man pages, use the directory from the filename used to produce
kernel docs as basis.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <8a5d91c93c0b9b34c2f60e389f4464742804d0d6.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
26b4fdefc0
docs: kdoc_output: describe the class init parameters
...
As this class is part of the ABI used by both Sphinx kerneldoc
extension and docs/tools/kernel-doc, better describe what
parmeters are used to initialize ManOutput class.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <7c57f26150aae11fced259f30898a980b96efb68.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
4160533d05
docs: kdoc_output: fix naming for DOC markups
...
Right now, DOC markups aren't being handled properly, as it was
using the same name for all output.
Fix it by filling the title argument on a different way.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <11d809e5c4bec23240d3ace3f342dbb2a9263446.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
1a63342a27
docs: kdoc_output: don't use a different modulename for functions
...
It doesn't make much sense to have a different modulename just
for functions, but not for structs/enums/...
Use the same header everywere.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <978259bdf3e8d310c646ecf76ce56d054f6d5738.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
31938f120f
docs: kdoc_output: use a single manual for everything
...
There's no reason why functions will be on a different manual.
Unify its name, calling it as "Kernel API Manual".
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <000e1174a551e97ad4710ad4f3750b22017bedd5.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
43874045fa
docs: kdoc_output: remove extra attribute on man .TH headers
...
According with modern documents, groff .TH supports up to 5
arguments, but the logic passes 6. Drop the lastest one
("LINUX").
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <f5e480af877903b0596b6a56ef7a152eb8a10dbf.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
c1873e7743
docs: kdoc_output: use a method to emit the .TH header
...
All man emit functions need to add a .TH header. Move the code
to a common function, as we'll be addressing some issues at
the common code.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <2e55fcfe8724fde08a78635a1a3f8b449a6adf82.1772810752.git.mchehab+huawei@kernel.org >
2026-03-09 10:34:38 -06:00
Mauro Carvalho Chehab
245f1ab2c9
docs: kdoc_output: Improve docstrings and comments
...
In preparation to document kernel-doc module, improve its
documentation.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <ac03bf776f0929bbe822cd8269f2a31e275b8d6b.1768838938.git.mchehab+huawei@kernel.org >
2026-01-23 11:37:38 -07:00
Mauro Carvalho Chehab
bdd1cf8784
kernel-doc: add support to handle DEFINE_ variables
...
Improve the parser and output plugin to work with macros,
adding support for the common pattern of using DEFINE_*
to create variables.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <757a45100cfc493984574ff780aa9d90506eecb4.1765894964.git.mchehab+huawei@kernel.org >
2025-12-22 14:43:25 -07:00
Mauro Carvalho Chehab
1045ec382c
kernel-doc: add support for handling global variables
...
Specially on kAPI, sometimes it is desirable to be able to
describe global variables that are part of kAPI.
Documenting vars with Sphinx is simple, as we don't need
to parse a data struct. All we need is the variable
declaration and use native C domain ::c:var: to format it
for us.
Add support for it.
Link: https://lore.kernel.org/linux-doc/491c3022-cef8-4860-a945-c9c4a3b63c09@infradead.org/T/#m947c25d95cb1d96a394410ab1131dc8e9e5013f1
Suggested-by: Randy Dunlap <rdunlap@infradead.org >
Tested-by: Randy Dunlap <rdunlap@infradead.org >
Acked-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <fa7d1c61a8de9150f71b318382f1507d3b13848d.1765894964.git.mchehab+huawei@kernel.org >
2025-12-22 14:43:25 -07:00
Randy Dunlap
5f88f44d84
docs: kdoc: various fixes for grammar, spelling, punctuation
...
Correct grammar, spelling, and punctuation in comments, strings,
print messages, logs.
Change two instances of two spaces between words to just one space.
codespell was used to find misspelled words.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: linux-doc@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org >
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <20251124041011.3030571-1-rdunlap@infradead.org >
2025-11-29 08:35:23 -07:00
Jonathan Corbet
992a9df41a
docs: bring some order to our Python module hierarchy
...
Now that we have tools/lib/python for our Python modules, turn them into
proper packages with a single namespace so that everything can just use
tools/lib/python in sys.path. No functional change.
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <20251110220430.726665-3-corbet@lwn.net >
2025-11-18 09:22:40 -07:00
Jonathan Corbet
778b8ebe51
docs: Move the python libraries to tools/lib/python
...
"scripts/lib" was always a bit of an awkward place for Python modules. We
already have tools/lib; create a tools/lib/python, move the libraries
there, and update the users accordingly.
While at it, move the contents of tools/docs/lib. Rather than make another
directory, just put these documentation-oriented modules under "kdoc".
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
Message-ID: <20251110220430.726665-2-corbet@lwn.net >
2025-11-18 09:22:40 -07:00