Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created May 29, 2013 20:50
Show Gist options
  • Select an option

  • Save Heavyblade/5673742 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/5673742 to your computer and use it in GitHub Desktop.
require 'redcarpet'
class CustomRender < Redcarpet::Render::HTML
def list_item(text, list_type)
case text
when /\[\s?x\s?\]/
"<li><input type='checkbox' value='true' checked>#{text.gsub(/\[\s?x\s?\]/, "").strip}</li>\n"
when /\[\s?\]/
"<li><input type='checkbox' value='false'>#{text.gsub(/\[\s?\]/, "").strip}</li>\n"
else
"<li>#{text}</li>\n"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment