You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename config option to exercise_style for clarity
Changed configuration option name from 'style_solution_after_exercise'
to 'exercise_style' to make it clearer that this belongs to sphinx-exercise.
Changes:
- Config option: exercise_style = 'solution_follow_exercise' (was: style_solution_after_exercise = True)
- Default value: '' (empty string) instead of False
- More descriptive and namespaced for clarity in config files
This makes it clearer in configuration files that this is a
sphinx-exercise specific setting, especially when used alongside
other sphinx extensions like sphinx-proof.
Updated:
- sphinx_exercise/__init__.py
- sphinx_exercise/post_transforms.py
- tests/test_style_solution_after_exercise.py
- docs/source/syntax.md
All 113 tests pass.
Copy file name to clipboardExpand all lines: docs/source/syntax.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -411,15 +411,15 @@ sphinx:
411
411
412
412
### Solution Title Styling
413
413
414
-
By default, solution titles include a hyperlink to the corresponding exercise. This behavior can be modified using the `style_solution_after_exercise` configuration option.
414
+
By default, solution titles include a hyperlink to the corresponding exercise. This behavior can be modified using the `exercise_style` configuration option.
415
415
416
-
When solutions follow exercises directly in your content (common in lecture notes), you may want to remove the hyperlink to avoid confusion when using the `dropdown` class. Set `style_solution_after_exercise` to `True` to display only text without hyperlinks in solution titles.
416
+
When solutions follow exercises directly in your content (common in lecture notes), you may want to remove the hyperlink to avoid confusion when using the `dropdown` class. Set `exercise_style` to `"solution_follow_exercise"` to display only text without hyperlinks in solution titles.
417
417
418
418
For Sphinx projects, add the configuration key in the `conf.py` file:
419
419
420
420
```python
421
421
# conf.py
422
-
style_solution_after_exercise=True
422
+
exercise_style="solution_follow_exercise"
423
423
```
424
424
425
425
For Jupyter Book projects, set the configuration key in `_config.yml`:
@@ -428,11 +428,11 @@ For Jupyter Book projects, set the configuration key in `_config.yml`:
428
428
...
429
429
sphinx:
430
430
config:
431
-
style_solution_after_exercise: True
431
+
exercise_style: "solution_follow_exercise"
432
432
...
433
433
```
434
434
435
-
When `style_solution_after_exercise` is `True`, the solution title will display plain text like "Solution to Exercise 1 (Title)" instead of a hyperlink. When `False` (default), the exercise reference in the solution title remains clickable.
435
+
When `exercise_style` is set to `"solution_follow_exercise"`, the solution title will display plain text like "Solution to Exercise 1 (Title)" instead of a hyperlink. When empty `""` (default), the exercise reference in the solution title remains clickable.
0 commit comments