Syntax highlighter

Syntax highlighter
Author
Allison Thackston
Jan 29, 2019

Below are some languages and their represntative styles.

Ruby

def show
  puts "Outputting a very lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong line"
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end

Php

<?php
  print("Hello {$world}");
?>

Java

public class java {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

HTML

<html>
  <head><title>Title!</title></head>
  <body>
    <p id="foo">Hello, World!</p>
    <script type="text/javascript">var a = 1;</script>
    <style type="text/css">#foo { font-weight: bold; }</style>
  </body>
</html>

Console

# prints "hello, world" to the screen
~# echo Hello, World
Hello, World

# don't run this
~# rm -rf --no-preserve-root /

Css

body {
    font-size: 12pt;
    background: #fff url(temp.png) top left no-repeat;
}

Yaml

---
one: Mark McGwire
two: Sammy Sosa
three: Ken Griffey

C++

#include <iostream>

int main() {
    // Outputs Hello World to screen.
    std::cout << "Hello World!";
    return 0;
}

Python

import sys

def my_function():
  print("Hello from a function")

Using liquid

Without line numbers

function some(code) { /*goes here*/ }
let x = 21;

With line numbers

1
2
function some(code) { /*goes here*/ }
let x = 21;