New feature - Coderay

Sunday 16 February 2014 Tagged with: syntax highlighting and feature

After some behind-the-scenes drama, syntax highlighting is finnaly running!

This willyan began in a Wandows environment, meaning the default Pygments syntax engine wouldn’t work1. Now that work is no done on a Mac I could finally enable pygments and have all the features that Jekyll has, right?

pygments : true

Never has one line caused so much grief. Pygments wouldn’t work with liquid’s highlight, so that had to get replaced with codeblocks, which I couldn’t get working working. After a while a fell into this fun loop:

  1. code highlighting doesn’t work
  2. fix that but brakes a key markdown feature
  3. fix that but break another part of the site
  4. fix that, goto 1

So the idea of better syntax highlighting was abandoned untill I stumbled across Kramdown and its Coderay support.

##Coderay Here’s what the old codeblocks looked like: single color blocks with colors used to show the languages.

old monotone syntax highlighting

It was OK and it did the job. But the below is more readable and just looks awesome.

var buttonText = $(".tabContent h2").text();

$("ul.tabs").insert("<li><button class='tab'>" + buttonText + "</button></li>" );

$("ul.tabs").find(".tab").click(function(){
  $(this).parent().toggleClass("active");
  // ...
});

So long story short after weeks of messing around Coderay is now running and markdown has been updated. Shiny!

  1. According to the Jekyll docs, Jekyll wasn’t even supported on Wandows

Estes artigos são recentes

  1. Aug 25 2017
    Entrega de Certificado de Dispensa de Incorporação no Gama
    Como todos sabem, no Brasil a apresentação de jovens ao serviço militar é obrigatório. Nesta sexta-feira (25) houve uma solenidade na praça cívica do Gama para dispensa dos jovens e entrega do CDI (Certificado de Dispensa de Incorporação). Foram dispensados apróximadamente 300 jovens.
  2. Jan 15 2017
    Bandido bom é bandido morto
    ![bandido jpg](/content/images/bandido bom é bandido morto.jpg)
  3. Nov 08 2016
    Roubo de Água dos rios da Amazônia!
    ![navio rouba água](/content/images/navioRouboAmazonas.jpg)