remove the <p> for lone images
This commit is contained in:
parent
a87b00f835
commit
9bfa296091
2 changed files with 9 additions and 0 deletions
1
Rules
1
Rules
|
@ -59,6 +59,7 @@ compile '/html/*' do
|
|||
filter :erb # I'll try not to use ruby anymore inside content
|
||||
filter :kramdown
|
||||
# filter :math_repair # after kramdown
|
||||
filter :fix_img
|
||||
else
|
||||
raise "Filter is not configured for #{item.identifier} in Rules file."
|
||||
end
|
||||
|
|
8
lib/fix_img.rb
Normal file
8
lib/fix_img.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class FixImage < Nanoc3::Filter
|
||||
identifier :fix_img
|
||||
def run(content, params={})
|
||||
content.gsub(%r{<p>(<img[^>]*>)</p>}) do |m|
|
||||
$1.to_s
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue