ri > Loofah

🔍 Loofah

🚀 Quick Reference

Use CaseCommandDescription
Sanitize full HTML documentLoofah.document(html)Parse and scrub an entire HTML document
Sanitize HTML fragmentLoofah.fragment(html)Parse and scrub an HTML fragment
Scrub document with custom scrubberLoofah.scrub_document(html, scrubber)Apply a custom scrubber to an HTML document
Scrub fragment with custom scrubberLoofah.scrub_fragment(html, scrubber)Apply a custom scrubber to an HTML fragment
Remove extra whitespaceLoofah.remove_extraneous_whitespace(doc)Strip unnecessary whitespace from a document

📄 Strings and IO Objects as Input

Loofah.document and Loofah.fragment accept any IO object 💾 in addition to accepting a string. That IO object could be a file, or a socket, or a StringIO, or anything that responds to read and close. Which makes it particularly easy to sanitize mass quantities of docs.

📋 Constants:

⚙️ Class methods:

Loofah
🔍 Loofah 🚀 Quick Reference
📄 Strings and IO Objects as Input
📋 Constants: ⚙️ Class methods:

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-28 01:04 @216.73.217.25
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format