In LaTeX, you can define macros to help ease typing things that have low content-to-markup. (By the way, holy crap, how the hell do I include LaTeX snippets without making Liquid cry tears of blood?) Anyways, I needed to define a helper tag for myself to wrap my images so that they pop up. And it should optionally take a caption so when you mouse over, it shows up the text. Here’s what I did:

module Jekyll
    class PopupImageMacroTag < Liquid::Tag
        def initialize(tag_name, text, tokens)
            super
            bits = text.split
            @href = bits[0]
            @title = ''
            if bits.size > 1
                @title = bits.slice(1, bits.size).join(' ')
            end
        end

        def render(context)
            baseurl = context.registers[:site].config['baseurl']
            @href = "#{baseurl}/#{@href}"
            img_text = "<img src=\"#{@href}\""
            if @title.size > 0
                img_text += " title=\"#{@title}\""
            end
            img_text += " />"
            "<a href=\"#{@href}\" class=\"image-link\">#{img_text}</a>"
        end
    end
end
Liquid::Template.register_tag('popup_image', Jekyll::PopupImageMacroTag)

So it’s a little weird because you need to parse the arguments yourself, i.e. you can’t specify the different parameters like in LaTeX because it just comes in as a single string. So you need to be careful parsing it out manually and depending on what you’re doing, it might not work, but this is enough for simple cases.