Topic: Redcarpet and coderay- regular expression help
I am trying to use redcarpet and code ray together. I was followed Railscasts #272 Markdown with Redcarpet. However, I do not want to use Pygments for syntax highlighting due to issues with heroku. A gem solution would be much better, so I followed Railscasts #207 Syntax Highlighting to implement coderay.
Here is the helper method provided for coderay:
module ApplicationHelper
def coderay(text)
text.gsub(/\<code( lang="(.+?)")?\>(.+?)\<\/code\>/m) do
CodeRay.scan($3, $2).div(:css => :class)
end
end
endI am trying to make code blocks use the github style syntax of ``` ruby or ```ruby.
I've been using rubular to try to create a regular expression to match ^^^^. Here is what I have so far, but it does not work. Please help me out! Thank you!
# regex to match
/`{3}\s?(.*)\n(.*)`{3}/
# test strings
``` ruby
def rubyroo
```
```ruby
def rubyroo
```Last edited by tuscanidream (2012-01-28 13:24:23)