The {highlight} tag colours source code on the server - PAD, PHP, HTML,
CSS, JavaScript, JSON, YAML, SQL and Bash. No JavaScript library, and the braces inside need no
{ignore}.
<?php
$orders = db ( "ARRAY * FROM orders WHERE status = 'open'" );
$total = padArrSum ( $orders, 'amount' );
if ( ! $orders )
padRedirect ( 'empty' );
?>
{highlight 'php', lines, mark='4'}...{/highlight}
{orders sort='date', first=10}
<li class="{even@orders ? 'even' : 'odd'}">
{$number}: {$total | money}
</li>
@else@
<li>No orders yet</li>
{/orders}
.card { padding: 12px 16px; border-radius: 8px; color: #333; }
@media (prefers-color-scheme: dark) { .card { color: #eee; } }
// Counts the clicks on every button with a data-count attribute
document.querySelectorAll('[data-count]').forEach(button => {
let clicks = 0;
button.addEventListener('click', () => button.textContent = `Clicked ${++clicks} times`);
});
<?php
$title = 'QR Codes';
// The text to encode: what the form posted - its rules, on the field in qr.pad, are kept
// before this runs - else the address of PAD itself.
if ( ! padPosted ( 'qr' ) or ! is_string ( $text ?? NULL ) )
$text = 'https://github.com/herbert256/pad';
$levels = [
[ 'level' => 'L', 'restores' => '7%' ],
[ 'level' => 'M', 'restores' => '15%' ],
[ 'level' => 'Q', 'restores' => '25%' ],
[ 'level' => 'H', 'restores' => '30%' ],
];
$wifi = 'WIFI:T:WPA;S:PAD Demo;P:inversion-of-control;;';
?>
{highlight file='qr.php'} - the language follows the extension.
SELECT name, COUNT(*) AS orders FROM customers JOIN orders USING (customer_id) WHERE country = 'NL' GROUP BY name
{$query | highlight('sql')} - a query kept in a database or a log.