diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/application_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 97a897f..a51f1a1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | require 'redcarpet' | 1 | require 'redcarpet' |
| 2 | require 'rouge' | 2 | require 'rouge' |
| 3 | require 'rouge/plugins/redcarpet' | 3 | require 'rouge/plugins/redcarpet' |
| 4 | require 'redcarpet/render_strip' | ||
| 4 | 5 | ||
| 5 | module ApplicationHelper | 6 | module ApplicationHelper |
| 6 | 7 | ||
| @@ -45,4 +46,14 @@ module ApplicationHelper | |||
| 45 | ] | 46 | ] |
| 46 | end | 47 | end |
| 47 | 48 | ||
| 49 | class StrippedSummary < Redcarpet::Render::StripDown | ||
| 50 | def block_html(raw_html) | ||
| 51 | nil | ||
| 52 | end | ||
| 53 | end | ||
| 54 | |||
| 55 | def stripped_markdown(text) | ||
| 56 | Redcarpet::Markdown.new(StrippedSummary).render(text) | ||
| 57 | end | ||
| 58 | |||
| 48 | end | 59 | end |
