# parse5 **Repository Path**: mirrors_elgs/parse5 ## Basic Information - **Project Name**: parse5 - **Description**: Ported from inikulin/parse5 but for Deno. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-02 - **Last Updated**: 2026-03-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # parse5 Ported from inikulin/parse5 v6.0.1 but for Deno. This project is a port from: - parse5 - parse5-htmlparser2-tree-adapter modules from inikulin/parse5 at v6.0.1. Other modules involved with Node's stream api are not ported. ### Why? - It runs natively in Browser. - It works with Deno. - It's pure Javascript, no Node API. ### Sample code #### parse ```js import * as parse5 from "https://deno.land/x/parse5/parse5/lib/index.js"; const document = parse5.parse( "Hi there!" ); console.log(document.childNodes[1].tagName); //> 'html' ``` #### parseFragment ```js import * as parse5 from "https://deno.land/x/parse5/parse5/lib/index.js"; const documentFragment = parse5.parseFragment("
"); console.log(documentFragment.childNodes[0].tagName); //> 'table' // Parses the html fragment in the context of the parsed element. const trFragment = parse5.parseFragment( documentFragment.childNodes[0], "" ); console.log(trFragment.childNodes[0].childNodes[0].tagName); //> 'td' ``` #### serialize ```js import * as parse5 from "https://deno.land/x/parse5/parse5/lib/index.js"; const document = parse5.parse( "Hi there!" ); // Serializes a document. const html = parse5.serialize(document); // Serializes the element content. const str = parse5.serialize(document.childNodes[1]); console.log(str); //> 'Hi there!' ``` #### htmlparser2Adapter ```js import * as parse5 from 'https://deno.land/x/parse5/parse5/lib/index.js'; import * as htmlparser2Adapter from 'https://deno.land/x/parse5/parse5-htmlparser2-tree-adapter/lib/index.js'; const document = parse5.parse('
', { treeAdapter: htmlparser2Adapter }); console.log(document); ```
Shake it, baby