-
Notifications
You must be signed in to change notification settings - Fork 9
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
New CustomScript
addon
#431
Conversation
This is a new addon that allow users to inject a specific JavaScript file to all the versions to all the documentation pages to allow them to fix issues in old "frozen" (not able to re-build) versions. Requires readthedocs/readthedocs.org#11758
I'm not adding Web UI for this addon yet, so it won't be exposed to users. However, we can test it by our own first or talk to some users wanting to edit/modify old "frozen" documentation versions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here looks great, I did raise some questions at readthedocs/readthedocs.org#11758 -- namely the feature naming could be reflected here.
We talked about giving users a way to inject a JavaScript file they control using our Cloudflare Worker infrastructure to allow them manipulate frozen documentations. This could be used in different ways to fix bugs or add features to a particular frozen set of docs or even to all the versions. The user can make usage of API data to filter by version or not (e.g. `if (versions.current == "v3.0") { .. do something ...} `) The script could live in Read the Docs itself using a relative URL, or outside it, using an absolute URL. ### Example using Sphinx 1. [Tell Sphinx to include `static` folder](https://github.com/readthedocs/test-builds/blob/full-feature/docs/conf.py#L25) 2. [Include a `readthedocs.js` file in your project](https://github.com/readthedocs/test-builds/blob/full-feature/docs/static/readthedocs.js) 3. Make `AddonsConfig.userjsfile_src` to be `/en/full-feature/readthedocs.js` from addons admin UX The console will render the following: ![Screenshot_2024-11-11_18-13-59](https://github.com/user-attachments/assets/9fa46525-3b20-4d88-9950-f0a93a1199ab) Related #11474 Related readthedocs/addons#431
This is a new addon that allow users to inject a specific JavaScript file to all the versions to all the documentation pages to allow them to fix issues in old "frozen" (not able to re-build) versions.
Requires readthedocs/readthedocs.org#11758