Coder

posted in code on 20th Nov 2024
tagged with testing
1 minute read


This post was to demonstrate code highlighting. This was to be done via the highlight.php library. It worked fine but was rather bloated and loaded a large javascript file. So I ditched it. Code is now just displayed in a monospaced font with a grey background.

Inline code

This paragraph will contain one or two code snippets which, hopefully, will be highlighted. First a tiny bit of JavaScript console.log('hello') and perhaps some PHP - something simple like display this year - which would be <?php echo date('Y') ?> - nice.

Is block-level highlighting any different?

@media (769px <= width <= 1279px) {
  .example {
    padding: 3.5rem 3rem;
  }
}

PHP testing

Inline testing will look like this <?php phpinfo(); ?> - looks good.

And a block?

<?php
// Assign the value "Hello!" to the variable "greeting"
$greeting = "Hello!";
// Assign the value 8 to the variable "month"
$month = 8;
// Assign the value 2019 to the variable "year"
$year = 2019;
?>

Without highlight.php

This is inline <?php echo date('Y') ?> and so is this nano /etc/nginx/sites-available/default.

And this is block-level:

<?php
// Assign the value "Hello!" to the variable "greeting"
$greeting = "Hello!";
// Assign the value 8 to the variable "month"
$month = 8;
// Assign the value 2019 to the variable "year"
$year = 2019;
?>


Wide image  |  next
Vision On  |  previous