<-- cd /blog

$ cat blog/cypher-syntax-highlighter.md

Cypher Syntax Highlighter for SyntaxHighlighter.js

#dsp2017#neo4j#cypher#javascript#open-source

Originally published on speedydev.pl in 2017 as part of the Daj Się Poznać blogging contest. Republished here for archival purposes.

Cypher syntax highlighting preview

The monotony of un-highlighted Cypher code in my blog posts was driving me crazy, so I couldn’t resist doing something about it.

I stopped writing the next post mid-way and built a Cypher brush for SyntaxHighlighter.js, based on the existing Notepad++ syntax file by Nicole White.

Color perception is subjective — suggestions welcome.

Gist: sakrut/cypher-syntaxhighlighter

Commits to BlogEngine.NET:

Demo — now with proper highlighting:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///pointLocation.csv" AS row
MATCH (p:Point {name: row.nazwa})
MATCH (stc:Segment {lineNo: toInt(row.nr_lini)})
WHERE toInt(row.km_os) >= toInt(stc.kmFrom)
  AND (toInt(stc.kmTo) > toInt(row.km_os) OR toInt(row.km_os) = toInt(stc.kmTo))
MERGE (p)-[:Stay {km: toFloat(row.km_os), lineNo: toInt(row.nr_lini)}]-(stc);