Skip to content

Commit

Permalink
Use Middleman content_tag into our custom markdown renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyadsl committed Feb 11, 2019
1 parent 368a4fe commit 97b676f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion guides/lib/custom_markdown_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class CustomMarkdownRenderer < Redcarpet::Render::HTML
include ImageHelpers
include ::Padrino::Helpers::OutputHelpers
include ::Padrino::Helpers::TagHelpers

def block_code(code, language)
path = code.lines.first[/^#\s(\S*)$/, 1]
Expand All @@ -19,7 +21,9 @@ def table(header, body)
end

def header(text, header_level)
"<h%s id=\"%s\" class=\"offset\">%s</h%s>" % [header_level, text.parameterize, text, header_level]
content_tag "h#{header_level}", id: text.parameterize, class: 'offset' do
text
end
end

def link(link, title, content)
Expand Down

0 comments on commit 97b676f

Please sign in to comment.