module Jekyll class DetailsBlock < Liquid::Block def initialize(tag_name, title, tokens) super @title = title @details_idx = 1 end def render(context) contents = super(context) if @title.nil? || @title.empty? then title = "More info" else title = @title end title = title.to_s.delete("\"") idx = context["details_idx"] if idx.nil? then idx = 0 end context["details_idx"] = idx + 1 <<~MARKUP
MARKUP end end end Liquid::Template.register_tag('details', Jekyll::DetailsBlock)