Student & Instructor versions

Some teaching materials keep exercises and answers in one source document, then render a learner-facing output and an answer-bearing output. This avoids maintaining two copies of the same exercise text.

Solution callouts

Install and enable callout-solution when an explanation or worked answer should appear only in instructor output. Write solution content as:

::: {.callout-solution}
Answer text or worked solution.
:::

An individual solution can override the configured default title:

::: {.callout-solution title="Worked example"}
Answer text or worked solution.
:::

Conditional exercises and solutions

Install and enable strip-solution when a source document contains paired student/instructor material. It handles both ordinary divs and code cells:

::: {teaching="exercise"}
Instructions or scaffolding retained in the student output.
:::

::: {teaching="solution"}
Answer content retained in the instructor output.
:::
```{python}
#| teaching: exercise
#| eval: false
... # Student starting point
```

```{python}
#| teaching: solution
print("Instructor solution")
```

Mark scaffold cells with #| eval: false explicitly when they should be displayed but not executed. strip-solution does not add that setting.

Check both views

When editing material affected by visibility rules:

  1. Preview or render the learner-facing output and confirm answers are absent while instructions and starter material remain usable.
  2. Preview or render the answer-bearing output and confirm worked solutions, code, and any instructor-specific guidance are visible.
  3. Keep shared statements outside filtered blocks unless the text genuinely differs between audiences.

Existing repositories

Maintain established repositories using their configured vocabulary and filters. structure_biology already uses teaching-tools solution callouts, collapsed callouts, and download buttons, with profiles named exercise/solution. molecular_biology_I uses the recommended student/instructor vocabulary but currently has project-specific filters. fysisk_biokemi uses student/master and repository-local strip filters.

The legacy code-cell options #| exercise: true and #| solution: true remain supported by strip-solution for existing material, but new content should use #| teaching: exercise and #| teaching: solution.