Skip to content

Commit b17bb0e

Browse files
committed
Release v1.2.0
- Update version to 1.2.0 - Add CHANGELOG entry for v1.2.0 - Add detailed release notes in docs/source/releases/v1.2.0.md - Update releases index This release adds exercise_style configuration option and order validation for solutions that follow exercises.
1 parent 8cf34d2 commit b17bb0e

File tree

4 files changed

+158
-10
lines changed

4 files changed

+158
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## [v1.2.0](https://github.com/executablebooks/sphinx-exercise/tree/v1.2.0) (2025-11-05)
44

55
### New ✨
66

7-
- Added `exercise_style` configuration option to control solution title styling
7+
- Added `exercise_style` configuration option to control solution title styling ([#81](https://github.com/executablebooks/sphinx-exercise/pull/81))
88
- Set to `"solution_follow_exercise"` to simplify solution titles to just "Solution" (no hyperlinks, no exercise references)
99
- Default is `""` (empty string) which maintains the original behavior: "Solution to Exercise #.#" with clickable hyperlink
10-
- Added order validation system when `exercise_style = "solution_follow_exercise"`
10+
- Added order validation system when `exercise_style = "solution_follow_exercise"` ([#81](https://github.com/executablebooks/sphinx-exercise/pull/81))
1111
- Validates that solutions appear after their referenced exercises
1212
- Validates that solutions are in the same document as their exercises
1313
- Provides helpful warnings with file paths and line numbers
@@ -19,12 +19,6 @@
1919
- Improved configuration option naming for better clarity when used alongside other Sphinx extensions
2020
- Cleaner code in `post_transforms.py` with removed redundant title building logic
2121

22-
### Changed 🔄
23-
24-
- Removed dropdown button text customization from `sphinx-exercise` CSS
25-
- This styling is better handled at the theme level (e.g., in `quantecon-book-theme`) for consistent global behavior
26-
- Projects can customize dropdown text in their theme or custom CSS if desired
27-
2822
## [v1.1.1](https://github.com/executablebooks/sphinx-exercise/tree/v1.1.1) (2025-10-23)
2923

3024
### Improved 👌

docs/source/releases/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This section contains detailed release notes for sphinx-exercise versions.
55
```{toctree}
66
:maxdepth: 1
77
8+
v1.2.0
89
v1.1.1
910
v1.1.0
1011
```

docs/source/releases/v1.2.0.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Release v1.2.0
2+
3+
**Release Date**: November 5, 2025
4+
5+
This release introduces new configuration options for styling solutions that follow exercises, along with order validation to help maintain document structure consistency.
6+
7+
## ✨ New Features
8+
9+
### Solution Title Styling Configuration
10+
11+
A new `exercise_style` configuration option allows you to customize how solution titles are displayed when solutions follow their exercises.
12+
13+
**Configuration:**
14+
15+
```python
16+
# In conf.py
17+
exercise_style = "solution_follow_exercise"
18+
```
19+
20+
Or for Jupyter Book:
21+
22+
```yaml
23+
# In _config.yml
24+
sphinx:
25+
config:
26+
exercise_style: "solution_follow_exercise"
27+
```
28+
29+
**Behavior:**
30+
31+
- **When enabled** (`exercise_style = "solution_follow_exercise"`):
32+
- Solution titles show just "Solution" (simplified)
33+
- No hyperlinks back to exercises
34+
- No exercise number references
35+
- Ideal for lecture-style content where solutions immediately follow exercises
36+
37+
- **Default** (`exercise_style = ""`):
38+
- Solution titles show "Solution to Exercise #.#"
39+
- Clickable hyperlinks to the exercise
40+
- Full exercise references included
41+
- Maintains original behavior
42+
43+
**Example:**
44+
45+
````md
46+
```{exercise}
47+
:label: my-exercise
48+
49+
What is 2 + 2?
50+
```
51+
52+
```{solution} my-exercise
53+
54+
The answer is 4.
55+
```
56+
````
57+
58+
With `exercise_style = "solution_follow_exercise"`, the solution will display with the simple title "Solution" instead of "Solution to Exercise 1".
59+
60+
### Order Validation System
61+
62+
When `exercise_style = "solution_follow_exercise"` is enabled, sphinx-exercise now validates that solutions appear in the correct order:
63+
64+
**Validations performed:**
65+
- Solutions must appear **after** their referenced exercises
66+
- Solutions must be in the **same document** as their exercises
67+
68+
**Warning messages:**
69+
70+
```
71+
WARNING: [sphinx-exercise] Solution 'my-solution' appears before its exercise 'my-exercise'.
72+
When exercise_style='solution_follow_exercise', solutions should follow their exercises.
73+
Location: /path/to/file.md:42
74+
```
75+
76+
```
77+
WARNING: [sphinx-exercise] Solution 'my-solution' references exercise 'my-exercise'
78+
which is not in the same document. When exercise_style='solution_follow_exercise',
79+
solutions should appear in the same document as their exercises.
80+
```
81+
82+
**Benefits:**
83+
- Helps maintain consistent document structure
84+
- Prevents confusing layouts where solutions appear before exercises
85+
- Provides clear, actionable warnings with file paths and line numbers
86+
- Warnings prefixed with `[sphinx-exercise]` for easy identification
87+
88+
## 👌 Improvements
89+
90+
### Enhanced User Experience
91+
92+
- **Simplified titles**: Cleaner, more concise solution headings for lecture-style content
93+
- **Better organization**: Order validation helps maintain logical document flow
94+
- **Helpful diagnostics**: Clear warnings with file locations and line numbers
95+
96+
### Code Quality
97+
98+
- Removed redundant title building logic in `post_transforms.py`
99+
- Cleaner separation between directive initialization and post-transform processing
100+
- Improved configuration naming for clarity when used alongside other extensions
101+
102+
## 📦 Installation
103+
104+
Install or upgrade via pip:
105+
106+
```bash
107+
pip install --upgrade sphinx-exercise
108+
```
109+
110+
## 🔄 Migration Notes
111+
112+
**If you're upgrading from v1.1.1:**
113+
- **No breaking changes** - existing projects continue to work without modification
114+
- **No action required** - default behavior is unchanged
115+
- **Optional enhancement**: Add `exercise_style = "solution_follow_exercise"` if you want simplified solution titles
116+
117+
**If you want to use the new features:**
118+
119+
1. Add the configuration to your `conf.py`:
120+
```python
121+
exercise_style = "solution_follow_exercise"
122+
```
123+
124+
2. Rebuild your documentation:
125+
```bash
126+
sphinx-build -b html source build/html
127+
```
128+
129+
3. Review any warnings about solution ordering
130+
131+
**Compatibility:**
132+
- Python 3.10, 3.11, 3.12, 3.13
133+
- Sphinx 6, 7, 8
134+
- All existing directives and configurations continue to work
135+
136+
## 🔗 Related PRs
137+
138+
- [#81](https://github.com/executablebooks/sphinx-exercise/pull/81) - Add `exercise_style` configuration and order validation
139+
140+
## 📚 Documentation
141+
142+
For complete documentation, see:
143+
- [Configuration Options](../syntax.md#solution-title-styling)
144+
- [Installation Guide](../install.md)
145+
146+
## 💡 Use Cases
147+
148+
This release is particularly useful for:
149+
150+
- **Lecture notes** where solutions immediately follow exercises
151+
- **Tutorial content** with inline solutions
152+
- **Educational materials** that benefit from simplified styling
153+
- **Projects** that want validation of exercise/solution ordering

sphinx_exercise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:license: MIT, see LICENSE for details.
88
"""
99

10-
__version__ = "1.1.1"
10+
__version__ = "1.2.0"
1111

1212
from pathlib import Path
1313
from typing import Any, Dict, Set, Union, cast

0 commit comments

Comments
 (0)