From ccf9fdaa79a22f3273d39790313ac2babad01699 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 4 Dec 2024 12:44:25 +0300 Subject: [PATCH 1/2] Document setting for source code links --- docs/configuring.rst | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/configuring.rst b/docs/configuring.rst index b2d3eddd4..70d9b3bcb 100644 --- a/docs/configuring.rst +++ b/docs/configuring.rst @@ -221,8 +221,26 @@ Miscellaneous options File-wide metadata ================== -The following options can be used as :ref:`file-wide metadata -`: +The following features are confugured per file in :ref:`file-wide metadata +`, but they could also be set for all files using +:ref:`html_context ` setting. + +Enable "Edit on ..." links +-------------------------- + +To enable "Edit on GitHub" link, you can add ``github_url`` option to the +metadata of specific page, or use ``html_context`` to make this option set +for all pages. + +For example: + +.. code:: python + + html_context = { + 'github_url': 'https://github.com/readthedocs/sphinx_rtd_theme' + } + +Note that such URLs are static. .. confval:: github_url @@ -236,6 +254,19 @@ The following options can be used as :ref:`file-wide metadata Force the :guilabel:`Edit on GitLab` button to use the configured URL. +To generate dynamic URLs, there exists a set of other options. + +.. code:: python + + html_context = { + 'display_github': True, + # 'github_host': 'github.com', + 'github_user': 'readthedocs', + 'github_repo': 'sphinx_rtd_theme', + 'github_version': 'master/' + } + + Other configuration =================== From 4e263b38aa3cdb70aebc8a193561c99a4f4c3071 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 4 Dec 2024 13:44:42 +0300 Subject: [PATCH 2/2] Fix path for Edit URLs --- docs/configuring.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuring.rst b/docs/configuring.rst index 70d9b3bcb..31a0a2dd1 100644 --- a/docs/configuring.rst +++ b/docs/configuring.rst @@ -263,7 +263,7 @@ To generate dynamic URLs, there exists a set of other options. # 'github_host': 'github.com', 'github_user': 'readthedocs', 'github_repo': 'sphinx_rtd_theme', - 'github_version': 'master/' + 'github_version': 'master/docs/' }