Skip to main content

Convert source code repository to HTML files.

Brief

Do you like reading source code on your mobile devices?

HTML is a light-weight format (unlike PDF or EPUB) that can be easily read on every browser-included mobile device.

code2html is a tool converts source code repository to HTML format files so that you can put them into your mobile devices and read it whenever and wherever with a beautiful syntax highlight (thanks Vim).

Get rid of those social networking applications, start to enjoy code reading.

Requirements

By taking advantages of the magic TOhtml function from Vim, code2html requires you have Vim installed. Also if you specify a non-default color scheme to use, it must be available on your system as well.

Usage

code2html [-h] [--color COLOR] [--include INCLUDES] [--pre] input output

positional arguments:
  input               Path to the source code repository
  output              Path for saving output files

optional arguments:
  -h, --help          show this help message and exit
  --color COLOR       Specify the color scheme use for syntax highlighting
  --include INCLUDES  Specify file matching patterns, then only the matched
                      files will be convert. Wild card characters are
                      supported. e.g. --include="*.c" --include="?.py"
  --pre               Instead of actually performing the conversion, simply
                      display what *would* have been converted if --pre
                      weren't used

Example 1

Use --pre to check what would be converted:

$ code2html --pre --include="*.cpp" /path/to/input /path/to/output

Example 2

Convert all Python sources, ext.c and a README file from /path/to/input to /path/to/output, using jellybeans as the syntax highlight scheme:

$ code2html --color=jellybeans --include="*.py" --include="ext.c"
--include="README.rst" /path/to/input /path/to/output

Example 3

Put the source code files into your mobile devices and find a good file manager to organize them. And then next time you wait for lunch, bus, girlfriend (FIXME!), etc., read some code!

https://raw.githubusercontent.com/kfei/code2html/master/misc/img1.png https://raw.githubusercontent.com/kfei/code2html/master/misc/img2.png https://raw.githubusercontent.com/kfei/code2html/master/misc/img3.png https://raw.githubusercontent.com/kfei/code2html/master/misc/img4.png

Release files for code2html 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for code2html 0.3.2
File Size Uploaded
code2html-0.3.2.tar.gz 6.1 kB Details

Release files / code2html-0.3.2.tar.gz

Download URL code2html-0.3.2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
021f90c705437641395bf9a232d71756f3d8526eb02b3b63e0bc71f8f34019fa
BLAKE2b-256 checksum
How to use checksums
17364225b464bba372b3b82fc2d6414e909a7e6873d03089a704f7f64337e3b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.2 This release

1 release file

0.3.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page