Skip to content

Commit

Permalink
docs: warn about 'latest' docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeurerkellner committed Sep 8, 2023
1 parent 5e4caf6 commit 589bbf9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
8 changes: 8 additions & 0 deletions docs/source/_ext/warn_about_latest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def setup(app):
app.add_js_file('js/warn-about-latest.js')

return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
11 changes: 11 additions & 0 deletions docs/source/_static/css/lmql-docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,15 @@ span.tag {
vertical-align: middle;
padding: 0.2em;
margin-left: 0.5em;
}

.note.latest {
font-size: 0.8em;
background-color: rgba(48, 237, 19, 0.135);
padding: 5pt;
margin-bottom: 10pt;
}

.note.latest .admonition-title {
font-size: 0.8em;
}
11 changes: 11 additions & 0 deletions docs/source/_static/js/warn-about-latest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(function() {
// add if latest or dev (root)
if (!window.location.pathname.includes('/stable/')) {
var warning = document.createElement('DIV');
warning.className = 'note latest';
warning.innerHTML = '<b>Note</b> You are viewing the <i>latest version</i> of the docs. This means some documented features may not be available in the version you are using. You can view the <a href="/en/stable/">stable version instead </a> or make sure you are running the <a href="https://github.com/eth-sri/lmql#installing-the-latest-development-version">latest LMQL version.</a>';
warning.classList.add('sy-alert', 'sy-alert--warning');
document.querySelector('article[role=main]').prepend(warning);
}
}
)();
9 changes: 0 additions & 9 deletions docs/source/_templates/page.html

This file was deleted.

1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'sphinx.ext.intersphinx',
"myst_parser",
"lmql_snippets",
"warn_about_latest",
"nbsphinx",
"sphinx_design"
]
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ To learn more about LMQL, select one of the following sections or navigate the d
Discord <https://discord.gg/7eJP4fcyNT>
GitHub Issues <https://github.com/eth-sri/lmql/issues>
E-Mail <mailto:[email protected]>

0 comments on commit 589bbf9

Please sign in to comment.