Prescribe is a small, forgiving JavaScript HTML parser that originated from John Resig's parsing code and was hardened through use in Krux's postscribe library. It is currently at version 1.1.3, released in 2017. The project appears to be abandoned, with no active development or maintenance since then, indicating a stalled release cadence. Its key differentiator is its tolerance for real-world, often malformed HTML, particularly in contexts like ad serving, rather than aiming for strict W3C compliance. This makes it suitable for environments where robust error handling of imperfect HTML is preferred over strict validation. It boasts broad browser compatibility, including support for older browsers like Internet Explorer 8+.
npm install prescribeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse an HTML string using Prescribe's SAX-like API, logging the sequence of parsed elements, text, and comments.
Ensure your code explicitly handles `null` returns when parsing content within unclosed `<script>` or `<style>` tags.
Consider using alternative, actively maintained HTML parsing libraries for new projects or if strict security and modern standard compliance are critical.
If strict HTML compliance is necessary, evaluate if Prescribe's forgiving nature meets your requirements, or consider a different parser built for strict validation.
Thoroughly test its behavior in your specific target environments, especially modern Node.js or evergreen browsers, and be prepared for potential polyfill requirements or compatibility layers.
For CommonJS, use `const HtmlParser = require('prescribe');`. For ESM, use `import HtmlParser from 'prescribe';`.Ensure you are calling `new HtmlParser(htmlString, options)` to create an instance before calling `.parse()` on it.
Review the input HTML and Prescribe's SAX-like output carefully. If the issue is due to intentional 'forgiveness', adjust your expectations or consider a different parser for strict validation.
No dependency data recorded yet.