Messing with the Syntax Highlighter
Due to a repeated warning email from github every time I deployed a change to the page; I decided to try and get to the bottom of it.
The email:
The page build completed successfully, but returned the following warning: You are attempting to use the 'pygments' highlighter, which is currently unsupported on GitHub Pages. Your site will use 'rouge' for highlighting instead.
To suppress this warning, change the 'highlighter' value to 'rouge' in your '_config.yml' and ensure the 'pygments' key is unset.
After adding rouge
to the Gemfile:
source 'https://rubygems.org'
group :development do
gem 'rake', '~> 10.4.2'
gem 'sass', '~> 3.4.10'
gem 'jekyll', '~> 2.5.3'
gem 'travis', '~> 1.8'
gem 'rouge', '~> 2.0.6'
end
Back to the Linux shell, I ran:
dev@srv:~$ if [[ "$(gem query -i -d -l rouge)" == "false" ]]; then sudo gem install rouge; fi;
dev@srv:~$ bundle install
Before editing the _config.yml
file to read as follows:
source: .
destination: _site
sass:
sass_dir: _sass
style: expanded # compressed # expanded
# permalink and highlighter
permalink : /:year/:title/
markdown : kramdown
highlighter : rouge
Finally, with all this changed - we can re-deploy the site from the shell (or write a deploy.sh
file containing the following):
dev@srv:~$ bundle exec jekyll build
dev@srv:~$ HTML_FOLDER=$(pwd)/_site/
dev@srv:~$ git config --global user.email "name@example.com"
dev@srv:~$ git config --global user.name "Exemplar II"
dev@srv:~$ if [[ "$(git remote)" != "origin" ]]; then git remote add origin git@github.com:${github_username}/${github_username}.github.io.git; fi;
dev@srv:~$ git init
dev@srv:~$ git add --all
dev@srv:~$ git commit -m "Deploy Jekyll to GitHub Pages @ ($(date))"
dev@srv:~$ git push origin master
Apparently, “Jekyll also offers powerful support for code snippets”, lets see:
import numpy as np
import random as rnd
class G():
NUM_INITIAL_NODES = 10
NUM_GEN_NODES = 90
MEAN_DEGREE = 4
MU = 0.2
class Node():
def __init__(self,ID):
self.ID = ID
self.active = False
class NetworkCreation():
def __init__(self):
self.nodeList = []
self.edgeList = []
def createInitialNodes(self):
for i in range(G.NUM_INITIAL_NODES):
N = Node(i)
N.active = True
self.nodeList.append(N)
def createGenNodes(self):
for i in range(G.NUM_GEN_NODES):
N = Node(i+G.NUM_INITIAL_NODES)
print N.ID
self.createGenEdges(N)
N.active == True
self.nodeList.append(N)
activeList = [N for N in self.nodeList if N.active==True]
for aN in activeList:
rndDeac = rnd.randint(0,len(activeList)-1)
activeList[rndDeac].active=False
#randomly deactivate one, with variable probabilities.
def createInitialEdges(self):
for N1 in self.nodeList:
for N2 in self.nodeList:
if N1>N2:
addEdge = [N1.ID,N2.ID]
self.edgeList.append(addEdge)
def createGenEdges(self,node):
activeList = [N for N in self.nodeList if N.active==True]
for N in activeList:
rndX = rnd.random()
print rndX
if rndX < G.MU:
rndEdge=rnd.randint(0,len(self.nodeList)-1)
newEdge=[node.ID,rndEdge]
self.edgeList.append(newEdge)
else:
newEdge=[node.ID,N.ID]
self.edgeList.append(newEdge)
class RunMain():
def __init__(self):
Net = NetworkCreation()
Net.createInitialNodes()
Net.createInitialEdges()
print Net.edgeList
Net.createGenNodes()
print Net.edgeList
R = RunMain()
Radical. Check the following links for more information / further reading: