Configure Syntax Highlighting on Ghost

For syntax highlighting I am going to use highlight.js because I don't have to install anything. Simply add the following code to the blog header code injection in the settings:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/solarized-dark.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<style>
  pre {
    word-wrap: normal;
    -moz-hyphens: none;
    -ms-hyphens: none;
    -webkit-hyphens: none;
    hyphens: none;
    font-size: 0.7em;
    line-height: 1.3em;
  }
    pre code, pre tt {
    white-space: pre;
  }
</style>

Links:

c++


int = 42;
double = 42.0;
std::string hello = "Hello World!";

Python

def testing():
    """
    A test function
    """
    if x == 1:
        return 3 + 4 - 6
    else:
        return 6

def main():
print(
   "Finally... technical writing is as easy as %s" %
 ' '.join(map(lambda x: str(x), range(1,4))))

Troy Williams

My name is Troy Williams and I am a professional mining engineer and programmer writing software for the mining industry.