@@ -85,6 +85,7 @@ gem 'feed-normalizer' |
||
| 85 | 85 |
gem 'slack-notifier', '~> 0.5.0' |
| 86 | 86 |
gem 'therubyracer', '~> 0.12.1' |
| 87 | 87 |
gem 'mqtt' |
| 88 |
+gem 'redcarpet', '~> 3.1.1' |
|
| 88 | 89 |
|
| 89 | 90 |
group :development do |
| 90 | 91 |
gem 'binding_of_caller' |
@@ -123,4 +124,3 @@ else |
||
| 123 | 124 |
gem 'unicorn', platform: :ruby_18 |
| 124 | 125 |
gem 'rails_12factor', platform: :ruby_18 |
| 125 | 126 |
end |
| 126 |
- |
@@ -233,6 +233,7 @@ GEM |
||
| 233 | 233 |
thor (>= 0.18.1, < 2.0) |
| 234 | 234 |
raindrops (0.13.0) |
| 235 | 235 |
rake (10.3.2) |
| 236 |
+ redcarpet (3.1.2) |
|
| 236 | 237 |
ref (1.0.5) |
| 237 | 238 |
rest-client (1.6.7) |
| 238 | 239 |
mime-types (>= 1.16) |
@@ -404,6 +405,7 @@ DEPENDENCIES |
||
| 404 | 405 |
rack |
| 405 | 406 |
rails (= 4.1.4) |
| 406 | 407 |
rails_12factor |
| 408 |
+ redcarpet (~> 3.1.1) |
|
| 407 | 409 |
rr |
| 408 | 410 |
rspec (~> 2.99) |
| 409 | 411 |
rspec-collection_matchers |
@@ -0,0 +1,8 @@ |
||
| 1 |
+module MarkdownHelper |
|
| 2 |
+ |
|
| 3 |
+ def markdown(text) |
|
| 4 |
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) |
|
| 5 |
+ markdown.render(text).html_safe |
|
| 6 |
+ end |
|
| 7 |
+ |
|
| 8 |
+end |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 |
</div> |
| 7 | 7 |
|
| 8 | 8 |
<% if @scenario.description.present? %> |
| 9 |
- <blockquote><%= @scenario.description %></blockquote> |
|
| 9 |
+ <blockquote><%= markdown(@scenario.description) %></blockquote> |
|
| 10 | 10 |
<% end %> |
| 11 | 11 |
|
| 12 | 12 |
<%= render 'agents/table', :returnTo => scenario_path(@scenario) %> |
@@ -0,0 +1,14 @@ |
||
| 1 |
+require 'spec_helper' |
|
| 2 |
+ |
|
| 3 |
+describe MarkdownHelper do |
|
| 4 |
+ |
|
| 5 |
+ describe '#markdown' do |
|
| 6 |
+ |
|
| 7 |
+ it 'renders HTML from a markdown text' do |
|
| 8 |
+ markdown('# Header').should =~ /<h1>Header<\/h1>/
|
|
| 9 |
+ markdown('## Header 2').should =~ /<h2>Header 2<\/h2>/
|
|
| 10 |
+ end |
|
| 11 |
+ |
|
| 12 |
+ end |
|
| 13 |
+ |
|
| 14 |
+end |