about summary refs log tree commit diff stats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb12
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 @@
1require 'redcarpet'
2require 'rouge'
3require 'rouge/plugins/redcarpet'
4
1module ApplicationHelper 5module 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
19end 27end