diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 9ee7a29087..aea77d6832 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -6,59 +6,56 @@ env:
COVERAGE_THRESHOLD: 60
jobs:
-
lint:
-
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Set up Node/yarn
- uses: actions/setup-node@v1
- with:
- node-version: '16.x'
-
- - name: Cache python wheels
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-
- ${{ runner.os }}-pip-
-
- - name: Cache node_modules
- uses: actions/cache@v2
- with:
- path: 'node_modules'
- key: |
- ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
-
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip setuptools wheel
- python -m pip install --upgrade pre-commit
- python -m pip install -e .
- yarn --frozen-lockfile
-
- - name: Lint
- run: |
- pre-commit run --all-files
+ - uses: actions/checkout@v2
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Set up Node/yarn
+ uses: actions/setup-node@v1
+ with:
+ node-version: "16.x"
+
+ - name: Cache python wheels
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pip
+ key: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
+ ${{ runner.os }}-pip-
+
+ - name: Cache node_modules
+ uses: actions/cache@v2
+ with:
+ path: "node_modules"
+ key: |
+ ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools wheel
+ python -m pip install --upgrade pre-commit
+ python -m pip install -e .
+ yarn --frozen-lockfile
+
+ - name: Lint
+ run: |
+ pre-commit run --all-files
# Build docs on a number of Python versions. In the future this can be
# where tests go.
tests:
-
runs-on: ubuntu-latest
strategy:
matrix:
@@ -68,49 +65,48 @@ jobs:
dev: true
steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Cache python wheels
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-
- ${{ runner.os }}-pip-
-
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip setuptools wheel
- python -m pip install -e .[coverage]
-
- - name: Install pre-release dependencies
- if: ${{ matrix.dev }}
- run: pip install --upgrade --pre sphinx jinja2
-
- # Build the docs
- - name: Build docs to store
- run: |
- export PATH="$HOME/miniconda/bin:$PATH"
- sphinx-build -b html docs/ docs/_build/html -W --keep-going
-
- # Run tests under coverage
- - name: Run the tests
- run: pytest --cov pydata_sphinx_theme --cov-branch --cov-report term-missing:skip-covered --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}
-
- - name: Upload coverage
- if: ${{ always() }}
- run: codecov
+ - uses: actions/checkout@v2
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Cache python wheels
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pip
+ key: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
+ ${{ runner.os }}-pip-
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools wheel
+ python -m pip install -e .[coverage]
+
+ - name: Install pre-release dependencies
+ if: ${{ matrix.dev }}
+ run: pip install --upgrade --pre sphinx jinja2
+
+ # Build the docs
+ - name: Build docs to store
+ run: |
+ export PATH="$HOME/miniconda/bin:$PATH"
+ sphinx-build -b html docs/ docs/_build/html -W --keep-going
+
+ # Run tests under coverage
+ - name: Run the tests
+ run: pytest --cov pydata_sphinx_theme --cov-branch --cov-report term-missing:skip-covered --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}
+
+ - name: Upload coverage
+ if: ${{ always() }}
+ run: codecov
# Run local Lighthouse audit against built site
audit:
-
runs-on: ubuntu-latest
strategy:
matrix:
@@ -124,98 +120,97 @@ jobs:
PA11Y_BUILD: /tmp/pa11y/pa11y-${{ github.run_number }}
steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Set up Node/yarn
- uses: actions/setup-node@v1
- with:
- node-version: '16.x'
-
- - name: Cache python wheels
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-
- ${{ runner.os }}-pip-
-
- - name: Cache node_modules
- uses: actions/cache@v2
- with:
- path: 'node_modules'
- key: |
- ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
-
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip wheel setuptools
- python -m pip install -e .[coverage]
- yarn --frozen-lockfile
-
- # Build the docs
- - name: Build docs to store
- run: |
- export PATH="$HOME/miniconda/bin:$PATH"
- sphinx-build -b html docs/ docs/_build/html -W --keep-going
-
- # Serve the docs and wait to be ready
- - name: Serve the built site
- run: |
- nohup python docs/serve.py --port=${PORT} --host=${HOST} &
- curl --retry 10 --retry-connrefused --retry-max-time 60 ${URL}/index.html
-
- # Run the audit
- # TODO: use the hosted API with a secret? would allow for comparison over time...
- - name: Make folder for Lighthouse reports
- run: mkdir -p /tmp/lighthouse/lighthouse-${{ github.run_number }}
-
- - name: Run Lighthouse on Site
- id: lighthouse
- uses: foo-software/lighthouse-check-action@v2.0.0
- with:
- # TODO: generate this list to audit all html pages
- urls: >-
- ${{ env.URL }}/index.html,
- ${{ env.URL }}/demo/api.html,
- ${{ env.URL }}/demo/demo.html,
- ${{ env.URL }}/demo/example_pandas.html,
- ${{ env.URL }}/user_guide/accessibility.html
- outputDirectory: /tmp/lighthouse/lighthouse-${{ github.run_number }}
- verbose: true
-
- - name: Run the accessibility audit
- run: python docs/a11y.py --no-serve
-
- # Check the audit for threshold values
- # TODO: write this someplace after a PR is merged, and load?
- - name: Assess Lighthouse Check results
- uses: foo-software/lighthouse-check-status-action@v1.0.1
- with:
- lighthouseCheckResults: ${{ steps.lighthouse.outputs.lighthouseCheckResults }}
- minAccessibilityScore: "96"
- minBestPracticesScore: "85"
- minPerformanceScore: "10"
- minSeoScore: "80"
- if: always()
-
- - name: Publish Audit reports
- uses: actions/upload-artifact@v2
- with:
- name: Pa11y and Lighthouse ${{ github.run_number }}
- path: |
- /tmp/pa11y
- /tmp/lighthouse
- if: always()
+ - uses: actions/checkout@v2
- publish:
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Set up Node/yarn
+ uses: actions/setup-node@v1
+ with:
+ node-version: "16.x"
+
+ - name: Cache python wheels
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pip
+ key: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
+ ${{ runner.os }}-pip-
+
+ - name: Cache node_modules
+ uses: actions/cache@v2
+ with:
+ path: "node_modules"
+ key: |
+ ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip wheel setuptools
+ python -m pip install -e .[coverage]
+ yarn --frozen-lockfile
+
+ # Build the docs
+ - name: Build docs to store
+ run: |
+ export PATH="$HOME/miniconda/bin:$PATH"
+ sphinx-build -b html docs/ docs/_build/html -W --keep-going
+
+ # Serve the docs and wait to be ready
+ - name: Serve the built site
+ run: |
+ nohup python docs/serve.py --port=${PORT} --host=${HOST} &
+ curl --retry 10 --retry-connrefused --retry-max-time 60 ${URL}/index.html
+
+ # Run the audit
+ # TODO: use the hosted API with a secret? would allow for comparison over time...
+ - name: Make folder for Lighthouse reports
+ run: mkdir -p /tmp/lighthouse/lighthouse-${{ github.run_number }}
+
+ - name: Run Lighthouse on Site
+ id: lighthouse
+ uses: foo-software/lighthouse-check-action@v2.0.0
+ with:
+ # TODO: generate this list to audit all html pages
+ urls: >-
+ ${{ env.URL }}/index.html,
+ ${{ env.URL }}/demo/api.html,
+ ${{ env.URL }}/demo/demo.html,
+ ${{ env.URL }}/demo/example_pandas.html,
+ ${{ env.URL }}/user_guide/accessibility.html
+ outputDirectory: /tmp/lighthouse/lighthouse-${{ github.run_number }}
+ verbose: true
+
+ - name: Run the accessibility audit
+ run: python docs/a11y.py --no-serve
+
+ # Check the audit for threshold values
+ # TODO: write this someplace after a PR is merged, and load?
+ - name: Assess Lighthouse Check results
+ uses: foo-software/lighthouse-check-status-action@v1.0.1
+ with:
+ lighthouseCheckResults: ${{ steps.lighthouse.outputs.lighthouseCheckResults }}
+ minAccessibilityScore: "96"
+ minBestPracticesScore: "85"
+ minPerformanceScore: "10"
+ minSeoScore: "80"
+ if: always()
+
+ - name: Publish Audit reports
+ uses: actions/upload-artifact@v2
+ with:
+ name: Pa11y and Lighthouse ${{ github.run_number }}
+ path: |
+ /tmp/pa11y
+ /tmp/lighthouse
+ if: always()
+
+ publish:
name: Publish to PyPi
needs: [lint, tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a6f6d98523..a31ed0509d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,17 +1,40 @@
+# Exclude the generated static assets.
+exclude: .+(/static/).+|github_deploy_key_pandas_dev_pandas_sphinx_theme\.enc
+
repos:
-- repo: local
+ - repo: local
hooks:
- - id: yarn-build-production
+ - id: yarn-build-production
name: Build src files
language: system
entry: bash -c "yarn build:production"
files: ^src/*
-- repo: https://github.com/psf/black
+
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v2.4.1
+ hooks:
+ - id: prettier
+ # Exclude the HTML, since it doesn't understand Jinja2
+ exclude: .+((\.html)|index\.(.+)\.css)$
+
+ - repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- - id: black
+ - id: black
language_version: python3
-- repo: https://gitlab.com/pycqa/flake8
+
+ - repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- - id: flake8
+ - id: flake8
+
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: check-builtin-literals
+ - id: check-case-conflict
+ - id: check-toml
+ - id: check-yaml
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c0c6fb276e..bc66f8dbb9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -5,4 +5,4 @@ the demo docs and developing the css/js of the theme, etc, is explained in
more detail in the contributing section of the documentation:
- [Contributing source files](docs/contributing.md)
-- [Contributing rendered docs](https://pydata-sphinx-theme.readthedocs.io/en/latest/contributing.html)
\ No newline at end of file
+- [Contributing rendered docs](https://pydata-sphinx-theme.readthedocs.io/en/latest/contributing.html)
diff --git a/README.md b/README.md
index 3a140459d6..f2940f1653 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,6 @@ Sites that are using this theme:
- MNE-Python: https://mne.tools/stable/index.html
- PyVista: https://docs.pyvista.org
-
## Installation and usage
The theme is available on PyPI and conda-forge. You can install
@@ -62,7 +61,6 @@ more detail in the contributing section of the documentation:
- [Contributing source files](docs/contributing.md)
- [Contributing rendered docs](https://pydata-sphinx-theme.readthedocs.io/en/latest/contributing.html)
-
## How is this theme working?
### The html layout
diff --git a/docs/_static/pandas.svg b/docs/_static/pandas.svg
index a7af4e4d2d..017fd35fdd 100644
--- a/docs/_static/pandas.svg
+++ b/docs/_static/pandas.svg
@@ -1 +1 @@
-Artboard 63
\ No newline at end of file
+Artboard 63
diff --git a/docs/_templates/custom-template.html b/docs/_templates/custom-template.html
index 607d577f9f..be9854c838 100644
--- a/docs/_templates/custom-template.html
+++ b/docs/_templates/custom-template.html
@@ -3,4 +3,4 @@
If you'd like to contribute,
check out our GitHub repository
Your contributions are welcome!
-
\ No newline at end of file
+
diff --git a/docs/_templates/navbar-version.html b/docs/_templates/navbar-version.html
index bbba17b2a0..35aaf29b3f 100644
--- a/docs/_templates/navbar-version.html
+++ b/docs/_templates/navbar-version.html
@@ -1 +1 @@
-v{{ version }}
\ No newline at end of file
+v{{ version }}
diff --git a/docs/contributing.rst b/docs/contributing.rst
index b41158d6e7..aa97ad0d29 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -63,14 +63,14 @@ Or to completely remove the environment generated by ``nox`` and start from scra
If you'd like to use ``nox`` with your **global** environment (the one from
which you are calling ``nox``), you can do so with
-
+
.. code-block:: console
-
+
$ nox --force-venv-backend none
# alternatively:
$ nox -fb none
-
+
Using `none` will re-use your current global environment. See
`the nox documentation `_
for more details.
@@ -206,13 +206,13 @@ The easiest way to accomplish this is using `conda-forge =14,<15 # We should use whatever the LTS is at https://nodejs.org/en/
-- "python=3.10"
-- pip
-- pip:
- - -r docs/requirements.txt
+ - yarn
+ - nodejs>=14,<15 # We should use whatever the LTS is at https://nodejs.org/en/
+ - "python=3.10"
+ - pip
+ - pip:
+ - -r docs/requirements.txt
diff --git a/package.json b/package.json
index 04d898f515..beba01b986 100644
--- a/package.json
+++ b/package.json
@@ -36,4 +36,4 @@
"optimize-css-assets-webpack-plugin": "^5.0.3",
"popper.js": "^1.16.1"
}
-}
\ No newline at end of file
+}
diff --git a/pydata_sphinx_theme/_templates/copyright.html b/pydata_sphinx_theme/_templates/copyright.html
index 9e7d1dbf60..5c451d95b4 100644
--- a/pydata_sphinx_theme/_templates/copyright.html
+++ b/pydata_sphinx_theme/_templates/copyright.html
@@ -4,4 +4,4 @@
{%- else %}
{% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/_templates/last-updated.html b/pydata_sphinx_theme/_templates/last-updated.html
index 06b02c40d6..1f094b289f 100644
--- a/pydata_sphinx_theme/_templates/last-updated.html
+++ b/pydata_sphinx_theme/_templates/last-updated.html
@@ -1,3 +1,3 @@
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/_templates/navbar-icon-links.html b/pydata_sphinx_theme/_templates/navbar-icon-links.html
index 7e7b76c2c0..1fc7a7b232 100644
--- a/pydata_sphinx_theme/_templates/navbar-icon-links.html
+++ b/pydata_sphinx_theme/_templates/navbar-icon-links.html
@@ -1,3 +1,3 @@
{%- block icon_links -%}
{%- include "icon-links.html" with context -%}
-{%- endblock %}
\ No newline at end of file
+{%- endblock %}
diff --git a/pydata_sphinx_theme/_templates/navbar-logo.html b/pydata_sphinx_theme/_templates/navbar-logo.html
index 7fe6cd79fd..b561735fca 100644
--- a/pydata_sphinx_theme/_templates/navbar-logo.html
+++ b/pydata_sphinx_theme/_templates/navbar-logo.html
@@ -10,10 +10,10 @@
{% else %}
-
+
{% endif %}
{% else %}
{{ project }}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/pydata_sphinx_theme/_templates/navbar-nav.html b/pydata_sphinx_theme/_templates/navbar-nav.html
index fcec47a15f..790c9b713a 100644
--- a/pydata_sphinx_theme/_templates/navbar-nav.html
+++ b/pydata_sphinx_theme/_templates/navbar-nav.html
@@ -5,4 +5,4 @@
{{ _(external_link.name) }}
{% endfor %}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/_templates/page-toc.html b/pydata_sphinx_theme/_templates/page-toc.html
index 775aac3e05..2a12bac844 100644
--- a/pydata_sphinx_theme/_templates/page-toc.html
+++ b/pydata_sphinx_theme/_templates/page-toc.html
@@ -8,4 +8,4 @@
{{ page_toc }}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/_templates/prev-next.html b/pydata_sphinx_theme/_templates/prev-next.html
index 16e204a80e..0c1368fc56 100644
--- a/pydata_sphinx_theme/_templates/prev-next.html
+++ b/pydata_sphinx_theme/_templates/prev-next.html
@@ -1,6 +1,6 @@
diff --git a/pydata_sphinx_theme/_templates/sphinx-version.html b/pydata_sphinx_theme/_templates/sphinx-version.html
index 11f36c6049..464fd3cf3e 100644
--- a/pydata_sphinx_theme/_templates/sphinx-version.html
+++ b/pydata_sphinx_theme/_templates/sphinx-version.html
@@ -1,3 +1,3 @@
{% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/footer.html b/pydata_sphinx_theme/footer.html
index 0a296c540d..93083ce2cc 100644
--- a/pydata_sphinx_theme/footer.html
+++ b/pydata_sphinx_theme/footer.html
@@ -6,4 +6,4 @@
{% endfor %}
-
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/search-field.html b/pydata_sphinx_theme/search-field.html
index 444465ba80..9c1f8d64e2 100644
--- a/pydata_sphinx_theme/search-field.html
+++ b/pydata_sphinx_theme/search-field.html
@@ -1,4 +1,4 @@
\ No newline at end of file
+
diff --git a/pydata_sphinx_theme/static/css/index.eb2e94f0e4565f3ea722e9d0f85e3c08.css b/pydata_sphinx_theme/static/css/index.38f2ebe09480739b4ba0fa585d02b29a.css
similarity index 100%
rename from pydata_sphinx_theme/static/css/index.eb2e94f0e4565f3ea722e9d0f85e3c08.css
rename to pydata_sphinx_theme/static/css/index.38f2ebe09480739b4ba0fa585d02b29a.css
diff --git a/pydata_sphinx_theme/static/js/index.8a59f550f384467928e0.js b/pydata_sphinx_theme/static/js/index.30d17a8aef5d942e5d26.js
similarity index 100%
rename from pydata_sphinx_theme/static/js/index.8a59f550f384467928e0.js
rename to pydata_sphinx_theme/static/js/index.30d17a8aef5d942e5d26.js
diff --git a/pydata_sphinx_theme/static/webpack-macros.html b/pydata_sphinx_theme/static/webpack-macros.html
index c38a40bb5d..63df608852 100644
--- a/pydata_sphinx_theme/static/webpack-macros.html
+++ b/pydata_sphinx_theme/static/webpack-macros.html
@@ -13,13 +13,13 @@
{% macro head_pre_bootstrap() %}
-
+
{% endmacro %}
{% macro head_js_preload() %}
-
+
{% endmacro %}
{% macro body_post() %}
-
+
{% endmacro %}
\ No newline at end of file
diff --git a/pydata_sphinx_theme/theme.conf b/pydata_sphinx_theme/theme.conf
index aee05fa652..c7289afc4b 100644
--- a/pydata_sphinx_theme/theme.conf
+++ b/pydata_sphinx_theme/theme.conf
@@ -31,4 +31,4 @@ navbar_start = navbar-logo.html
navbar_center = navbar-nav.html
navbar_end = navbar-icon-links.html
footer_items = copyright.html, sphinx-version.html
-page_sidebar_items = page-toc.html, edit-this-page.html
\ No newline at end of file
+page_sidebar_items = page-toc.html, edit-this-page.html
diff --git a/readthedocs.yml b/readthedocs.yml
index 8f9cb8ef1d..7a7fac8f86 100644
--- a/readthedocs.yml
+++ b/readthedocs.yml
@@ -1,10 +1,10 @@
version: 2
formats:
- - htmlzip
+ - htmlzip
python:
- version: 3
- install:
- - requirements: docs/requirements.txt
- - method: pip
- path: .
+ version: 3
+ install:
+ - requirements: docs/requirements.txt
+ - method: pip
+ path: .
diff --git a/src/js/index.js b/src/js/index.js
index eeeab2c046..255f6103af 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -7,12 +7,12 @@
* To enable Popper.js (and other jQuery plugins) to hook into the same instancce of jQuery,
* jQuery is defined as a Webpack external, thus this import uses the externally defined jquery dependency.
*/
-import 'jquery';
+import "jquery";
-import 'popper.js';
-import 'bootstrap';
+import "popper.js";
+import "bootstrap";
-import './../scss/index.scss';
+import "./../scss/index.scss";
function addTOCInteractivity() {
// TOC sidebar - add "active" class to parent list
@@ -22,57 +22,57 @@ function addTOCInteractivity() {
//
// The event is triggered on "window" (and not the nav item as documented),
// see https://github.com/twbs/bootstrap/issues/20086
- $(window).on('activate.bs.scrollspy', function () {
- const navLinks = document.querySelectorAll('#bd-toc-nav a');
+ $(window).on("activate.bs.scrollspy", function () {
+ const navLinks = document.querySelectorAll("#bd-toc-nav a");
navLinks.forEach((navLink) => {
- navLink.parentElement.classList.remove('active');
+ navLink.parentElement.classList.remove("active");
});
- const activeNavLinks = document.querySelectorAll('#bd-toc-nav a.active');
+ const activeNavLinks = document.querySelectorAll("#bd-toc-nav a.active");
activeNavLinks.forEach((navLink) => {
- navLink.parentElement.classList.add('active');
+ navLink.parentElement.classList.add("active");
});
});
}
-
// Navigation sidebar scrolling to active page
function scrollToActive() {
- var sidebar = document.getElementById('bd-docs-nav')
+ var sidebar = document.getElementById("bd-docs-nav");
// Remember the sidebar scroll position between page loads
// Inspired on source of revealjs.com
- let storedScrollTop = parseInt(sessionStorage.getItem('sidebar-scroll-top'), 10);
+ let storedScrollTop = parseInt(
+ sessionStorage.getItem("sidebar-scroll-top"),
+ 10
+ );
if (!isNaN(storedScrollTop)) {
sidebar.scrollTop = storedScrollTop;
- }
- else {
- var active_pages = sidebar.querySelectorAll(".active")
- var offset = 0
+ } else {
+ var active_pages = sidebar.querySelectorAll(".active");
+ var offset = 0;
var i;
for (i = active_pages.length - 1; i > 0; i--) {
- var active_page = active_pages[i]
+ var active_page = active_pages[i];
if (active_page !== undefined) {
- offset += active_page.offsetTop
+ offset += active_page.offsetTop;
}
}
- offset -= sidebar.offsetTop
+ offset -= sidebar.offsetTop;
// Only scroll the navbar if the active link is lower than 50% of the page
- if (active_page !== undefined && offset > (sidebar.clientHeight * .5)) {
- sidebar.scrollTop = offset - (sidebar.clientHeight * .2)
+ if (active_page !== undefined && offset > sidebar.clientHeight * 0.5) {
+ sidebar.scrollTop = offset - sidebar.clientHeight * 0.2;
}
}
// Store the sidebar scroll position
- window.addEventListener('beforeunload', () => {
- sessionStorage.setItem('sidebar-scroll-top', sidebar.scrollTop);
+ window.addEventListener("beforeunload", () => {
+ sessionStorage.setItem("sidebar-scroll-top", sidebar.scrollTop);
});
}
-
$(document).ready(() => {
scrollToActive();
addTOCInteractivity();
diff --git a/src/scss/_admonitions.scss b/src/scss/_admonitions.scss
index ccf1b08c7e..2f09242e8d 100644
--- a/src/scss/_admonitions.scss
+++ b/src/scss/_admonitions.scss
@@ -1,6 +1,7 @@
// Admonitions CSS originally inspired by https://squidfunk.github.io/mkdocs-material/getting-started/
-div.admonition, .admonition{
+div.admonition,
+.admonition {
margin: 1.5625em auto;
padding: 0 0.6rem 0.8rem 0.6rem;
overflow: hidden;
@@ -8,7 +9,8 @@ div.admonition, .admonition{
border-left: 0.2rem solid;
border-color: rgba(var(--pst-color-admonition-default), 1);
border-radius: 0.2rem;
- box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1);
+ box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05),
+ 0 0 0.0625rem rgba(0, 0, 0, 0.1);
transition: color 250ms, background-color 250ms, border-color 250ms;
// Last item should have no spacing since we'll control that w/ padding
@@ -22,8 +24,9 @@ div.admonition, .admonition{
}
// Lists need to have left margin so they don't spill into it
- > ol, > ul {
- margin-left: 1em;
+ > ol,
+ > ul {
+ margin-left: 1em;
}
// Defaults for all admonitions
@@ -40,7 +43,7 @@ div.admonition, .admonition{
width: 1rem;
height: 1rem;
color: rgba(var(--pst-color-admonition-default), 1);
- font-family: 'Font Awesome 5 Free';
+ font-family: "Font Awesome 5 Free";
font-weight: 900;
content: var(--pst-icon-admonition-default);
}
diff --git a/src/scss/_api.scss b/src/scss/_api.scss
index 567ddf3e0b..0060997fa3 100644
--- a/src/scss/_api.scss
+++ b/src/scss/_api.scss
@@ -1,6 +1,5 @@
// Style API docs from sphinx' autodoc / autosummary
-
/**
* Styling for field lists
*/
@@ -35,45 +34,47 @@ table.field-list {
}
}
}
-
+
/**
* Styling for autosummary tables
*/
.table.autosummary {
-// The first column (with the signature) should not wrap
+ // The first column (with the signature) should not wrap
td:first-child {
- white-space: nowrap;
+ white-space: nowrap;
}
}
-
/* overriding basic.css to use our own monospace font */
.sig {
- font-family: var(--pst-font-family-monospace);
+ font-family: var(--pst-font-family-monospace);
}
-
/* C++ specific styling - overriding the basic.css to avoid custom colors*/
.sig-inline.c-texpr,
.sig-inline.cpp-texpr {
- font-family: unset;
+ font-family: unset;
}
-.sig.c .k, .sig.c .kt,
-.sig.cpp .k, .sig.cpp .kt {
- color: rgba(var(--pst-color-text-base), 1);
+.sig.c .k,
+.sig.c .kt,
+.sig.cpp .k,
+.sig.cpp .kt {
+ color: rgba(var(--pst-color-text-base), 1);
}
-.sig.c .m,
+.sig.c .m,
.sig.cpp .m {
- color: rgba(var(--pst-color-text-base), 1);
+ color: rgba(var(--pst-color-text-base), 1);
}
-.sig.c .s, .sig.c .sc,
-.sig.cpp .s, .sig.cpp .sc {
- color: rgba(var(--pst-color-text-base), 1);
+.sig.c .s,
+.sig.c .sc,
+.sig.cpp .s,
+.sig.cpp .sc {
+ color: rgba(var(--pst-color-text-base), 1);
}
// addition
@@ -85,4 +86,4 @@ table.field-list {
.sig-name {
color: rgba(var(--pst-color-inline-code), 1);
-}
\ No newline at end of file
+}
diff --git a/src/scss/_base.scss b/src/scss/_base.scss
index 77823a0c1c..ab542f02c5 100644
--- a/src/scss/_base.scss
+++ b/src/scss/_base.scss
@@ -124,7 +124,7 @@ pre {
// Override bootstrap by restoring the basic theme default.
dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
}
diff --git a/src/scss/_markdown.scss b/src/scss/_markdown.scss
index 49e0a7ee84..44d90e9516 100644
--- a/src/scss/_markdown.scss
+++ b/src/scss/_markdown.scss
@@ -1,6 +1,7 @@
// Rules that are unique to MyST markdown parsing / outputs
-th, td {
+th,
+td {
&.text-align\:left {
text-align: left;
}
@@ -12,4 +13,4 @@ th, td {
&.text-align\:center {
text-align: center;
}
-}
\ No newline at end of file
+}
diff --git a/src/scss/_navbar.scss b/src/scss/_navbar.scss
index d151cf5775..4a614029d9 100644
--- a/src/scss/_navbar.scss
+++ b/src/scss/_navbar.scss
@@ -11,7 +11,7 @@
@include media-breakpoint-up(lg) {
// navbar-end-items should be on one line if possible
#navbar-end > .navbar-end-item {
- display: inline-block;
+ display: inline-block;
}
}
}
@@ -32,12 +32,12 @@
// If we want the shadow to only point downward in the future, set
// box-shadow to: 0 0.125rem 0.25rem -0.125rem rgba(0, 0, 0, 0.11);
.navbar-light {
- background: #fff!important; // Overrides bootstrap
+ background: #fff !important; // Overrides bootstrap
box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.11);
.navbar-nav {
li a.nav-link {
- padding: 0 .5rem;
+ padding: 0 0.5rem;
color: rgba(var(--pst-color-navbar-link), 1);
&:hover {
diff --git a/src/scss/_versionmodified.scss b/src/scss/_versionmodified.scss
index ff73ae6dd4..f9cebfc824 100644
--- a/src/scss/_versionmodified.scss
+++ b/src/scss/_versionmodified.scss
@@ -1,4 +1,6 @@
-div.versionadded, div.versionchanged, div.deprecated {
+div.versionadded,
+div.versionchanged,
+div.deprecated {
vertical-align: middle;
margin: 1.5625em auto;
padding: 0 0.6rem 0 0.6rem;
@@ -7,15 +9,15 @@ div.versionadded, div.versionchanged, div.deprecated {
border-left: 0.2rem solid;
border-color: rgba(var(--pst-color-versionmodified-default), 1);
border-radius: 0.2rem;
- box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1);
+ box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05),
+ 0 0 0.0625rem rgba(0, 0, 0, 0.1);
transition: color 250ms, background-color 250ms, border-color 250ms;
background-color: rgba(var(--pst-color-admonition-default), 0.1);
-
+
> p {
margin-bottom: 0.6rem;
margin-top: 0.6rem;
}
-
}
div.versionadded {
@@ -32,20 +34,20 @@ div.deprecated {
border-color: rgba(var(--pst-color-versionmodified-deprecated), 1);
background-color: rgba(var(--pst-color-versionmodified-deprecated), 0.1);
}
-
+
span.versionmodified {
font-weight: 700;
-
+
&:before {
font-style: normal;
margin-right: 0.6rem;
color: rgba(var(--pst-color-versionmodified-default), 1);
- font-family: 'Font Awesome 5 Free';
+ font-family: "Font Awesome 5 Free";
font-weight: 900;
content: var(--pst-icon-versionmodified-default);
}
}
-
+
span.versionmodified.added {
&:before {
color: rgba(var(--pst-color-versionmodified-added), 1);
@@ -65,4 +67,4 @@ span.versionmodified.deprecated {
color: rgba(var(--pst-color-versionmodified-deprecated), 1);
content: var(--pst-icon-versionmodified-deprecated);
}
-}
\ No newline at end of file
+}
diff --git a/src/scss/index.scss b/src/scss/index.scss
index c6e64c022e..a0dcf5466a 100644
--- a/src/scss/index.scss
+++ b/src/scss/index.scss
@@ -17,21 +17,21 @@ $grid-breakpoints: (
);
// Import Bootstrap core
-@import '~bootstrap/scss/bootstrap';
+@import "~bootstrap/scss/bootstrap";
-@import './base';
-@import './navbar';
-@import './admonitions';
-@import './api';
-@import './markdown';
-@import './versionmodified';
+@import "./base";
+@import "./navbar";
+@import "./admonitions";
+@import "./api";
+@import "./markdown";
+@import "./versionmodified";
// Custom css, TODO: to be refactored in different partials
// GitHub blockquote style
blockquote {
padding: 0 1em;
color: #6a737d;
- border-left: .25em solid #dfe2e5;
+ border-left: 0.25em solid #dfe2e5;
}
// For consistency, add bracket around footnotes/citations which are
@@ -84,7 +84,6 @@ span.guilabel {
*/
footer {
-
width: 100%;
border-top: 1px solid #ccc;
padding: 10px;
@@ -197,7 +196,6 @@ footer {
@include media-breakpoint-up(md) {
display: block;
-
}
}
@@ -254,24 +252,22 @@ footer {
}
nav.bd-links {
-
p.caption {
- font-size: var(--pst-sidebar-caption-font-size);
- text-transform: uppercase;
- font-weight: bold;
- position: relative;
- margin-top: 1.25em;
- margin-bottom: 0.5em;
- padding: 0 1.5rem;
- color: rgba(var(--pst-color-sidebar-caption), 1);
- &:first-child {
- margin-top: 0;
- }
+ font-size: var(--pst-sidebar-caption-font-size);
+ text-transform: uppercase;
+ font-weight: bold;
+ position: relative;
+ margin-top: 1.25em;
+ margin-bottom: 0.5em;
+ padding: 0 1.5rem;
+ color: rgba(var(--pst-color-sidebar-caption), 1);
+ &:first-child {
+ margin-top: 0;
+ }
}
}
.bd-sidebar .nav {
-
font-size: var(--pst-sidebar-font-size);
ul {
@@ -292,11 +288,11 @@ nav.bd-links {
&.reference.external {
&:after {
- font-family: 'Font Awesome 5 Free';
+ font-family: "Font Awesome 5 Free";
font-weight: 900;
- content: '\f35d';
- font-size: .75em;
- margin-left: 0.3em
+ content: "\f35d";
+ font-size: 0.75em;
+ margin-left: 0.3em;
}
}
}
@@ -397,7 +393,7 @@ nav.bd-links {
.prev-next-info {
flex-direction: column;
- margin: 0 .5em;
+ margin: 0 0.5em;
.prev-next-subtitle {
text-transform: capitalize;
@@ -437,7 +433,7 @@ nav.bd-links {
&.fa,
&.fab,
&.far,
- &.fas{
+ &.fas {
vertical-align: middle;
font-style: normal;
font-size: 1.5rem;
@@ -454,7 +450,7 @@ nav.bd-links {
}
&.fa-gitlab:before {
- color: #548
+ color: #548;
}
&.fa-bitbucket:before {
@@ -463,7 +459,6 @@ nav.bd-links {
}
}
-
/* TOC section headers */
.tocsection {
@@ -488,15 +483,13 @@ nav.bd-links {
// xarray output display in bootstrap
.xr-wrap[hidden] {
- display: block!important;
+ display: block !important;
}
-
////////////////////////////////////////////////////////////////////////////////
// Togglable expand/collapse
////////////////////////////////////////////////////////////////////////////////
-
.toctree-checkbox {
position: absolute;
display: none;
@@ -519,9 +512,7 @@ nav.bd-links {
}
}
-
.bd-sidebar {
-
li {
position: relative;
}
@@ -566,7 +557,8 @@ nav.bd-links {
// From https://stackoverflow.com/a/34372191
table.highlighttable td.linenos,
span.linenos,
-div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
+div.doctest > div.highlight span.gp {
+ /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
diff --git a/tests/sites/sidebars/index.rst b/tests/sites/sidebars/index.rst
index eb942bdb2a..d5596838da 100644
--- a/tests/sites/sidebars/index.rst
+++ b/tests/sites/sidebars/index.rst
@@ -11,4 +11,3 @@ Sidebar depth variations
:caption: Caption 2
section2/index
-
diff --git a/tests/sites/sidebars/section2/index.rst b/tests/sites/sidebars/section2/index.rst
index 81674a2619..942cb0e8f7 100644
--- a/tests/sites/sidebars/section2/index.rst
+++ b/tests/sites/sidebars/section2/index.rst
@@ -4,4 +4,4 @@ Section 2 index
.. toctree::
page1
- https://google.com
\ No newline at end of file
+ https://google.com
diff --git a/tests/sites/test_included_toc/index.rst b/tests/sites/test_included_toc/index.rst
index 835e503a2c..3f7893ddc2 100644
--- a/tests/sites/test_included_toc/index.rst
+++ b/tests/sites/test_included_toc/index.rst
@@ -5,4 +5,3 @@ ABC
Test Content
.. include:: toc-extension.include.rst
-
diff --git a/webpack.js b/webpack.js
index 330fc015ce..4ad37bec41 100644
--- a/webpack.js
+++ b/webpack.js
@@ -1,29 +1,29 @@
-const { resolve } = require('path');
-const webpack = require('webpack');
-const { CleanWebpackPlugin } = require('clean-webpack-plugin');
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-const CopyPlugin = require('copy-webpack-plugin');
+const { resolve } = require("path");
+const webpack = require("webpack");
+const { CleanWebpackPlugin } = require("clean-webpack-plugin");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const CopyPlugin = require("copy-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
-const staticPath = resolve(__dirname, 'pydata_sphinx_theme', 'static');
+const staticPath = resolve(__dirname, "pydata_sphinx_theme", "static");
-const vendor = resolve(staticPath, 'vendor');
+const vendor = resolve(staticPath, "vendor");
const vendorVersions = {
- fontAwesome: require('@fortawesome/fontawesome-free/package.json').version,
+ fontAwesome: require("@fortawesome/fontawesome-free/package.json").version,
};
const vendorPaths = {
- fontAwesome: resolve(vendor, 'fontawesome', vendorVersions.fontAwesome),
+ fontAwesome: resolve(vendor, "fontawesome", vendorVersions.fontAwesome),
};
// generates cache-busting templates to be used in `layout.html` without knowing versions
function macroTemplate({ compilation }) {
const indexes = Object.keys(compilation.assets).filter(
- (file) => file.indexOf('/index.') != -1
+ (file) => file.indexOf("/index.") != -1
);
- const css = indexes.filter((file) => file.endsWith('.css'));
- const js = indexes.filter((file) => file.endsWith('.js'));
+ const css = indexes.filter((file) => file.endsWith(".css"));
+ const js = indexes.filter((file) => file.endsWith(".js"));
const stylesheet = (css) => {
return `\
@@ -59,34 +59,34 @@ function macroTemplate({ compilation }) {
{% endmacro %}
{% macro head_pre_bootstrap() %}
- ${css.map(stylesheet).join('\n')}
+ ${css.map(stylesheet).join("\n")}
{% endmacro %}
{% macro head_js_preload() %}
- ${js.map(preload).join('\n')}
+ ${js.map(preload).join("\n")}
{% endmacro %}
{% macro body_post() %}
- ${js.map(script).join('\n')}
+ ${js.map(script).join("\n")}
{% endmacro %}`;
}
module.exports = {
mode: "production",
entry: {
- index: ['./src/js/index.js'],
+ index: ["./src/js/index.js"],
},
output: {
- filename: 'js/[name].[hash].js',
+ filename: "js/[name].[hash].js",
path: staticPath,
},
optimization: {
- minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin({})]
+ minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin({})],
},
externals: {
// Define jQuery as external, this way Sphinx related javascript
// and custom javascript like popper.js can hook into jQuery.
- jquery: 'jQuery',
+ jquery: "jQuery",
},
module: {
rules: [
@@ -94,19 +94,19 @@ module.exports = {
test: /\.scss$/,
use: [
{
- loader: 'file-loader',
+ loader: "file-loader",
options: {
- name: 'css/[name].[hash].css',
+ name: "css/[name].[hash].css",
},
},
{
- loader: 'extract-loader',
+ loader: "extract-loader",
},
{
- loader: 'css-loader?-url',
+ loader: "css-loader?-url",
},
{
- loader: 'sass-loader',
+ loader: "sass-loader",
},
],
},
@@ -114,10 +114,15 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin({
- cleanOnceBeforeBuildPatterns: ['**/*', '!css', '!css/theme.css', '!css/blank.css'],
+ cleanOnceBeforeBuildPatterns: [
+ "**/*",
+ "!css",
+ "!css/theme.css",
+ "!css/blank.css",
+ ],
}),
new HtmlWebpackPlugin({
- filename: resolve(staticPath, 'webpack-macros.html'),
+ filename: resolve(staticPath, "webpack-macros.html"),
inject: false,
minify: false,
css: true,
@@ -126,19 +131,19 @@ module.exports = {
new CopyPlugin([
// fontawesome
{
- context: './node_modules/@fortawesome/fontawesome-free',
- from: 'LICENSE.txt',
- to: resolve(vendorPaths.fontAwesome, 'LICENSE.txt'),
+ context: "./node_modules/@fortawesome/fontawesome-free",
+ from: "LICENSE.txt",
+ to: resolve(vendorPaths.fontAwesome, "LICENSE.txt"),
},
{
- context: './node_modules/@fortawesome/fontawesome-free/css',
- from: 'all.min.css',
- to: resolve(vendorPaths.fontAwesome, 'css'),
+ context: "./node_modules/@fortawesome/fontawesome-free/css",
+ from: "all.min.css",
+ to: resolve(vendorPaths.fontAwesome, "css"),
},
{
- context: './node_modules/@fortawesome/fontawesome-free',
- from: 'webfonts',
- to: resolve(vendorPaths.fontAwesome, 'webfonts'),
+ context: "./node_modules/@fortawesome/fontawesome-free",
+ from: "webfonts",
+ to: resolve(vendorPaths.fontAwesome, "webfonts"),
},
]),
],
diff --git a/yarn.lock b/yarn.lock
index b89f600b84..a73855b798 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6614,4 +6614,4 @@ yauzl@^2.10.0:
integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=
dependencies:
buffer-crc32 "~0.2.3"
- fd-slicer "~1.1.0"
\ No newline at end of file
+ fd-slicer "~1.1.0"