ruby on rails - Syntax highlighting in HAML's markdown filter -


i'm using haml's markdown filter, this:

:markdown   markdown text, yay! 

but want syntax highlighting code inside text, like:

:markdown   markdown text, yay!   <code lang="ruby">     def hello(world)       puts "hello #{world}"     end   </code> 

any ideas how it? know how use coderay, don't see how grab ahold of text.

markdown support code blocks out of box, not support syntax highlighting.

see http://haml-lang.com/docs/yardoc/file.haml_reference.html#markdown-filter markdown libraries haml looks parse markdown.

if want pass code filter makes highlighted can write own filter extension haml. quite easy.

http://haml-lang.com/docs/yardoc/haml/filters/base.html

if though, put code in block , use javascript library geshi highlight code. http://qbnz.com/highlighter/index.php

so can like:

  %pre.ruby      puts "this syntax highlighted" 

and if have geshi included, highlighted.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -