Parses Python source code and produces a pretty-printed, syntax-highlighted HTML representation of the code. This tool uses the tokenize built-in Python tokenizer class for lexical analysis, then parses the tokens to generate the HTML output.
python main.py [-h] -p [abspath]/python_script.py [-t] [THEME_NAME] [-o]
This will create well-formatted HTML from the Python script that is sent to stdout by default.
The output can easily be sent to a file called output.html
by using the -o
switch.
The HTML file will be saved in your current working directory.
NOTE: This program requires Python3.6 or later.
-h, --help
: Show the options
-p, --path
: The absolute or relative path to the Python source file to parse (required)
-t, --theme
: The syntax highlighting theme
-o, --output
: Send output to a file rather than stdout
Available Themes:
- COOL_BLUE (default)
- COOL_BLUE_LIGHT
- CYBER
- ROBOT
- ROBOT_LIGHT
Sample using default theme 'COOL_BLUE'
Binaries are available for Linux and Windows from the bin folder.
These were compiled using Pyinstaller. This tool bundles application modules and libraries into a single executable that doesn't require Python to be installed on your system to run.
The platforms used to compile the executables were:
Linux: Linux Mint 20.2 Uma. Linux version 5.4.0-97-generic
Windows: Windows 10