diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f12cdd4..861dd11 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb | |||
@@ -1,5 +1,13 @@ | |||
1 | require 'redcarpet' | ||
2 | require 'rouge' | ||
3 | require 'rouge/plugins/redcarpet' | ||
4 | |||
1 | module ApplicationHelper | 5 | module ApplicationHelper |
2 | 6 | ||
7 | class HTML < Redcarpet::Render::HTML | ||
8 | include Rouge::Plugins::Redcarpet # yep, that's it. | ||
9 | end | ||
10 | |||
3 | def title(text) | 11 | def title(text) |
4 | content_for :title, text | 12 | content_for :title, text |
5 | end | 13 | end |
@@ -12,8 +20,8 @@ module ApplicationHelper | |||
12 | end | 20 | end |
13 | 21 | ||
14 | def markdown(text) | 22 | def markdown(text) |
15 | options = %i[] | 23 | options = { fenced_code_blocks: true, highlight: true } |
16 | Markdown.new(text, *options).to_html.html_safe | 24 | Redcarpet::Markdown.new(HTML.new(), options).render(text).html_safe |
17 | end | 25 | end |
18 | 26 | ||
19 | end | 27 | end |