A number of the sites that I manage for fun are simply static web pages. The dynamic nature is handled by javascript classes and plugins. This means that I really don’t need or want an application server to serve these sites, but I do want to still use some of the practices that I apply to web application development. Enter webby - it works by combining the contents of a page with a layout to produce HTML. Awesomely simple and powerful. It can use the rdiscount gem to process files in markdown format into html pages, but I prefer to use the kramdown library. No problem, here is how you can add kramdown support to your webby project.
if try_require('kramdown', 'kramdown')
Webby::Filters.register :kramdown do |input|
Kramdown::Document.new(input, :parse_block_html => true).to_html
end
else
Webby::Filters.register :kramdown do |input|
raise Webby::Error, "'kramdown' must be installed to use the kramdown filter"
end
end
Simply paste the above into a file called kramdown.rb
in your project’s lib directory and then you can specify filter: kramdown
in your webby templates.