diff --git a/build-slides.sh b/build-slides.sh index 3bd3b60..47b4a4a 100755 --- a/build-slides.sh +++ b/build-slides.sh @@ -52,12 +52,17 @@ document.querySelectorAll('code.language-mermaid').forEach(el => { div.textContent = el.textContent; el.closest('pre').replaceWith(div); }); -mermaid.initialize({ startOnLoad: false, theme: 'dark' }); -await mermaid.run(); +mermaid.initialize({ startOnLoad: true, theme: 'dark' }); """ -content = open(path).read() -open(path, 'w').write(content.replace('', snippet + '\n', 1)) +with open(path, encoding='utf-8') as f: + content = f.read() +new_content = content.replace('', snippet + '\n', 1) +if new_content == content: + print(f"Warning: not found in {path}", file=sys.stderr) + sys.exit(1) +with open(path, 'w', encoding='utf-8') as f: + f.write(new_content) PYEOF }