Module: Lookbook::ApplicationHelper
- Defined in:
- app/helpers/lookbook/application_helper.rb
Instance Method Summary collapse
- #config ⇒ Object
- #highlight(source, language) ⇒ Object
- #markdown(text) ⇒ Object
- #nav_padding_style(depth) ⇒ Object
Instance Method Details
#config ⇒ Object
6 7 8 |
# File 'app/helpers/lookbook/application_helper.rb', line 6 def config Lookbook::Engine.config.lookbook end |
#highlight(source, language) ⇒ Object
14 15 16 17 18 |
# File 'app/helpers/lookbook/application_helper.rb', line 14 def highlight(source, language) formatter = Rouge::Formatters::HTML.new(css_class: "highlight") lexer = Rouge::Lexer.find(language) formatter.format(lexer.lex(source)).html_safe end |
#markdown(text) ⇒ Object
10 11 12 |
# File 'app/helpers/lookbook/application_helper.rb', line 10 def markdown(text) Markdown.new(text).to_html.html_safe end |
#nav_padding_style(depth) ⇒ Object
20 21 22 |
# File 'app/helpers/lookbook/application_helper.rb', line 20 def nav_padding_style(depth) "padding-left: calc((#{depth - 1} * 12px) + 0.5rem);" end |