nesta icon indicating copy to clipboard operation
nesta copied to clipboard

Configure how Tilt renders pages

Open gma opened this issue 11 years ago • 2 comments

At the moment the Markdown, Textile and Haml pages are rendered by Tilt, with the default options for each renderer. If you want to configure the renderer you need to pass it a hash of options, so we'd need a way to configure it on a per-site basis.

If we define a method that can be overriden in app.rb, that would cover it. This is untested, but it's what I've got in mind…

def convert_to_html(format, scope, text)
  text = add_p_tags_to_haml(text) if @format == :haml
  template = Tilt[format].new(renderer_config(@format)) { text }
  template.render(scope)
end

def renderer_config(format)
  {}
end

gma avatar Apr 11 '14 08:04 gma

I've started working on this, as I need it for configuring RedCarpet.

gma avatar May 04 '14 10:05 gma

:+1:

komidore64 avatar Mar 09 '15 04:03 komidore64