Created
February 1, 2016 23:00
-
-
Save mcleonard/97ad7f6338d3e3c4ad06 to your computer and use it in GitHub Desktop.
A shell script for processing a Jupyter notebook Markdown file for use with Pelican
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE=$1 | |
FILENAME="${FILE%%.*}" | |
FILE_DIR="${FILENAME}_files" | |
if [ -d $FILE_DIR ]; then | |
# When converting a notebook to markdown, all the images in the markdown file link to the files | |
# folder created when converting. We need to replace the file folder with | |
# the static images folder used by Pelican. | |
sed -i "" "s/${FILE_DIR}/images/g" $1 | |
# Also copy images from file directory to images | |
cp $FILE_DIR/* images | |
rm -r $FILE_DIR | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment