Create an highlight octopress plugin
Suppose you’re writing highlight something very important, and something less important that it won’t to you to win the Turing award. And after awhile, you write highlight another piece of text that you really want to highlight.
and something that people can soon forget.
How can you make it happen if you blog with octopress? You can use my highlight plugin.
Writing an octopress plugin is very easy, this is the second one after a gravatar plugin I wrote in May to make you to use gravatar keyword in your posts.
Octopress uses Jekyll static website creation framework and liquid templating system for ruby.
``` ruby Highlight plugin source code module Jekyll class Highlight < Liquid::Tag @text = “”
def initialize(tagname, text, tokens)
@text = text
end
def render(context)
"<span class=\"fluo\">#{@text}</span>"
end
end
end Liquid::Template.register_tag(‘highlight’, Jekyll::Highlight)
This is the piece of css I placed in my sass/custom/_layout.scss file.
``` css
span.fluo {
background-color: #FEDB7C;
padding: 3px 1px 3px 1px;
text-shadow: 0 -1px 1px #DAC793;
}
Enjoy it!