Skip to content

Make sticky_contents default to True#371

Open
mmcky wants to merge 2 commits intomainfrom
sticky-contents-default-true
Open

Make sticky_contents default to True#371
mmcky wants to merge 2 commits intomainfrom
sticky-contents-default-true

Conversation

@mmcky
Copy link
Contributor

@mmcky mmcky commented Mar 4, 2026

Summary

Makes sticky_contents default to True so the sticky right-hand table of contents with scroll spy is enabled out of the box.

The sticky TOC was introduced in v0.17.0 (#350) and has proven to be the preferred experience. This change makes it the default for all projects using the theme — no configuration needed.

Changes

  • theme.conf — changed sticky_contents = Falsesticky_contents = True
  • configuration.md — updated docs to describe sticky TOC as the default, with instructions on how to disable it
  • test_build.py — updated tests to expect sticky TOC enabled by default and added a test for explicitly disabling it
  • CHANGELOG.md — added unreleased entry

Opting out

Projects that prefer the classic TOC can set:

html_theme_options = {
    "sticky_contents": False,
}

The sticky right-hand table of contents with scroll spy was introduced
in 0.17.0 and has proven to be the preferred experience. This change
enables it by default for all projects using the theme.

Users can opt out by setting sticky_contents: false in html_theme_options.
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@3ffc996). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #371   +/-   ##
=======================================
  Coverage        ?   45.92%           
=======================================
  Files           ?        2           
  Lines           ?      405           
  Branches        ?        0           
=======================================
  Hits            ?      186           
  Misses          ?      219           
  Partials        ?        0           
Flag Coverage Δ
pytests 45.92% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes the QuantEcon Book Theme’s default behavior to enable the sticky right-hand table of contents (“scroll spy” TOC) out of the box, aligning the default theme experience with the feature introduced in v0.17.0.

Changes:

  • Switch sticky_contents default from False to True in the theme’s default configuration.
  • Update user documentation to describe sticky TOC as the default and document how to opt out.
  • Update build tests and changelog to reflect the new default behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/test_build.py Updates expectations so sticky TOC is enabled by default and adds coverage for explicitly disabling it.
src/quantecon_book_theme/theme/quantecon_book_theme/theme.conf Sets sticky_contents = True as the theme default option.
docs/user/configuration.md Reframes sticky TOC docs as default-enabled and provides opt-out instructions.
CHANGELOG.md Adds an Unreleased entry noting the default change and how to revert.
Comments suppressed due to low confidence (1)

docs/user/configuration.md:195

  • The “Disable auto-expansion” section now shows only "contents_autoexpand": False. Since contents_autoexpand only affects the sticky TOC, it would be clearer to explicitly state that this option has an effect only when sticky_contents is enabled (now the default), so readers don’t expect it to change the classic/non-sticky TOC.
### Disable auto-expansion

```python
html_theme_options = {
    ...
    "contents_autoexpand": False,
    ...
}

When contents_autoexpand is False, only top-level section names are displayed.

</details>



---

You can also share your feedback on Copilot code review. [Take the survey](https://www.surveymonkey.com/r/XP6L3XJ).

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎭 Visual Regression Test Results

passed  45 passed
skipped  1 skipped

Details

stats  46 tests across 1 suite
duration  1 minute, 3 seconds
commit  51942cc

Skipped tests

mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions github-actions bot temporarily deployed to pull request March 4, 2026 05:09 Inactive
- test: assert back-to-top and data-autoexpand absent when sticky disabled
- docs: note contents_autoexpand only affects sticky TOC
- changelog: clarify opt-out for both Python conf.py and YAML _config.yml
@mmcky
Copy link
Contributor Author

mmcky commented Mar 4, 2026

Also addressed in 51942cc (suppressed suggestion on docs/user/configuration.md). Added a note to the "Disable auto-expansion" section making clear that contents_autoexpand only has an effect when the sticky TOC is enabled — it has no impact when sticky_contents is set to False.

Also confirming: contents_autoexpand is True by default (set in theme.conf), so auto-expansion is on out of the box alongside the now-default sticky TOC.

@mmcky
Copy link
Contributor Author

mmcky commented Mar 4, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants