Highlight Test
Syntax Highlight Test
A quick test page to verify that :highlight_code is working across several languages.
Goblin
act greet(name) msg | "Hello, {name}!" :say(msg) xx greet("Sheriff")
act greet(name) msg | "Hello, {name}!" :say(msg) xx greet("Sheriff")
Rust
fn main() { let names = vec!["Gareth", "Mira", "Lysa"]; for name in &names { println!("Hello, {}!", name); } }
fn main() { let names = vec!["Gareth", "Mira", "Lysa"]; for name in &names { println!("Hello, {}!", name); } }
Ruby
rubyclass Hero attr_accessor :name, :hp, :hero_class def initialize(name, hp, hero_class) @name = name @hp = hp @hero_class = hero_class end def greet "Hello, #{@name} the #{@hero_class}!" end end hero = Hero.new("Mira", 14, "Rogue") puts hero.greet
rubyclass Hero attr_accessor :name, :hp, :hero_class def initialize(name, hp, hero_class) @name = name @hp = hp @hero_class = hero_class end def greet "Hello, #{@name} the #{@hero_class}!" end end hero = Hero.new("Mira", 14, "Rogue") puts hero.greet
Python
def roll_stats(sides=6, count=3): import random return sum(random.randint(1, sides) for _ in range(count)) hero = { "name": "Corin", "hp": roll_stats() + 6, "strength": roll_stats(), } print(hero)
def roll_stats(sides=6, count=3): import random return sum(random.randint(1, sides) for _ in range(count)) hero = { "name": "Corin", "hp": roll_stats() + 6, "strength": roll_stats(), } print(hero)
SQL
SELECT p.name, p.elo, COUNT(g.id) AS games_played FROM players p LEFT JOIN games g ON g.player_id = p.id WHERE p.elo >= 900 GROUP BY p.id ORDER BY p.elo DESC LIMIT 10;
SELECT p.name, p.elo, COUNT(g.id) AS games_played FROM players p LEFT JOIN games g ON g.player_id = p.id WHERE p.elo >= 900 GROUP BY p.id ORDER BY p.elo DESC LIMIT 10;
Bash
#!/bin/bash set -e echo "Building portal..." cd dist/goblin goblin run main.gbln if [ $? -eq 0 ]; then echo "Build succeeded." else echo "Build failed." >&2 exit 1 fi
#!/bin/bash set -e echo "Building portal..." cd dist/goblin goblin run main.gbln if [ $? -eq 0 ]; then echo "Build succeeded." else echo "Build failed." >&2 exit 1 fi