{{- /* Code-block render hook for Cypher. Chroma (the highlighter Hugo bundles) has no Cypher lexer, so ```cypher blocks would otherwise render unhighlighted on the doc site. This hook applies a lightweight, Cypher-aware highlight using the same Chroma CSS classes (k, nf, nl, m, c1) the rest of the site already styles. The GitHub READMEs are generated separately and keep their ```cypher fences, where GitHub's own Linguist grammar highlights them. */ -}} {{- $h := trim .Inner "\n" | htmlEscape -}} {{- /* htmlEscape turns ' into the entity '; its digits would otherwise be caught by the number rule below (producing ' which browsers can't decode, showing a literal '). Park it on a placeholder and restore it after all the highlighting regexes have run. */ -}} {{- $sq := "\ue000" -}} {{- $h = replace $h "'" $sq -}} {{- /* line comments */ -}} {{- $h = $h | replaceRE `(//[^\n]*)` `$1` -}} {{- /* keywords */ -}} {{- $h = $h | replaceRE `(?i)\b(MATCH|OPTIONAL|WITH|WHERE|RETURN|MERGE|CREATE|DELETE|SET|REMOVE|UNWIND|ORDER|BY|SKIP|LIMIT|AS|CASE|WHEN|THEN|ELSE|END|AND|OR|XOR|NOT|IN|STARTS|ENDS|CONTAINS|IS|NULL|TRUE|FALSE|DISTINCT)\b` `$1` -}} {{- /* functions called as name( — includes Drasi's Cypher extension functions */ -}} {{- $h = $h | replaceRE `\b(avg|count|sum|min|max|collect|floor|ceil|round|abs|coalesce|toInteger|toFloat|size|length|duration|trueFor|trueLater|changeDateTime|getVersionByTimestamp|realtime|listMax|listMin)(\s*\()` `$1$2` -}} {{- /* node / relationship labels after a colon */ -}} {{- $h = $h | replaceRE `:([A-Za-z_][A-Za-z0-9_]*)` `:$1` -}} {{- /* numbers */ -}} {{- $h = $h | replaceRE `\b(\d+(?:\.\d+)?)\b` `$1` -}} {{- /* restore the single-quote entity */ -}} {{- $h = replace $h $sq "'" -}}
{{ $h | safeHTML }}