1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-10-17 17:01:01 +00:00

Use formatting options in marldown filter

This commit is contained in:
Holger Just 2015-12-07 20:56:17 +01:00
parent 41ddcdaa45
commit 6fd9b10497

View File

@ -12,10 +12,11 @@ helpers do
str.unpack("U*").map { |c| "&##{c};"}.join str.unpack("U*").map { |c| "&##{c};"}.join
end end
def markdown(source=nil, single_line = false, &block) def markdown(source=nil, single_line = nil, &block)
source = capture(&block) if block_given? source = capture(&block) if block_given?
html = Tilt['markdown'].new{ source }.render html = Tilt['markdown'].new(markdown_options){ source }.render
single_line = !source.include?("\n") if single_line.nil?
if single_line if single_line
doc = Nokogiri::HTML::DocumentFragment.parse(html) doc = Nokogiri::HTML::DocumentFragment.parse(html)
doc.search('p').each do |node| doc.search('p').each do |node|
@ -26,6 +27,7 @@ helpers do
html.strip html.strip
end end
alias_method :md, :markdown
end end
### ###