Showing code
A manual, a tutorial, a gallery of examples shows code. {highlight} colours it on the server - no JavaScript library - in PHP, PAD, HTML, CSS, JavaScript, JSON, YAML, SQL or bash, with numbered and marked lines:
|
PHP |
HTML fragments/showing_code_1.pad |
Result |
|---|---|---|
|
|
The content is taken as it stands, braces and all; file= shows a file of the application instead, and the highlight pipe colours a value.
The files behind a page
{source} shows files as tabs, each coloured the same way - by default the page asked for, its template and its PHP. files= adds files after them and only= names the files alone; www: in front of a name is a file in the application's www/ directory, the script or stylesheet the browser gets:
|
PHP fragments/showing_code_2.php |
HTML fragments/showing_code_2.pad |
Result |
|---|---|---|
|
|
|
The code is read from the files that run, so what a page shows can never drift from what it does. The tabs need no script; a label says data-side="server" or "client". Neither tag shows a file outside the application, under _config/ or a dotfile.