Fri, 14 Sep 2012

CodeShow: Code Sharing for Technical Presenters

I give a lot of technical presentations, and one thing I continually struggle with is how to show code samples on a big screen. Like many speakers, I've sometimes pasted code into PowerPoint and sometimes opened up Visual Studio or Sublime Text in full-screen mode with a zoomed font. I've found neither to be ideal.

Recently, I was asked to give a full day of Windows Azure training, and I decided it was finally time to build a tool for this. The result is CodeShow, a Python-based command-line tool that turns a directory of code into a static website.

You can see a sample of its output at Notice the large font, the light-on-dark color scheme, and the friendly line wrapping. Also notice that lines are highlighted as you mouse over them. All of this is designed around the requirements of a big-screen presentation.

Because CodeShow generates websites, they can be easily published, giving attendees of your talk the ability to read along with you on their own laptops or revisit code samples later. CodeShow also understands readme files (in Markdown or plain text), making the samples more usable as standalone websites.

Naturally, I'm using Site44 to host the static websites I create, and CodeShow even has a --site44 option that uses extensionless URLs and Site44's custom mime types instead.

Using CodeShow

If you have Python, you can install CodeShow with pip install codeshow and then run it by just typing codeshow. By default, CodeShow will process the current directory and generate the static website in the output directory.

CodeShow ignores binary files, and it can be configured to ignore entire directories by passing the --ignore PATH argument (as many times as you want, for multiple directories). Those paths can even be .gitignore-like globs, like **/bin.

The Code

The full code for CodeShow is available on GitHub: