diff --git a/nbtutor/__init__.py b/nbtutor/__init__.py index 33893d6..f3b1a37 100644 --- a/nbtutor/__init__.py +++ b/nbtutor/__init__.py @@ -22,6 +22,7 @@ def __init__(self, **kw): os.makedirs(self.solutions_dir) self.solution_count = 1 + self.exercise_count = 1 super(Preprocessor, self).__init__(**kw) @@ -38,4 +39,9 @@ def preprocess_cell(self, cell, resources, index): self.solution_count += 1 + if cell.cell_type == "markdown" and "EXERCISE" in cell.source: + cell.source = cell.source.replace('EXERCISE', f'EXERCISE {self.exercise_count}') + self.exercise_count += 1 + return cell, resources +