Extend pruneHtml to accept a filter function