This page documents how to create code examples with appropriate highlighting.
How To:
- All code blocks should be enclosed in <pre> tags
- Additionally `data-lang="something"` attribute should be set. The value should be one the langauges that we currently support (look through the examples below for a list of all supported languages)
Cypher
<pre data-lang="cypher">MATCH (u:User) where u.name = "John Doe" RETURN u</pre>
MATCH (u:User) where u.name = "John Doe" RETURN u
JavaScript
<pre data-lang="javascript">....</pre>
// Demo code (the actual new parser character stream implementation) function StringStream(string) { this.pos = 0; this.string = string; }
Python
<pre data-lang="python">....</pre>
import numpy as np cimport cython from libc.math cimport sqrt
PHP
<pre data-lang="php">....</pre>
1, 'b' => 2, 3 => 'c'); echo "$a[a] ${a[3] /* } comment */} {$a[b]} \$a[a]"; function hello($who) { return "Hello $who!"; } ?>The program says = hello("World") ?>.
Dockerfile
<pre data-lang="dockerfile">....</pre>
# Install Ghost blogging platform and run development environment # # VERSION 1.0.0 FROM ubuntu:12.10 MAINTAINER Amer Grgic "amer@livebyt.es" WORKDIR /data/ghost
Go
<pre data-lang="go">....</pre>
// Prime Sieve in Go. // Taken from the Go specification. // Copyright © The Go Authors. package main import "fmt" // Send the sequence 2, 3, 4, ... to channel 'ch'. func generate(ch chan<- int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch' } } /pre>If there is any other language that you would like to be supported on the website, please reach out to the web team (slack: #neo4j-com)