linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: automarkup: Mark up undocumented entities too
@ 2025-06-03 17:20 Jonathan Corbet
  2025-06-03 19:44 ` Nícolas F. R. A. Prado
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Corbet @ 2025-06-03 17:20 UTC (permalink / raw)
  To: linux-doc; +Cc: Mauro Carvalho Chehab, Nícolas F. R. A. Prado

The automarkup code generates markup and a cross-reference links for
functions, structs, etc. for which it finds kerneldoc documentation.
Undocumented entities are left untouched; that creates an inconsistent
reading experience and has caused some writers to go to extra measures to
cause the markup to happen.

Mark up detected C entities regardless of whether they are documented.
Change the CSS, though, to underline the entities that actually link to
documentation, making our docs a bit more consistent with longstanding WWW
practice and allowing readers to tell the difference.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/sphinx-static/custom.css | 5 +++++
 Documentation/sphinx/automarkup.py     | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/sphinx-static/custom.css b/Documentation/sphinx-static/custom.css
index f4285417c71a..771984f77307 100644
--- a/Documentation/sphinx-static/custom.css
+++ b/Documentation/sphinx-static/custom.css
@@ -136,3 +136,8 @@ div.language-selection:hover ul {
 div.language-selection ul li:hover {
     background: #dddddd;
 }
+
+/* Mark xrefs with an underline, but elide it for those that
+   don't lead anywhere */
+.xref { text-decoration: underline; }
+.broken_xref { text-decoration: none !important; }
diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/automarkup.py
index 347de81c1ab7..cede07e758a7 100644
--- a/Documentation/sphinx/automarkup.py
+++ b/Documentation/sphinx/automarkup.py
@@ -241,8 +241,13 @@ def add_and_resolve_xref(app, docname, domain, reftype, target, contnode=None):
 
     if xref:
         return xref
-
-    return None
+    #
+    # We didn't find the xref; if a container node was supplied,
+    # mark it as a broken xref
+    #
+    if contnode:
+        contnode.set_class("broken_xref")
+    return contnode
 
 #
 # Variant of markup_abi_ref() that warns whan a reference is not found
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-06-04 14:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 17:20 [PATCH] docs: automarkup: Mark up undocumented entities too Jonathan Corbet
2025-06-03 19:44 ` Nícolas F. R. A. Prado
2025-06-03 21:12   ` Jonathan Corbet
2025-06-03 21:35     ` Nícolas F. R. A. Prado
2025-06-03 22:47       ` Jonathan Corbet
2025-06-03 23:04         ` Jonathan Corbet
2025-06-04  7:37           ` Mauro Carvalho Chehab
2025-06-04 13:19             ` Nícolas F. R. A. Prado
2025-06-04 14:22               ` Jonathan Corbet
2025-06-03 21:27   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).