Created
January 15, 2021 03:11
-
-
Save auxesis/479e0b9bd2ccde0801c4e03621fc6f57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| if [ $# == 0 ]; then | |
| echo "Usage: $0 <filename>" | |
| exit 1 | |
| fi | |
| source_filename=$1 | |
| target_filename="$(mktemp -d)/$(basename $1)-highlight.html" | |
| if [ ! -e "$source_filename" ]; then | |
| echo "File not found: $source_filename" | |
| exit 2 | |
| fi | |
| pygmentize -f html -O bg=light,noclasses,style=colorful $source_filename > $target_filename | |
| open $target_filename | |
| echo "Highlights written to $target_filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment