Frag's Writings :: Highlighting

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.

Aim

For this blog I required a syntax highlighter that was:

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;
}

Note to self

To get pandoc to use the proper class attribute that prism.js expects, use language-cpp instead of cpp in the markdown sources

 


Last Updated on 2017-02-19 @ 12:48 IST

Home  | Posts