Skip to content

Instantly share code, notes, and snippets.

@hjacobs
Created October 26, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hjacobs/9ac697bc71b8c7705c2b2442bd5a09c3 to your computer and use it in GitHub Desktop.
Save hjacobs/9ac697bc71b8c7705c2b2442bd5a09c3 to your computer and use it in GitHub Desktop.
Convert bash script to syntax highlighted HTML
#!/usr/bin/env python3
import sys
from pygments import highlight
from pygments.lexers import BashLexer
from pygments.formatters import HtmlFormatter
print(highlight(sys.stdin.read(), BashLexer(), HtmlFormatter(full=True)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment