If you have been using Jekyll, you must be aware of code highlighting feature using highlight blocks. This highlighting is accomplished by a neat python script called Pygments
Pygments is a very powerful code syntax highlighter. It allows you to pass various options such as weather to display line no.s or which lines to be highlighted. When Jekyll was released, there was no way to use these options since Jekyll encapsulated the execution of Python internally through Albino gem
There has been some progress over this, a pull request was submitted in Jekyll which allowed various options to be passed to Pygments.
However, when I tried to use hl_lines option to highlight the lines of code, I faced several issues. Following is the syntax I used
Running the above piece of code reults in only line 2 being highlighted and not both. So I decided to enclose it with quotation marks
The above piece of code gives the error.
Certainly, there are some things which needs to be fixed. First of all in albino, the validation function has a bug. The value regular express should be allowed quotation marks character so that hl_lines list can be provided enclosed in quotation marks. This is the first problem in albino.rb file.
The second problem is that we can seperate the hl_lines list with spaces since Jekyll uses the space as a delimeter to parse these options. To solve this problem, I pass in the list seperated by commas and then modified the highlight.rb file in Jekyll to recombine them into the list. See the updated function below:
I cannot submit it as patch in Jekyll since this fix involves fixing two components: Jekyll and Albino. May be someone can come with better approach to fix this. This works for me as of now.