Code Embedding
We will use the WP-Syntax WordPress plugin to embed code using attractive formatting and syntax colorization. Information about WP-Syntax is here; additional usage examples are here.
For a quick example, suppose your code is the following:
void setup() {
size(200, 200);
}
void draw() {
smooth();
background(#ffffff);
rect(0,0, width-1,height-1);
ellipse (100, 100, random(80), random(80));
line (0,0, mouseX, mouseY);
}
To see this formatted properly, put the fragment <pre lang=”java”> before your code, and </pre> afterwards. The result will look like the following:
void setup() { size(200, 200); } void draw() { smooth(); background(#ffffff); rect(0,0, width-1,height-1); ellipse (100, 100, random(80), random(80)); line (0,0, mouseX, mouseY); } |
WP-Syntax supports all GeSHI languages, listed here.
Comments Off on Code Embedding