about summary refs log tree commit diff stats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 72d7ab1..a51f1a1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb
@@ -1,6 +1,7 @@
1require 'redcarpet' 1require 'redcarpet'
2require 'rouge' 2require 'rouge'
3require 'rouge/plugins/redcarpet' 3require 'rouge/plugins/redcarpet'
4require 'redcarpet/render_strip'
4 5
5module ApplicationHelper 6module ApplicationHelper
6 7
@@ -22,7 +23,7 @@ module ApplicationHelper
22 def markdown(text, params = {}) 23 def markdown(text, params = {})
23 options = { fenced_code_blocks: true, highlight: true, footnotes: true } 24 options = { fenced_code_blocks: true, highlight: true, footnotes: true }
24 25
25 html_options = {} 26 html_options = { with_toc_data: true }
26 if params[:restricted] 27 if params[:restricted]
27 html_options[:filter_html] = true 28 html_options[:filter_html] = true
28 end 29 end
@@ -39,4 +40,20 @@ module ApplicationHelper
39 ] 40 ]
40 end 41 end
41 42
43 def friends_sidebar
44 [
45 { title: "Entropically", url: "https://entropically.neocities.org/" },
46 ]
47 end
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
42end 59end