This small bash script replaces all Liquid codeblock tags with one including the lineanchors
option. For instance:
{% highlight vim %}
{% highlight ruby %}```
Is converted to:
#!/bin/zsh | |
files=(*) | |
for f in $files; do | |
if [[ $(echo $f | rev | cut -c1-3 | rev) == "eps" ]]; then | |
echo "Converting $f..." | |
basename=$(echo $f | rev | cut -c1-4 --complement | rev) | |
epspdf --bbox $f | |
pdfcrop --noverbose ${basename}.pdf ${basename}.pdf |
require 'execjs' | |
def convert(content) | |
singledollar = /(?<![\$])\$([^$]+)\$(?!\$)/ | |
doubledollar = /\$\$([^$]+)\$\$/ | |
path_to_katex = "../public/js/katex.min.js" | |
katexsrc = open(path_to_katex).read | |
katex = ExecJS.compile(katexsrc) |
% Without parentheses | |
\newcommand{\sipm}[3]{#1 $\pm$ \SI{#2}{#3}} | |
% With parentheses | |
\newcommand{\sipmp}[3]{(#1 $\pm$ #2)\si{#3}} |
import re | |
import execjs | |
def find_equations(string): | |
""" Take in a string, and convert everything between $ ... $ into an inline | |
equation and everything between $$ ... $$ into a centred equation. """ | |
doubledollar = re.compile(ur"\$\$([^$]+)\$\$") | |
singledollar = re.compile(ur"(?<![\$])\$([^$]+)\$(?!\$)") |
import grafica.*; | |
GPlot plot; | |
GPointsArray points; | |
int nPoints = 200; | |
int LEN = 200; | |
float[][] mesh = new float[1080][LEN]; | |
float gaussian(float x, float mean, float stddev) { |
#!/bin/bash | |
# Updates all my repositories in my ~/Dev folder. | |
# Requires `git-up`: `# gem install git-up` | |
REPO_DIR=$HOME/Dev # Replace with your development directory | |
cd $REPO_DIR | |
DIRS=`ls -d */` |
wget -O- http://cpanmin.us | perl - -l ~/Programs/perl5 App::cpanminus local::lib | |
eval `perl -I ~/Programs/perl5/lib/perl5 -Mlocal::lib` | |
echo 'eval `perl -I ~/Programs/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile |
This small bash script replaces all Liquid codeblock tags with one including the lineanchors
option. For instance:
{% highlight vim %}
{% highlight ruby %}```
Is converted to:
This is the stack trace I get from running pygments_global_config.rb. If anyone had any idea why this is, I would be very grateful.
Relevant _config.yml
is:
pygments_options: ['lineanchors']
Entire source code available at https://github.com/drewsberry/drewsberry.github.io/tree/source