Remove custom YAML extension and update requirements

Deleted the custom 'include_remove_yaml' Sphinx extension and its configuration. Cleaned up YAML front matter from intro.md. Updated requirements.txt to use released teachbooks package, added sphinx-gated-directives, and removed duplicate or outdated dependencies.
This commit is contained in:
Dennis den Ouden-van der Horst 2026-01-04 17:53:12 +01:00
parent 68cf7ca756
commit ee8777516e
4 changed files with 3 additions and 47 deletions

View file

@ -11,8 +11,6 @@ html:
baseurl : "https://teachbooks.io/manual/"
sphinx:
local_extensions:
include_remove_yaml: _ext/
extra_extensions:
- sphinx_inline_tabs
- sphinx.ext.imgconverter

View file

@ -1,33 +0,0 @@
from __future__ import annotations
from sphinx.util import logging
logger = logging.getLogger(__name__)
def _strip_yaml(lines: list[str]) -> list[str]:
if not lines:
return lines
for ix,lines_set in enumerate(lines):
new_lines = lines_set.splitlines()
if new_lines[0].strip() != "---":
continue
# yaml front matter detected
# find closing delimiter
index_end = 1
for i in range(1, len(new_lines)):
tok = new_lines[i].strip()
if tok == "---":
index_end = i
break
new_lines = new_lines[index_end+1 :]
lines[ix] = "\n".join(new_lines)
return lines # no closing delimiter -> leave unchanged
def on_include_read(app, docname, path, content):
# content is a list[str]; modify in-place
new = _strip_yaml(content)
if new is not content:
content[:] = new
def setup(app):
app.connect("include-read", on_include_read)
return {}

View file

@ -1,8 +1,3 @@
---
file_format: mystnb
kernelspec:
name: python3
---
# TeachBooks Manual
This manual is primarily designed for and by teachers for use in education, but should be a useful resource for anyone interested in creating and collaborating on a TeachBook: a <a href="https://jupyterbook.org/v1/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="images/logo-wide.svg" alt="Jupyter book v1"> v1</a> using the <a href="https://www.sphinx-doc.org/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="images/sphinx-logo.svg" alt="Sphinx logo"> Sphinx backend</a> with additional editing tools and book features. Our aim is to provide a simple way to start book-making for new users (it only takes 10 clicks!), ease the editing process for anyone, and provide additional features developed for education-purposes. We hope you find this resource useful and refer back to it often.

View file

@ -1,8 +1,8 @@
# teachbooks == 0.2.3
git+https://github.com/TeachBooks/TeachBooks@issue-127
teachbooks == 0.2.3
sphinx-inline-tabs
git+https://github.com/TeachBooks/TeachBooks-Favourites
sphinx-gated-directives
teachbooks-sphinx-grasple
@ -11,8 +11,4 @@ sphinx-apa-references
# For executing Jupyter Notebooks
myst_nb
numpy
matplotlib
sphinx-tudelft-theme == 1.2.1
git+https://github.com/TeachBooks/Sphinx-Gated-Directives
matplotlib