From: "Nícolas F. R. A. Prado" <nfraprado@protonmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Randy Dunlap <rdunlap@infradead.org>,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Miguel Ojeda <ojeda@kernel.org>,
Andrew Klychkov <andrew.a.klychkov@gmail.com>,
lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com
Subject: [PATCH 2/2] docs: Document cross-referencing using relative path
Date: Thu, 28 Jan 2021 01:01:36 +0000 [thread overview]
Message-ID: <20210128010028.58541-3-nfraprado@protonmail.com> (raw)
In-Reply-To: <20210128010028.58541-1-nfraprado@protonmail.com>
Update the Cross-referencing section to explain how to create a
cross-reference to a document using relative paths and with no
additional syntax, by relying on automarkup.py.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
---
Documentation/doc-guide/sphinx.rst | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index 36ac2166ad67..ec3e71f56009 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -340,16 +340,26 @@ Rendered as:
Cross-referencing
-----------------
-Cross-referencing from one documentation page to another can be done by passing
-the path to the file starting from the Documentation folder.
-For example, to cross-reference to this page (the .rst extension is optional)::
-
- See Documentation/doc-guide/sphinx.rst.
-
-If you want to use a relative path, you need to use Sphinx's ``doc`` directive.
-For example, referencing this page from the same directory would be done as::
-
- See :doc:`sphinx`.
+Cross-referencing from one documentation page to another can be done simply by
+writing the path to the document file, no special syntax required. The path can
+be either absolute or relative. For absolute paths, start it with
+"Documentation/". For example, to cross-reference to this page, all the
+following are valid options, depending on the current document's directory (note
+that the ``.rst`` extension is required)::
+
+ See Documentation/doc-guide/sphinx.rst. This always works.
+ Take a look at sphinx.rst, which is at this same directory.
+ Read ../sphinx.rst, which is one directory above.
+
+If you want the link to have a different rendered text other than the document's
+title, you need to use Sphinx's ``doc`` role. For example::
+
+ See :doc:`my custom link text for document sphinx <sphinx>`.
+
+For most use cases, the former is preferred, as it is cleaner and more suited
+for people reading the source files. If you come across a ``:doc:`` usage that
+isn't adding any value, please feel free to convert it to just the document
+path.
For information on cross-referencing to kernel-doc functions or types, see
Documentation/doc-guide/kernel-doc.rst.
--
2.30.0
next prev parent reply other threads:[~2021-01-28 1:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 1:01 [PATCH 0/2] docs: Add support for relative paths in automarkup Nícolas F. R. A. Prado
2021-01-28 1:01 ` [PATCH 1/2] docs: Enable usage of relative paths to docs on automarkup Nícolas F. R. A. Prado
2021-01-28 1:01 ` Nícolas F. R. A. Prado [this message]
2021-02-04 23:28 ` [PATCH 0/2] docs: Add support for relative paths in automarkup Jonathan Corbet
2021-02-04 23:48 ` Randy Dunlap
2021-02-04 23:53 ` Jonathan Corbet
2021-02-05 1:07 ` Nícolas F. R. A. Prado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210128010028.58541-3-nfraprado@protonmail.com \
--to=nfraprado@protonmail.com \
--cc=andrealmeid@collabora.com \
--cc=andrew.a.klychkov@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkcamp@lists.libreplanetbr.org \
--cc=mchehab+huawei@kernel.org \
--cc=ojeda@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox