stonean/slim — Issue #192: how to pass options to sub-template processor?
Author: sunaku
Created: 2011-10-11 06:04:17+00:00
State: open

Hello,

I use `markdown:` sub-templates inside my Slim templates. I was able to make Slim use Redcarpet for markdown processing via the Tilt API, as shown below. However, I don't know how to set default rendering options for Redcarpet, which is hidden somewhere in the Slim => Tilt pipeline. In particular, I want to enable GitHub-style code blocks and also use Albino/Pygments for syntax highlighting of code blocks.

I tried RTFM and browsing the Tilt & Temple source code, but no luck. So I ask you now for suggestions.

```ruby
### ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
require 'slim'
Tilt.prefer Tilt::RedcarpetTemplate
# TODO: how to set rendering options on Redcarpet?
Slim::Template.new("bogus_file.md"){ "markdown:\n ```ruby\n puts \#{who}\n ```\n" }.render(Object.new, :who => 123)
```
The above code yields:

"

ruby\nputs 123\n

\n"

But after I set my rendering options, I want to get something like this:

"

puts 123

\n"

Thanks for your consideration.