Skip to content

Commit

Permalink
check if admonition is note
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jan 7, 2025
1 parent 48d48ae commit 44aa6d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/validate-headings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def validate_headers(path: Path) -> None:

title_count = 0
admonition_count = 0
admonition_is_note = False
headings_count = dict.fromkeys(HEADINGS, 0)
for cell in notebook.cells:
if cell["cell_type"] != "markdown":
Expand All @@ -32,6 +33,9 @@ def validate_headers(path: Path) -> None:
title_count += 1
elif line == f"```{{admonition}} {ADMONITION_TITLE}":
admonition_count += 1
elif admonition_count and not admonition_is_note:
admonition_is_note = line.startswith(":class: note")
assert admonition_is_note, f"{path=!s}: The admonition is not a note"

if not path.name.startswith("template"):
assert title_count, f"{path=!s}: The first line is not a title."
Expand Down

0 comments on commit 44aa6d5

Please sign in to comment.