Skip to content

Instantly share code, notes, and snippets.

@alecjacobson
Last active July 22, 2021 03:09
Show Gist options
  • Save alecjacobson/0f946f6cbf9d7156666b45117ec5da48 to your computer and use it in GitHub Desktop.
Save alecjacobson/0f946f6cbf9d7156666b45117ec5da48 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This will download and run readme2tex on the given README.tex.md, commit the
# resulting svgs and README.md file to the repo and push the changes
if [ $# -eq 0 ]; then
echo "Usage:
./readme2tex.sh path/to/repo/with/README.tex.md"
exit 1
fi
READMETEXMD_DIR="${1%/*}"
cd "$READMETEXMD_DIR"
if [ -d "readme2tex/" ]
then
git clone https://github.com/leegao/readme2tex readme2tex
fi
python -m readme2tex --svgdir tex --output README{,.tex}.md
sed -i '' -e 's#https[^"]*tex#./tex#g' README.md
## DO NOT DO THIS WHILE PROTOTYPING THIS CREATES A VERY BIG GIT HISTORY OF NON-NEGLIGIBLE .svg FILES
#git add tex/*.svg README.md
#git commit -m "readme2tex"
#git push
#rm -rf readme2tex/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment