Code Syntax Highlighting
Neuron provides syntax highlighting through Prism, a JavaScript library that highlights code blocks in the web browser. To customize Prism’s theme, or to provide your own syntax highlighter, you can do so in head.html
(see Custom JavaScript and CSS).
To activate syntax highlighting, you must specify the language in your fenced code blocks (see example here) or view source of the below.
Demo
Haskell:
module Prime where
primes = filterPrime [2..]
where
filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]
JSON:
{ "_comment" : "This is JSON"
, "name" : "srid"
, "loc" : "Quebec"
}
Nix:
buildPythonPackage rec {
pname = "hello";
version = "1.0";
src = fetchPypi {
inherit pname version;
sha256 = "01ba..0";
};
}
Markdown:
This is `markdown`, the *format* used by **Neuron**
# Heading
- Link to [neuron](https://neuron.zettel.page)
- [[Wiki Link]] is not official Markdown syntax
Matlab:
% This is Matlab code
data = T(:,{'Year','Month','DayofMonth','UniqueCarrier'});
data.Date = datetime(data.Year,data.Month,data.DayofMonth);
data.UniqueCarrier = categorical(data.UniqueCarrier);
This one has no language identifier specified:
Just plain text.
No particular syntax.