Sculpin Syntax Highlighting

Publish Date
04 Feb 2013
Estimated Readtime
5 min
Level
Intermediate
Badges

You're all programmers, right? And you're writing code snippets on your Sculpin powered blog? Yeah. So you want some highlighting with your static site generation? Here you go!

namespace Foo;

/**
 * Awesome Contrived Example.
 */
class Bar implements BarInterface
{
    private $baz;

    public function __construct(BazInterface $baz)
    {
        $this->baz = $baz;
    }

    public function doIt()
    {
        return $this->baz->do('it');
    }
}

You can also use fenced code blocks with a syntax declaration at the top. The markers are ~ instead of `.

if ($fencedCodeBlock->syntax !== 'PHP') {
    throw new UnexpectedValueException("wat");
}

Like this addition to the skeleton? You can thank for @Pawka for suggesting it. :)