Frag's Writings :: Highlighting
Apart from being a must-have feature for any "cool" blog, syntax highlighting is a really useful visual guide when reading code. There are even papers extolling the virtues of this feature.
For this blog I required a syntax highlighter that was:
.js
doing the hardwork of lexing and a .css
dealing with the actual colours and styling)Some consultation with the webdev experts in #programming
on the D&H slack lead me to prism.js and when all is done, results are pretty good!
#include <iostream>
int main(void)
{
std::cout<<"Hello, World!"<<std::endl;
return 0;
}
-vs-
#include <iostream>
int main(void)
{
std::cout<<"Hello, World!"<<std::endl;
return 0;
}
To get
pandoc
to use the properclass
attribute thatprism.js
expects, uselanguage-cpp
instead ofcpp
in the markdown sources