Add pre-commit hook for rendering notebooks
This commit is contained in:
parent
3f862231b5
commit
cf36182a28
2 changed files with 18 additions and 0 deletions
10
.pre-commit-config.yaml
Normal file
10
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: nbconvert
|
||||||
|
name: Convert Jupyter Notebooks to Markdown
|
||||||
|
language: system
|
||||||
|
entry: ./.pre-commit/run-nbconvert.sh
|
||||||
|
files: ^.*\.ipynb$
|
||||||
|
pass_filenames: true
|
||||||
|
fail_fast: true
|
8
.pre-commit/run-nbconvert.sh
Executable file
8
.pre-commit/run-nbconvert.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
for nb in "$@"; do
|
||||||
|
echo "Converting $nb to markdown..." >&2
|
||||||
|
out_dir="$(dirname "$nb")"
|
||||||
|
jupyter nbconvert "$nb" --to markdown --output-dir "$out_dir/rendered"
|
||||||
|
done
|
Loading…
Add table
Add a link
Reference in a new issue