[Lldb-commits] [lldb] [lldb][Docs] Add edit link to docs pages (PR #102144)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 6 06:54:47 PDT 2024
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/102144
That aren't the generated `python_api/` pages.
This button is a pencil icon at the top right of the page and takes you to a GitHub page where you can edit the content, assuming you have a fork already. If not it tells you how to make one.
This is hardcoded to the llvm-project URL and main branch. So folks will need a downstream patch if they want to change that.
For the upstream repo, main is right because even if a release branch was open for PRs, it would only be for cherry picks from main.
The icon isn't as obvious as the "edit on GitHub" icons seen elsewhere but it's built in, and we could change it later if we wanted to.
>From 8fddf6f57dcb4bcdef78139f49718fcc2ea0fd20 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 6 Aug 2024 13:25:32 +0100
Subject: [PATCH] [lldb][Docs] Add edit link to docs pages
That aren't the generated `python_api/` pages.
This button is a pencil icon at the top right of the page and
takes you to a GitHub page where you can edit the content,
assuming you have a fork already. If not it tells you how to
make one.
This is hardcoded to the llvm-project URL and main branch.
So folks will need a downstream patch if they want to change
that.
For the upstream repo, main is right because even if a release
branch was open for PRs, it would only be for cherry picks from
main.
The icon isn't as obvious as the "edit on GitHub" icons seen
elsewhere but it's built in, and we could change it later if
we wanted to.
---
lldb/docs/_templates/components/edit-this-page.html | 9 +++++++++
lldb/docs/conf.py | 6 +++++-
2 files changed, 14 insertions(+), 1 deletion(-)
create mode 100644 lldb/docs/_templates/components/edit-this-page.html
diff --git a/lldb/docs/_templates/components/edit-this-page.html b/lldb/docs/_templates/components/edit-this-page.html
new file mode 100644
index 0000000000000..671caeac52f6d
--- /dev/null
+++ b/lldb/docs/_templates/components/edit-this-page.html
@@ -0,0 +1,9 @@
+{% extends "furo/components/edit-this-page.html" %}
+
+{% block link_available -%}
+{%- if pagename.startswith("python_api") -%}
+ <!-- Python API docs are generated. -->
+{%- else -%}
+ {{ furo_edit_button(determine_page_edit_link()) }}
+{%- endif -%}
+{%- endblock %}
\ No newline at end of file
diff --git a/lldb/docs/conf.py b/lldb/docs/conf.py
index 9b005c9537f23..7c9e2acd41457 100644
--- a/lldb/docs/conf.py
+++ b/lldb/docs/conf.py
@@ -166,7 +166,11 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-html_theme_options = {}
+html_theme_options = {
+ "source_repository": "https://github.com/llvm/llvm-project",
+ "source_branch": "main",
+ "source_directory": "lldb/docs/",
+}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
More information about the lldb-commits
mailing list