Skip to content

Commit

Permalink
Warn on using latest documentation (#6418)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s authored Jan 13, 2023
1 parent aca673b commit 2af255a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [2.3.0] - 2023-MM-DD
### Added
- Warn on using latest documentation ([#6418](https://github.com/pyg-team/pytorch_geometric/pull/6418))
- Added basic `pyright` type checker support ([#6415](https://github.com/pyg-team/pytorch_geometric/pull/6415))
- Added a new external resource for link prediction ([#6396](https://github.com/pyg-team/pytorch_geometric/pull/6396))
- Added `CaptumExplainer` ([#6383](https://github.com/pyg-team/pytorch_geometric/pull/6383), [#6387](https://github.com/pyg-team/pytorch_geometric/pull/6387))
Expand Down
19 changes: 19 additions & 0 deletions docs/source/_static/js/version_alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function warnOnLatestVersion() {
if (!window.READTHEDOCS_DATA || window.READTHEDOCS_DATA.version !== "latest") {
return; // not on ReadTheDocs and not latest.
}

var note = document.createElement('div');
note.setAttribute('class', 'admonition note');
note.innerHTML = "<p class='first admonition-title'>Note</p> " +
"<p> " +
"This documentation is for an <b>unreleased development version</b>. " +
"Click <a href='/en/stable'><b>here</b></a> to access the documentation of the current stable release." +
"</p>";

var parent = document.querySelector('#pyg-documentation');
if (parent)
parent.insertBefore(note, parent.querySelector('h1'));
}

document.addEventListener('DOMContentLoaded', warnOnLatestVersion);
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ def rst_jinja_render(app, _, source):
source[0] = app.builder.templates.render_string(source[0], rst_context)

app.connect('source-read', rst_jinja_render)
app.add_js_file('js/version_alert.js')

0 comments on commit 2af255a

Please sign in to comment.