mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Merge remote-tracking branch 'origin/master' into docs2.0
This commit is contained in:
commit
c287759d7f
22
README.rst
22
README.rst
@ -108,24 +108,26 @@ Base options
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* ``typekit_id`` This will let users specify a typekit id to use for displaying nicer fonts.
|
||||
* ``canonical_url`` This will specify a `canonical url <https://en.wikipedia.org/wiki/Canonical_link_element>`__
|
||||
* ``canonical_url`` String. This will specify a `canonical url <https://en.wikipedia.org/wiki/Canonical_link_element>`__
|
||||
to let search engines know they should give higher ranking to latest version of the docs.
|
||||
The url points to the root of the documentation and requires a trailing slash.
|
||||
* ``analytics_id`` Change the Google Analytics ID that is included on pages.
|
||||
* ``display_version`` With this disabled, the version number isn't shown at the top of the sidebar.
|
||||
* ``prev_next_buttons_location`` can take the value ``bottom``, ``top``, ``both`` , or ``None``
|
||||
and will display the "Next" and "Previous" buttons accordingly
|
||||
* ``style_external_links`` Add an icon next to external links. Defaults to ``False``.
|
||||
* ``analytics_id`` String. Change the Google Analytics ID that is included on pages.
|
||||
* ``display_version`` Bool. With this disabled, the version number isn't shown at the top of the sidebar.
|
||||
* ``prev_next_buttons_location`` String. can take the value ``bottom``, ``top``, ``both`` , or ``None``
|
||||
and will display the "Next" and "Previous" buttons accordingly.
|
||||
* ``style_external_links`` Bool. Add an icon next to external links. Defaults to ``False``.
|
||||
|
||||
TOC Options
|
||||
~~~~~~~~~~~
|
||||
|
||||
These effect how we display the Table of Contents in the side bar. You can read more about them here: http://www.sphinx-doc.org/en/stable/templating.html#toctree
|
||||
|
||||
* ``collapse_navigation`` With this enabled, you will lose the `[+]` drop downs next to each section in the sidebar. This is useful for _very large_ documents.
|
||||
* ``sticky_navigation`` This causes the sidebar to scroll with the main page content as you scroll the page.
|
||||
* ``includehidden`` Specifies if the sidebar includes toctrees marked with the `:hidden:` option
|
||||
* ``titles_only`` If True, removes headers within a page from the sidebar.
|
||||
* ``collapse_navigation`` Bool. With this enabled, you will lose the `[+]` drop downs next to each section in the sidebar.
|
||||
This is useful for _very large_ documents.
|
||||
* ``sticky_navigation`` Bool. This causes the sidebar to scroll with the main page content as you scroll the page.
|
||||
* ``navigation_depth`` Int. Indicate the max depth of the tree; by default, all levels are included.
|
||||
* ``includehidden`` Bool. Specifies if the sidebar includes toctrees marked with the `:hidden:` option
|
||||
* ``titles_only`` Bool. If True, removes headers within a page from the sidebar.
|
||||
|
||||
Page-level configuration
|
||||
------------------------
|
||||
|
@ -66,7 +66,7 @@ release = '0.2.4'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
language = 'en'
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
|
46
js/theme.js
46
js/theme.js
@ -15,17 +15,22 @@ function ThemeNav () {
|
||||
isRunning: false
|
||||
};
|
||||
|
||||
nav.enable = function () {
|
||||
nav.enable = function (withStickyNav) {
|
||||
var self = this;
|
||||
|
||||
if (!self.isRunning) {
|
||||
self.isRunning = true;
|
||||
jQuery(function ($) {
|
||||
self.init($);
|
||||
if (self.isRunning) {
|
||||
// Only allow enabling nav logic once
|
||||
return;
|
||||
}
|
||||
|
||||
self.reset();
|
||||
self.win.on('hashchange', self.reset);
|
||||
self.isRunning = true;
|
||||
jQuery(function ($) {
|
||||
self.init($);
|
||||
|
||||
self.reset();
|
||||
self.win.on('hashchange', self.reset);
|
||||
|
||||
if (withStickyNav) {
|
||||
// Set scroll monitor
|
||||
self.win.on('scroll', function () {
|
||||
if (!self.linkScroll) {
|
||||
@ -35,18 +40,23 @@ function ThemeNav () {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Set resize monitor
|
||||
self.win.on('resize', function () {
|
||||
if (!self.winResize) {
|
||||
self.winResize = true;
|
||||
requestAnimationFrame(function() { self.onResize(); });
|
||||
}
|
||||
});
|
||||
|
||||
self.onResize();
|
||||
// Set resize monitor
|
||||
self.win.on('resize', function () {
|
||||
if (!self.winResize) {
|
||||
self.winResize = true;
|
||||
requestAnimationFrame(function() { self.onResize(); });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
self.onResize();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
nav.enableSticky = function() {
|
||||
this.enable(true);
|
||||
};
|
||||
|
||||
nav.init = function ($) {
|
||||
@ -176,7 +186,7 @@ function ThemeNav () {
|
||||
module.exports.ThemeNav = ThemeNav();
|
||||
|
||||
if (typeof(window) != 'undefined') {
|
||||
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
|
||||
window.SphinxRtdTheme = { Navigation: module.exports.ThemeNav };
|
||||
}
|
||||
|
||||
|
||||
|
@ -161,7 +161,10 @@
|
||||
|
||||
// These are the little citation links [1] that show up within paragraphs.
|
||||
.footnote-reference, .citation-reference
|
||||
vertical-align: super
|
||||
vertical-align: baseline
|
||||
position: relative
|
||||
top: -0.4em
|
||||
line-height: 0
|
||||
font-size: 90%
|
||||
|
||||
// Tables! Sphinx LOVES TABLES. Most of wyrm assumes you're only going to use a table as a table
|
||||
|
@ -209,14 +209,15 @@
|
||||
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{# STICKY NAVIGATION #}
|
||||
{% if theme_sticky_navigation|tobool %}
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
{% if theme_sticky_navigation|tobool %}
|
||||
SphinxRtdTheme.Navigation.enableSticky();
|
||||
{% else %}
|
||||
SphinxRtdTheme.Navigation.enable();
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{%- block footer %} {% endblock %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user