trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 199 forks source link

Syntax highlighting in Code Blocks without example #222

Open philipisik opened 9 years ago

philipisik commented 9 years ago

Hi,

is it possible to get html syntax highlighting in a code block without example? Like:

/*doc


title: Title name: name category: category


`<div class="html-example"></div>`

*/

lifeiscontent commented 9 years ago

@philipisik yes you just need to write a custom renderer or only allow your template to output the code example without the preview.

here's a sass code_example_renderer that I've written.

Hologram::CodeExampleRenderer::Factory.define 'sass' do
  example_template 'sass_example_template'
  table_template 'sass_table_template'
  lexer { Rouge::Lexer.find('sass') }
end

and then in the templates dir I just provide the sass_example_template and the sass_table_template