]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
not only markdown adds gunk, so remove it in the main htmlize function
[ikiwiki.git] / IkiWiki.pm
index d001760a205864aad7ce78c6d799d06444ffbc2a..230170d859e4ec948314b1e1099abe92186f5610 100644 (file)
@@ -624,12 +624,22 @@ sub htmlize ($$$) { #{{{
                error("htmlization of $type not supported");
        }
 
+       my $oneline = $content !~ /\n/;
+
        run_hooks(sanitize => sub {
                $content=shift->(
                        page => $page,
                        content => $content,
                );
        });
+       
+       if ($oneline) {
+               # hack to get rid of enclosing junk added by markdown
+               # and other htmlizers
+               $content=~s/^<p>//i;
+               $content=~s/<\/p>$//i;
+               chomp $content;
+       }
 
        return $content;
 } #}}}