MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / find_markdown_chapters

Function find_markdown_chapters

build_ebook.py:67–91  ·  view source on GitHub ↗

Find all Markdown files and interpret them as chapters.

(markdown_dir: Path)

Source from the content-addressed store, hash-verified

65
66
67def find_markdown_chapters(markdown_dir: Path) -> list[Path]:
68 """Find all Markdown files and interpret them as chapters."""
69
70 markdown_entries = list(markdown_dir.rglob("*"))
71 markdown_entries.sort()
72
73 markdown_chapters = []
74
75 for markdown_path in markdown_entries:
76 # Skip privacy policy (regardless of language)
77 if markdown_path.name.startswith("95_"):
78 continue
79
80 title = markdown_path.stem.partition("_")[-1].replace("_", " ")
81 depth = len(markdown_path.relative_to(markdown_dir).parts) - 1
82
83 markdown_chapters.append(
84 MarkdownChapter(
85 title=title,
86 depth=depth,
87 contents=markdown_path.read_text() if markdown_path.is_file() else "",
88 )
89 )
90
91 return markdown_chapters
92
93
94def generate_markdown_preface() -> str:

Callers 1

compile_full_markdownFunction · 0.85

Calls 1

MarkdownChapterClass · 0.85

Tested by

no test coverage detected