Skip to content

[lldb][Docs] Add edit link to docs pages #102144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

DavidSpickett
Copy link
Collaborator

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.

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.
@llvmbot llvmbot added the lldb label Aug 6, 2024
@DavidSpickett DavidSpickett requested review from medismailben and removed request for JDevlieghere August 6, 2024 13:55
@llvmbot
Copy link
Member

llvmbot commented Aug 6, 2024

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/102144.diff

2 Files Affected:

  • (added) lldb/docs/_templates/components/edit-this-page.html (+9)
  • (modified) lldb/docs/conf.py (+5-1)
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 = []

@DavidSpickett
Copy link
Collaborator Author

Copy link

github-actions bot commented Aug 6, 2024

✅ With the latest revision this PR passed the Python code formatter.

@DavidSpickett DavidSpickett merged commit 2771ce8 into llvm:main Aug 8, 2024
7 checks passed
@DavidSpickett DavidSpickett deleted the lldb-edit branch August 8, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants