How-to guides¶
Task-focused recipes, one job each. The pages follow the eight turbohtml namespaces, in the order the Reference and Migrating to turbohtml use: parse a document and edit its tree, detect an encoding, query and match nodes, clean and minify markup, convert a selector, extract the article and its tables, build a tree, and serialize it back to HTML, Markdown, or plain text. Each page is a short, self-contained walkthrough you can lift straight into your own code, ending with running the toolkit from a shell.
- Parse HTML into a tree
- Tokenize HTML
- Work with forms
- Edit the tree
- Handle character encodings
- Select elements with a CSS selector
- Find elements with the find filter
- Extract strings and attributes
- Query a tree with XPath
- Inspect a node you already hold
- Trim a document to a selector
- Chain queries like pyquery
- Match elements the soupsieve way
- Sanitize untrusted HTML
- Find and rewrite links
- Minify HTML and JavaScript
- Translate a CSS selector to XPath
- Read tables into rows and records
- Extract the main article
- Extract structured data
- Build HTML with E
- Serialize a tree to HTML
- Export a tree to Markdown
- Export a tree to plain text
- Escape and unescape text
- Run turbohtml from a shell