trulia/hologram — pull request #187 by gpleiss (2014-12-23 00:47:41+00:00)
Title: Custom code example

This PR address #170

Adds a new config option: `code_example_templates`. If a user wants to change the way code examples are rendered in the styleguide, they can add custom templates to this folder. Hologram will look for the following 4 templates:

* `markup_example_template.html.erb` - used for html, haml and slim examples
* `markup_table_template.html.erb` - used for multiple html, haml and slim examples layed out in a table
* `js_example_template.html.erb` - used for js examples
* `jsx_example_template.html.erb` - used for jsx examples

As an example, the `markup_example_template` looks like this:

```erb

<%= rendered_example %>

<%= code_example %>

```

Hologram will fall back on default templates if a user doesn't specify a folder for code_example_templates in their config file (or if certain template files are not found). So this isn't a breaking change :dancer:

This PR restructures the `BlockCodeRenderer` (again... :cold_sweat: ), but I think that the code is now much more modular. I think this new code will make it easier to get Hologram to the point where users can add their own languages in a simpler way.

Best!
Geoff (cc/ @stubbornella @bebepeng @pivotal-plech)