How this site is built

This page explains the tools used to generate the site.

Syntax highlighting

Code highlighting is achieved at compile-time by filtering the HTML code through an AWK script which replaces certain tags with the output of source-highlight. As an added bonus this process also escapes HTML special characters which are quite common in code. Example:

#include <stdio.h>
int main() {
	printf("%s", "Hello, world!");
}

Equations

For typesetting math, GNU Troff is used with the eqn preprocessor. The equations are written directly in HTML code enclosed in a special tag. When compiling the website, an AWK script pipes the contents of such tags to Eqn and Groff and then to Ghostscript, which trims the PostScript code and produces a PNG with a transparent background and finally converts it to a data: URI using base64. Example:

 sum from {i = 1} to n { i^2 + 2^i } over { prod from {k = 1} to i { 1 over sqrt k } }

Here is another example showing off more advanced Groff capabilities like color and defining custom macros to denote canceled expressions:

   v vec { x cancel { red {y^2} } } over cancel { red {y^2} }