Prism Highlighter
is a Grav plugin that adds simple and powerful code highlighting functionality utilizing the Prism.js syntax highlighter.
At this time, this plugin is not avaiable via Grav Package Manager (GPM). To install you can clone the project. In the Grav root folder, execute:
cd /user/plugins/
git clone https://github.com/alvr/grav-prism-highlight.git prism
Or download the latest release and upload it to /user/plugins/
Prism.js supports currently 119 languages, at the time of this edit.
In your markdown, you can create a block of code, and assign the language to it. You can choose between the list above. Example:
```java
import java.util.HashSet;
public class Program {
public static void main(String[] args) {
// Create HashSet.
HashSet<String> hash = new HashSet<>();
hash.add("castle");
hash.add("bridge");
hash.add("castle"); // Duplicate element.
hash.add("moat");
// Display size.
System.out.println(hash.size());
// See if these three elements exist.
System.out.println(hash.contains("castle"));
System.out.println(hash.contains("bridge"));
System.out.println(hash.contains("moat"));
}
}```
You can also override the default theme for a page.
In the expert mode, add to the Frontmatter:
prism:
theme: dark
You can choose between:
default
coy
dark
funky
okaidia
solarized-light
twilight