Syntax Highlighter


Koala comes included with a Syntax Highlighter for code blocks, using RainbowJS. As well as generic pattern matching, it has support for the following languages:

  • HTML/CSS
  • Python
  • Ruby
  • Shell
  • Java
  • PHP
  • CoffeeScript
  • C
  • Go
  • Scheme
  • Lua
  • C#
  • Haskell

Below is a preview of some of the above languages being highlighted.

HTML / CSS

<!DOCTYPE html>
<html>
	<body>
		<h1>My First Heading</h1>
		<p>My first paragraph.</p>
	</body>
</html>
.wrapper{
	max-width:1400px;
	width:100%;
	@media (max-width: 1470px) {
		padding:0 2.5%;
	}
}

Python

def openFile(path):
    file = open(path, "r")
    content = file.read()
    file.close()
    return content

Ruby

def self.consume_front(str, size)
	str[0..size] = ''
	str.lstrip!
end

Shell

ls -la /home

PHP

function ivy_get_time(){
    if(get_theme_mod('layout_use_custom_date_format', false)){ 
    	the_date(); 
    }else{ 
    	the_time('jS F Y '); 
    }
}
Comentarios
There are currently no comments.