Skip to contentSkip to conversation

checkpatch doc suggestion

DISCUSSION Diederik de Haas 3 participants 7 messages Apr 30, 2024 – May 13, 2024 Documentation

lore
Share & tools
lore
#1 lore raw
Quoted 6 lines · Diederik de Haas

Hi,

I think it would be really useful if (f.e.) the following URL
https://docs.kernel.org/dev-tools/checkpatch.html#BAD_FIXES_TAG

would lead me straight to the BAD_FIXES_TAG explanation.

So to add link to arbitrary location in the docs, you have to explicitly add target (anchor) to desired location. Then you can reference it using the target's name. For example, to accomplish your suggestion above:

```
diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index 12796899584739..002b0aa68b8022 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -612,6 +612,8 @@ Commit message
 
     See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
 
+.. _bad_fixes_tag:
+
   **BAD_FIXES_TAG**
     The Fixes: tag is malformed or does not follow the community conventions.
     This can occur if the tag have been split into multiple lines (e.g., when
@@ -1254,3 +1256,4 @@ Others
 
   **TYPO_SPELLING**
     Some words may have been misspelled.  Consider reviewing them.
+    But have you :ref:`check this? <bad_fixes_tag>`

```

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#2 lore raw
Quoted 8 lines · On Friday, 3 May 2024 14:55:49 CEST Bagas Sanjaya wrote:
Quoted 4 lines

I think it would be really useful if (f.e.) the following URL
https://docs.kernel.org/dev-tools/checkpatch.html#BAD_FIXES_TAG

would lead me straight to the BAD_FIXES_TAG explanation.

So to add link to arbitrary location in the docs, you have to explicitly add target (anchor) to desired location. Then you can reference it using the target's name. For example, to accomplish your suggestion above:

Thanks for that hint as I indeed didn't know how to add anchors in .rst files.

Cheers,
Diederik

#3 lore raw
Quoted 4 lines · Diederik de Haas
Quoted 3 lines · On Friday, 3 May 2024 14:55:49 CEST Bagas Sanjaya wrote:
Quoted 3 lines

I think it would be really useful if (f.e.) the following URL
https://docs.kernel.org/dev-tools/checkpatch.html#BAD_FIXES_TAG

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

would lead me straight to the BAD_FIXES_TAG explanation.

So to add link to arbitrary location in the docs, you have to explicitly add target (anchor) to desired location. Then you can reference it using the target's name. For example, to accomplish your suggestion above:

Thanks for that hint as I indeed didn't know how to add anchors in .rst files.

OK, thanks!

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#4 lore raw
In reply to Bagas Sanjaya

Hi Bagas,

Quoted 22 lines · On Friday, 3 May 2024 14:55:49 CEST Bagas Sanjaya wrote:
Quoted 4 lines · Diederik de Haas

I think it would be really useful if (f.e.) the following URL
https://docs.kernel.org/dev-tools/checkpatch.html#BAD_FIXES_TAG

would lead me straight to the BAD_FIXES_TAG explanation.

So to add link to arbitrary location in the docs, you have to explicitly add target (anchor) to desired location. Then you can reference it using the target's name. For example, to accomplish your suggestion above:

```

(quoted diff) +0 -0

b/Documentation/dev-tools/checkpatch.rst index
12796899584739..002b0aa68b8022 100644

Documentation/dev-tools/checkpatch.rst +0 -0
@@ -612,6 +612,8 @@ Commit message
 
     See:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#desc
ribe-your-changes

Quoted 6 lines

+.. _bad_fixes_tag:
+
**BAD_FIXES_TAG**
The Fixes: tag is malformed or does not follow the community
conventions. This can occur if the tag have been split into multiple lines ```

Thanks to your hint and some experimentation, I managed to add id attributes to the various ``dl`` elements and can directly reference the tags :-)

But I noticed 2 things in the generated HTML documentation:
1) The id attributes are all lowercase, regardless of how I defined them in ``checkpatch.rst``
2) The underscores (``_``) have been replaced with dashes (``-``)

So instead of linking to checkpatch.html#BAD_FIXES_TAG I have to link to checkpatch.html#bad-fixes-tag. I was hoping that I could get the literal tags names (including underscores and uppercase letters) as id attribute.

Is something rst/sphinx always does or did I do something wrong?

Cheers,
Diederik

#5 lore raw

Hi,

Quoted 40 lines · Diederik de Haas

Hi Bagas,

Quoted 22 lines · On Friday, 3 May 2024 14:55:49 CEST Bagas Sanjaya wrote:
Quoted 4 lines · Diederik de Haas

I think it would be really useful if (f.e.) the following URL
https://docs.kernel.org/dev-tools/checkpatch.html#BAD_FIXES_TAG

would lead me straight to the BAD_FIXES_TAG explanation.

So to add link to arbitrary location in the docs, you have to explicitly add target (anchor) to desired location. Then you can reference it using the target's name. For example, to accomplish your suggestion above:

```

(quoted diff) +0 -0

b/Documentation/dev-tools/checkpatch.rst index
12796899584739..002b0aa68b8022 100644

Documentation/dev-tools/checkpatch.rst +0 -0
@@ -612,6 +612,8 @@ Commit message
 
     See:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#desc
ribe-your-changes

Quoted 6 lines

+.. _bad_fixes_tag:
+
**BAD_FIXES_TAG**
The Fixes: tag is malformed or does not follow the community
conventions. This can occur if the tag have been split into multiple lines ```

Thanks to your hint and some experimentation, I managed to add id attributes to the various ``dl`` elements and can directly reference the tags :-)

But I noticed 2 things in the generated HTML documentation:
1) The id attributes are all lowercase, regardless of how I defined them in ``checkpatch.rst``
2) The underscores (``_``) have been replaced with dashes (``-``)

Quoted 6 lines

So instead of linking to checkpatch.html#BAD_FIXES_TAG I have to link to checkpatch.html#bad-fixes-tag. I was hoping that I could get the literal tags names (including underscores and uppercase letters) as id attribute.

Is something rst/sphinx always does or did I do something wrong?

For authoritative info, I'd suggest consulting the reST reference for "Hyperlink Targets" at:

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-targets

and "Hyperlink References" at:

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-references

, and other related sections therein.

HTH, Akira

Quoted 2 lines

Cheers,
Diederik

#6 lore raw
Quoted 21 lines · On Monday, 13 May 2024 07:08:55 CEST Akira Yokosawa wrote:
Quoted 9 lines

Thanks to your hint and some experimentation, I managed to add id attributes to the various ``dl`` elements and can directly reference the tags :-)

But I noticed 2 things in the generated HTML documentation:
1) The id attributes are all lowercase, regardless of how I defined them in ``checkpatch.rst``
2) The underscores (``_``) have been replaced with dashes (``-``)

Quoted 5 lines

So instead of linking to checkpatch.html#BAD_FIXES_TAG I have to link to checkpatch.html#bad-fixes-tag. I was hoping that I could get the literal tags names (including underscores and uppercase letters) as id attribute.

Is something rst/sphinx always does or did I do something wrong?

For authoritative info, I'd suggest consulting the reST reference for "Hyperlink Targets" at:

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlin
k-targets

Quoted 6 lines

and "Hyperlink References" at:

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlin
k-references

, and other related sections therein.

https://docutils.sourceforge.io/docs/ref/rst/directives.html#identifier-normalization
taught me the reason why those conversions happened, so I'll use the normalized version in my patch submission as well so that there's a 1-on-1 match between the source and the generated id attribute in the html docs.

Quoted 1 line

HTH, Akira

It sure did, thanks!

Cheers,
Diederik