-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Docs: a start on an 'improve this page' feature #136246
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
Open
nedbat
wants to merge
18
commits into
python:main
Choose a base branch
from
nedbat:nedbat/improve-docs-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+116
−2
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
673e347
Docs: a start on an 'improve this page' feature
nedbat 2daceae
Merge branch 'main' into nedbat/improve-docs-page
nedbat 3a768df
pr feedback: simplify the link, and don't scare people with the cla
nedbat 32e27f6
pr feedback answered
nedbat 7cc87b3
fix the improve link on the improve page
nedbat e536574
news item
nedbat d2c895c
Merge branch 'main' into nedbat/improve-docs-page
nedbat 5313650
Update Doc/improve-page.rst
nedbat 4e4d9b3
fix whitespace
nedbat 2171f71
A nojs version of the page
nedbat 6472b68
comments to help people keep the two pages in sync
nedbat 722fb00
Merge branch 'main' into nedbat/improve-docs-page
nedbat c64723b
protect against XSS
nedbat a8d8a6e
use template for issues from the nojs page
nedbat 85dc4b4
use the template from the JS page as well
nedbat a6a0537
Merge branch 'main' into nedbat/improve-docs-page
nedbat 9ccbd62
give the docs issue template a fillable description field
nedbat 280d274
ugh, getting sloppy
nedbat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| :orphan: | ||
|
|
||
| **************************** | ||
| Improve a documentation page | ||
| **************************** | ||
|
|
||
| .. This is the no-javascript version of this page. The one most people | ||
| will see (with JavaScript enabled) is improve-page.rst. If you edit | ||
| this page, please also edit that one, and vice versa. | ||
|
|
||
| .. only:: html and not epub | ||
|
|
||
| We are always interested to hear ideas about improvements to the documentation. | ||
|
|
||
| .. only:: translation | ||
|
|
||
| If the bug or suggested improvement concerns the translation of this | ||
| documentation, open an issue or edit the page in | ||
| `translation's repository <TRANSLATION_REPO_>`_ instead. | ||
|
|
||
| You have a few ways to ask questions or suggest changes: | ||
|
|
||
| - You can start a discussion about the page on the Python discussion forum. | ||
| This link will start a topic in the Documentation category: | ||
| `New Documentation topic <https://discuss.python.org/new-topic?category=documentation>`_. | ||
|
|
||
| - You can open an issue on the Python GitHub issue tracker. This link will | ||
| create a new issue with the "docs" label: | ||
| `New docs issue <https://github.com/python/cpython/issues/new?template=documentation.yml>`_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| :orphan: | ||
|
|
||
| **************************** | ||
| Improve a documentation page | ||
| **************************** | ||
|
|
||
| .. This is the JavaScript-enabled version of this page. Another version | ||
| (for those with JavaScript disabled) is improve-page-nojs.rst. If you | ||
| edit this page, please also edit that one, and vice versa. | ||
|
|
||
| .. only:: html and not epub | ||
|
|
||
| .. raw:: html | ||
|
|
||
| <script> | ||
| function applyReplacements(text, params) { | ||
| console.log('Applying replacements to:', text); | ||
| return text | ||
| .replace(/PAGETITLE/g, params.get('pagetitle')) | ||
| .replace(/PAGEURL/g, params.get('pageurl')) | ||
| .replace(/PAGESOURCE/g, params.get('pagesource')); | ||
| } | ||
|
|
||
| document.addEventListener('DOMContentLoaded', () => { | ||
| const params = new URLSearchParams(window.location.search); | ||
| const walker = document.createTreeWalker( | ||
| document.body, | ||
| NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, | ||
| null | ||
| ); | ||
|
|
||
| while (walker.nextNode()) { | ||
| const node = walker.currentNode; | ||
|
|
||
| if (node.nodeType === Node.TEXT_NODE) { | ||
| node.textContent = applyReplacements(node.textContent, params) | ||
| } else if (node.nodeName === 'A' && node.href) { | ||
| node.setAttribute('href', applyReplacements(node.getAttribute('href'), params)); | ||
| } | ||
| } | ||
| }); | ||
| </script> | ||
|
|
||
| We are always interested to hear ideas about improvements to the documentation. | ||
|
|
||
| You were reading "PAGETITLE" at `<PAGEURL>`_. The source for that page is on | ||
| `GitHub <https://github.com/python/cpython/blob/main/Doc/PAGESOURCE?plain=1>`_. | ||
|
|
||
nedbat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .. only:: translation | ||
|
|
||
| If the bug or suggested improvement concerns the translation of this | ||
| documentation, open an issue or edit the page in | ||
| `translation's repository <TRANSLATION_REPO_>`_ instead. | ||
|
|
||
| You have a few ways to ask questions or suggest changes: | ||
|
|
||
| - You can start a discussion about the page on the Python discussion forum. | ||
| This link will start a pre-populated topic: | ||
| `Question about page "PAGETITLE" <https://discuss.python.org/new-topic?category=documentation&title=Question+about+page+%22PAGETITLE%22&body=About+the+page+at+PAGEURL%3A>`_. | ||
|
|
||
| - You can open an issue on the Python GitHub issue tracker. This link will | ||
| create a new pre-populated issue: | ||
| `Docs: problem with page "PAGETITLE" <https://github.com/python/cpython/issues/new?template=documentation.yml&title=Docs%3A+problem+with+page+%22PAGETITLE%22&description=The+page+at+PAGEURL+has+a+problem%3A>`_. | ||
|
|
||
| - You can `edit the page on GitHub <https://github.com/python/cpython/blob/main/Doc/PAGESOURCE?plain=1>`_ | ||
| to open a pull request and begin the contribution process. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Documentation/2025-08-02-18-59-01.gh-issue-136246.RIK7nE.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| A new "Improve this page" link is available in the left-hand sidebar of the | ||
| docs, offering links to create GitHub issues, discussion forum posts, or | ||
| pull requests. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.