Changelog
Every change people using Parsec would notice, newest first. This is its CHANGELOG.md, read from the main branch when the page was built.
Every change people using Parsec would notice, newest first. Version numbers follow Semantic Versioning; until 1.0, a minor release can break the API and a patch release won’t.
0.3.1 - 2026-11-28
Faster, and lighter if you want it to be. Nothing in the API moved, so 0.3.1 drops in where 0.3.0 was. If all you need is CSS syntax or an encoding sniffer, turn off the default features and the HTML tree is no longer compiled in with it. If you read the state pages keep in their scripts, that read now keeps up with the parse: on nytimes’ 852 KB of it, three times what it was.
Added
parsec-web-cssandparsec-web-encodingbuild without the HTML tree. Withdefault-features = false,parsec-web-cssis CSS syntax, values and media queries alone, andparsec-web-encodingissniff,prescan,Offsetsandlocale_defaultalone. The cascade is thecascadefeature andparse_byteswithByteParsertheparsefeature, both on by default, so nothing changes unless you turn them off. Withoutcascade,selector()in@supportsis false, since there’s no selector parser to check it with (#246).
Changed
parsec-jsparses about 5% faster: templates andforloop heads no longer allocate vectors of their own. Over the bench’s 11.6 MB it’s 1.06 timesoxc_parser’s speed; the smallest inline scripts are still behind (#249, part of #190).- Reading page state is about 3 times as fast. On the nytimes page’s
852 KB
window.__preloadedData,page_state_inwent from 155–161 MB/s to 498–513, as fast as the parse it reads (463–499). A string decodes straight to UTF-8 instead of through UTF-16, the text between escapes is copied whole, and a small object finds a repeated key by scanning rather than hashing every key. What it returns is unchanged (#252).
0.3.0 - 2026-11-25
The first release with JavaScript and XML, and the first under the
project’s name, parsec-web. parsec-js parses ECMAScript 2025 to a
tree and to ESTree JSON, works out scopes and module records, reports
every error with a code and a code frame, reparses only what an edit
touched, and reads the state a page keeps in its scripts without
running them, at 1.05 times oxc_parser’s speed. parsec-xml parses
XML 1.0 with namespaces, and XPath runs over it. Both are in the C
API, Python, WebAssembly and a new native Node.js build, and so is a
limit on selector matching.
Upgrade if you run XPath over pages you don’t control: a name test like
@id on an element with 20,000 attributes took 3.9 seconds in 0.2.0,
and takes 4 ms now (see Fixed).
What breaks, in short (all of it under Changed (breaking)):
- The packages are
parsec-web,parsec-web-core,parsec-web-cssandparsec-web-encoding. It’s one line inCargo.toml, andpip install parsec-webornpm install parsec-web; what you import doesn’t change. - The Python wheels need Python 3.10 or newer.
parsec_xpath::Itemhas a third variant, andparsec-xpathreads trees through aTreetrait.
Added
- A native build for Node.js, which the npm package
parsec-webnow loads in Node wherever there’s one for the platform: Linux on x86-64 and ARM64, with glibc or musl, macOS on both, and Windows on both (#177). It has the WebAssembly’s API, names, options and error messages, and parses the 13 benchmark pages 1.5 times as fast. Each platform’s build is an optional dependency,@parsec-web/binding-<platform>; anywhere else, and in browsers, the package is the WebAssembly it was.parseAsync(html, options)parses on Node’s thread pool and gives a promise of the document. With the WebAssembly build it parses before it returns.backendsays which build loaded, andPARSEC_BACKEND=wasmornativechooses one.- A panic in the native build is an
Error(a rejected promise fromparseAsync), as it is in the WebAssembly and Python builds, never the end of the process.
parsec-xml, an XML parser of Parsec’s own: XML 1.0 (Fifth Edition) and Namespaces in XML 1.0, not validating (#169).parse,parse_withandparse_bytesgive aDocument: an arena of nodes in document order, each element’s and attribute’sNameresolved to its namespace, aSpanon every node and attribute, attributes in their order, andxml_langandpreserves_spaceread up the tree.- The internal subset’s general and parameter entities are expanded
and its attribute defaults applied. The external subset and external
entities are never fetched or opened; the document’s
warningssay what wasn’t read, and a reference to such an entity stays in the tree asNodeKind::EntityRef. - Entity expansion stops with an error past
max_entity_depth(16) or past 1 MiB plus 8 bytes per byte of input, so billion laughs and quadratic blowup cost what you allow. Each attribute default the internal subset applies counts against the same budget, so a big default on many elements stops there too (#230). Elements nest at most 2,048 deep by default, and with no limit a million levels parse without recursion. - A document that isn’t well-formed is an
Errorwith a stable code, its span, and the line and column. to_xmlandwrite_xmlwrite a document or a subtree back out, prefixes and namespace declarations as they were.- The W3C XML Conformance Test Suite runs in
cargo test(#170): 1,915 cases pass and none fail, and every skipped case says why. - XPath 1.0 over the document with the
xpathfeature, off by default:parsec_xml::xpathisparsec-xpathwithout its HTML tree, andDocumentimplements itsTree(#171). Names compare exactly,xmlnsandxmlns:*aren’t attributes,id()findsxml:idand attributes the internal subset declaresID, andlang()readsxml:lang.NodeId::from_indexturns a result’s node back into aNodeId. The namespace axis has the namespaces in scope at each element. libxml2’s XPath document tests run incargo test: all 84 pass. bench/times it against libxml2 v2.15.4, roxmltree and quick-xml on real XML: 1,314 MB/s to libxml2’s 495 over 102 MB (#172).
- The XML parser is in every binding: a document from text or bytes in
the encoding it declares, walked node by node with each name’s prefix,
local part and namespace, attributes with theirs, text, spans, and
serialization back to XML. A document that isn’t well-formed, or that
runs past
max_depthor the entity limits, is an error with its code, line and column, so a billion laughs fails at once (#174, #175, #176).- C:
parsec_xml_parsegives aparsec_xml_document, read withparsec_xml_*functions that mirror the HTML ones (parent, children and siblings, names,parsec_xml_attr_at,parsec_xml_attr_get_ns,parsec_xml_text,parsec_xml_serialize, spans, line and column, and warnings), freed byparsec_xml_document_free. An error isPARSEC_ERR_XMLwith aparsec_xml_error. - Python:
parsec_html.xml.parse()takesstrorbytesand gives anXMLDocumentofXMLNodes with the HTML parser’s names (tag,parent,next,attributes,text(),source_range) pluslocal_name,prefix,namespaceandattribute_list. An error raisesXMLSyntaxError, aValueError. - WebAssembly and the native Node build:
parseXmlandparseXmlBytesgive anXmlDocumentofXmlNodes with the DOM’s names (namespaceURI,getAttributeNS,childNodes), and throw aSyntaxErrorwithcode,lineandcolumn. It adds 113 KB to the.wasm(44 KB gzipped);--no-default-featuresbuilds the HTML parser alone, and CI fails if that build grows past its ceiling. parsec-xmlgainsDocument::node, a node by its number, checked;parsec-basegainsLineIndex::owned, an index that keeps its text.
- C:
- The start of a JavaScript parser of Parsec’s own, in two new crates
(#143,
#147).
parsec-baseis the plumbing every parser here will share:Span,LineIndex(line, column and UTF-16 offsets),DiagnosticandSeverity,LimitsandBudget. It has no dependencies.parsec-jslexes ECMAScript 2025: identifiers with Unicode 17.0’sID_StartandID_Continueand escapes, every numeric literal form, strings, template parts, regular expression literals, punctuators, comments, a hashbang, and Annex B’s HTML-like comments in scripts. You pass the goal (Goal::Div,Goal::RegExpand the template ones), so/and}are never guessed. A legacy octal literal or escape is flagged on its token, and reported as an error in a module.- test262 runs in
cargo test, and CI’s summary has its counts (#148). bench/times the lexer against oxc’s and swc’s withparsec-web-bench js-lex: 347 MB/s to oxc’s 568 and swc’s 328 over the 11.6 MB JavaScript corpus, with all three reading the same tokens (#149).parsec-jsparses ECMAScript 2025 scripts and modules:parsegives anAstwith a span on every node and the comments beside it, or the first syntax error as aDiagnostic, andAst::to_estreewrites ESTree JSON in acorn’s shape. Modules have everyimportandexportform, import attributes and top-levelawait. All 48,408 test262 files that should parse do, and 3,824 of the 4,374 that shouldn’t fail; the rest need scope analysis (#152, #153, #154).- The parser’s recursion stops at
Limits::max_depth, 256 levels by default, with atoo-deeperror, and its tokens atLimits::max_steps: a million-deep((((is an error, not a stack overflow (#155). parsec_js::datareads the state pages keep in scripts, as JSON, without running them.literalturns an expression of literals into aJsonvalue or refuses with a span and a reason;page_statefindswindow.X = …, top-levelvar,JSON.parse("…"), Nuxt 2’swindow.__NUXT__=(function(…){…}(…))and Next.js’sself.__next_fpushes;jsonparses JSON as strictly asJSON.parse(#162, #163).parsec_js::scopeworks out what each name refers to.Scopes::analyzebuilds a program’s scopes and bindings, withvarand functions hoisted and Annex B’s functions in sloppy blocks, resolves every reference or lists it as free, flags references in the TDZ, and marks the scopes a directevalor awithmakes dynamic. A name declared twice where the spec forbids it is a diagnostic,duplicate-declarationorlexical-var-conflict(#158).parsec_js::regexp::validatechecks a regular expression’s pattern and flags by the pattern grammar and its early errors, in each mode (no flag with Annex B’s additions,u,v), and gives the error aRegExpwould throw, with a code likeregexp-range-orderorregexp-property.parsec_js::early_errorsgives the early errors the parser leaves for a later pass: names declared twice, an export of a name the module never declares (export-undeclared), and regular expression patterns. With it, all 4,374 of test262’s parse negatives fail (#159).parsec_js::module::ModuleRecordhas a module’s imports and exports as the spec records them: requested modules with their import attributes, ImportEntry records, and ExportEntry records in local, indirect and star lists (#160).- Every
parsec-jsdiagnostic code is listed inparsec_js::diagnosticswith what it means and the spec section it comes from, and a code won’t be renamed. Errors that involve a second place point at it with a label: the first of two declarations, labels or constructors, and the(,[or{still open.Diagnostic::renderinparsec-baseprints a diagnostic as a code frame, with tabs expanded, wide characters measured, and a minified line cut to a window around the error.parse_recoveringskips a statement that fails and goes on, so one parse reports every error, not only the first (#166). Ast::reparsebrings a tree up to date after anEditby parsing only the smallest function body or statement around it, and the tree is the oneparsegives for the new source. Where a piece can’t be sure of that (an edit that opens a comment or string past it, a directive prologue, a parameter list,importorexport), the source is parsed whole. A test checks it againstparseon random edits, and areparsefuzz target joins the nightly run (#167).bench/times the parser against oxc’s and swc’s withparsec-web-bench js: 375 MB/s over the 11.6 MB corpus of bundles and inline scripts, 1.05 timesoxc_parserand 2.5 timesswc_ecma_parser, holding 44 MB on typescript.js to oxc’s 67 (#156, #215, #236, #239).
- Every binding can now put a limit on selector matching. Most
selectors cost one walk of the tree, but
div:has(span div)over a few thousand nested divs costs millions of steps, and a crawler running selectors or pages it doesn’t control needs a way to stop that. A limit that runs out is an error, never half the matches (#135).- C:
parsec_select_withandparsec_matches_withtakemax_stepsandbudget_us(0 for none) and givePARSEC_ERR_TIMEOUTpast either.parsec_selectis unchanged. - Python:
css(),css_first(),css_matches()andany_css_matches()take keyword-onlymax_steps=andbudget=(seconds), and raiseTimeoutError, as a parsebudget=does. - WebAssembly:
select,selectFirstandmatchestake{ maxSteps }, and throw an Error namingmaxSteps. There’s no time limit there, since wasm32 has no clock.
- C:
- The JavaScript parser is in every binding: a script or a module to
ESTree in acorn’s shape, and the state a page keeps in its scripts,
read without running anything. A syntax error carries its code, line,
column, offsets and a code frame; nesting past
max_depth(at most and by default 256) is an error, never a stack overflow (#174, #175, #176).- C:
parsec_js_parsegives ESTree JSON with byte offsets,parsec_js_page_statea script’s state as JSON, andparsec_js_document_statethe state of every script in a parsed page. A syntax error isPARSEC_ERR_JSwith aparsec_js_error, andmax_stepspast its limitPARSEC_ERR_TIMEOUT. - Python:
parsec_html.js.parse()gives dicts and lists, withstartandendasstrindexes, and raisesJSSyntaxError(aValueError) or, pastmax_steps=,TimeoutError;parsec_html.js.page_state()andHTMLParser.page_state()give the state as lists of dicts. - WebAssembly and the native Node build:
parseJs,pageStateandDocument.pageStategive plain objects, and a syntax error is aSyntaxErrorwithcode,line,column,start,endandframe. They add 193 KB to the.wasm(79 KB gzipped);--no-default-featuresbuilds the HTML parser alone, and CI fails if that build grows past its ceiling. parsec-jsgains what the bindings needed:EstreeOptions::offsetscountsstartandendin UTF-16 units, characters or bytes;data::script_typesays how a browser runs a<script>by itstype; andFound::write_jsonwrites a piece of page state as JSON.LineIndex::char_offsetis new inparsec-base.
- C:
Changed (breaking)
- Parsec publishes as
parsec-webon crates.io, PyPI and npm, the project’s name now that it parses CSS, JavaScript and XML as well as HTML (#213).parsec-html-core,parsec-html-cssandparsec-html-encodingareparsec-web-core,parsec-web-cssandparsec-web-encoding; the other crates keep their names. What you import doesn’t change: in Rust it’s stillparsec,parsec_cssandparsec_encoding, and in Python stillparsec_html. In JavaScript, importparsec-web.parsec-htmlstays at 0.2, pointing here. - The Python wheels need Python 3.10 or newer: 3.9 reached end of life in October 2025, and its CI jobs kept a pytest with a known vulnerability (#220).
parsec_xpath::Itemhas a third variant,Item::Ns { owner, decl }, for a namespace node, so amatchon it needs an arm for it.Doc::namespace_at(decl)gives its prefix and URI.
Changed
parsec-xpathreads trees through aTreetrait, so XPath can run over a tree other than Parsec’s HTML document, such asparsec-xml’s (#171). The HTML document’s impl is behind a defaulthtmlfeature; withdefault-features = falsethe crate builds without the HTML parser.Index::buildis generic over the tree, so a call through a smart pointer (aRefor a lock guard) needs&*docwhere&doccoerced before.Doc::xmlandNamespaces::id_ofare gone: an XML document in the HTML tree goes throughXmlTree, and namespace tests compare URIs. In XML,local-name()of a processing instruction is now its whole target, as libxml2 has it.
Fixed
- XPath read an element’s attributes by walking every one before the
one it wanted, so a name test like
@idon an element with 20,000 attributes took quadratic time: 3.9 seconds where it now takes 4 ms. A page built to stall a crawler’s XPath could have used it.Document::attr_at(id, i)reads one attribute in constant time. - XPath’s
namespace::axis was always empty. It now has the namespaces in scope at an element, in libxml2’s order:xmlfirst, then the outermost element’s bindings.xmlns=""takes the default namespace away and leaves no node for it. In XML,parsec-xml’sDocumentreports itsxmlnsattributes; in HTML, every element has only thexmlnamespace, as lxml gives it. The Python, Node.js and WebAssembly bindings give a namespace node as its URI, a string, as they give an attribute as its value. The C API gives it as its element withPARSEC_NS_ATTRin place of an attribute index. - The Python wheels, the npm package and the C library are built with
url2.5.9, for RUSTSEC-2026-0592:Url::origin()on a deeply nestedblob:URL overflowed the stack. Parsec only callsUrl::parse, so it never reached it (#221).
0.2.0
A security release. A page could crash any program using Parsec
0.1.0: a few thousand nested <template>s overflowed the stack, which
nothing can catch, and ended the process in every binding. That’s
fixed, along with inputs built to take quadratic time, a buffer that
could overflow on huge input, panics in XPath, edit calls that wrote
names as markup, positions in the C API, wheels 0.1.0 didn’t ship, and
docs that said more than the code did. Upgrade if Parsec reads pages
you don’t control.
It’s 0.2.0, not 0.1.1, because the edit API changed shape: see Changed. Until 1.0, a minor release can break the API and a patch release won’t.
Changed
Document::create_elementreturnsResult<NodeId, EditError>, andset_attr,add_attr,set_attrs,renameandrename_attrreturnResult<(), EditError>. A namecreateElementorsetAttributewould refuse (empty, or with whitespace,/,>,=, a quote or a control character in it) is the newEditError::InvalidName, instead of being written out as markup.create_element_as_parsedandadd_attr_as_parsedtake a name as given, for copying a parsed node into another document, asimportNodedoes: the parser makes names likea"bthat the checks refuse (#136).MatchOptionsandMatchTimeouthave a new field,max_steps: a limit on selector matching that needs no clock, so it works on wasm32 too (#136). Code that builds either with a struct literal needs..Default::default().- In C,
parsec_create_elementandparsec_attr_setrefuse those names withPARSEC_NO_NODEandPARSEC_ERR_INVALID; in Python,create_nodeand setting an attribute raiseValueError; in JavaScript,setAttributethrows (#136).
Parser
- Nested
<template>s at the end of the input no longer recurse, so no page can overflow the stack: a hundred thousand of them parse on a 256 KB thread. Nothing else in the parser recurses on what a page holds either (#136). - A page full of NUL bytes, each of which becomes three, can no longer push the parse buffer past 2^30 bytes, where it panicked or read another string (#136).
- Checking a tag’s attributes for duplicates is linear, and the time
budget fires inside a long run of them: 100,000 attributes on one tag
took 12.8 s and take 10 ms. Attributes merged onto
<body>and<html>were quadratic the same way (#136). </body>,</html>and heading end tags under very deep nesting,:has()with more than one compound, and nested:is()no longer take quadratic time, andline_colkeeps a line index instead of counting from the start each call (#136).prettystops indenting past 100 levels, so a deep tree can’t make a string of gigabytes, and writes the newline the parser drops after<pre>,<textarea>and<listing>(#136).max_depth: Some(0)keeps the<html>element’s children at depth 1, asSome(1)does, instead of dropping them (#136).
XPath
- A scope past the end of the document, a node made after the index,
an empty index, a subtree index used from outside it, or another
document’s index is an
XPathErrorinstead of a panic, or, for the last, an answer from the wrong document (#136). - The work limit counts
lang()‘s climbs and string values’ text, and is lower, so no single query runs for tens of seconds (#136).
CSS
- A stylesheet or
styleattribute nested tens of thousands deep no longer overflows the stack. Functions, blocks and rules nest at mostMAX_NESTING(256) deep, counted together; anything deeper is dropped as it’s read, and a rule dropped that way is anInvalidRuleerror. The cascade looks 128 rules deep (#128). var()substitution copies in at most 1 MiB, so custom properties that double each other can’t take gigabytes and tens of seconds. Past that the value is invalid at computed-value time (#128).- Nested style rules’ selectors, with their parents written in, stop at
64 KiB, and a lone parent is written in without
:is(), which matched in time that doubled per level of nesting (#128). @layernames are looked up in a map and may have 64 parts, so a long dotted name or deep@layernesting no longer takes minutes (#128).parse_block_contentson rules with no;between them,a{}a{}…, is linear instead of quadratic, and so isparse_stylesheet_deepon the same inside a block (#128).cargo docbuilds every crate with warnings denied, in CI too (#128).
C API
- With
PARSEC_SPANSorPARSEC_ERRORS, spans and error offsets index the bytes you passed even when they aren’t valid UTF-8; before, they counted the U+FFFD copy and could point past your buffer (#129). parsec_line_colwith an offset nearSIZE_MAXgives an answer instead of a panic or a wrong one (#129).- A
parsec_selectcallback that changes the document getsPARSEC_ERR_BUSY; one that frees it has it freed whenparsec_selectreturns (#129). parsec.hdefinesPARSEC_VERSIONand its major, minor and patch parts, and says what’s undefined aboutparsec_string_freeand what ends the process (#129).
URL
- A host label over 4,000 code points (
punycode::MAX_LABEL) fails instead of taking seconds of Punycode work. All 4,565 WPT URL cases still pass (#129).
Python
- Wheels for CPython 3.14 and 3.15 with the GIL on macOS and Windows, which 0.1.0 didn’t have, and the release job fails if any expected wheel is missing (#132).
- Wheels and the sdist carry
LICENSEandNOTICE, and PyPI lists each supported Python version (#132). Node.strip_tags()andNode.unwrap_tags()include the node itself when it matches, as selectolax does (#132).- The docs say what
decompose()refuses, howline_col()counts without positions, and how XPath numbers become strings next to lxml (#132).
WebAssembly
- The TypeScript types compile without
lib: esnext.disposable(#130). package.jsonexports./package.jsonand has amain(#130).- The README says when to call
free()or useusing: in a loop that doesn’t yield, the garbage collector never gets to run (#130).
Packaging and docs
- crates.io pages show the header image, and their links work (#131).
- The crates no longer carry their test suites and data (#131).
- The README’s claims are corrected: two dependencies, not one; what can still end a C program; which inputs are still quadratic; the WebAssembly size; and WPT totals with their skipped cases (#130).
Fixes to the parser core itself arrive with the next sync from Netweir, which adds them to this entry.
0.1.0
The first release. It’s on crates.io, PyPI and npm as parsec-html, and
the C library is attached to the
GitHub release.
Packages
parsec-htmlon crates.io is the one crate to depend on. The parser is at its top (use parsec::...), and each standard is a module behind a feature:encoding,urlandxpathare on by default,css(asparsec::stylesheet) is off. Underneath, it’s built fromparsec-html-core,parsec-html-encoding,parsec-url,parsec-xpathandparsec-html-css, which are published so it can depend on them.- Every crate is built twice from fresh checkouts and must come out the
same byte for byte, then attested; the published
.cratefiles are checked against those (#76).
HTML parser
- The HTML Standard’s tokenizer and tree builder, with fragments, a tree
you can edit, and serialization as
innerHTML,outerHTML, text, pretty-printed or in the html5lib format (#1, #93). - A page can be parsed as it arrives, with
Parser::feedandfinish, and builds the same tree from any split (#114). - Parse errors are reported with the spec’s names and their line and column (#106), and every node and attribute can carry its byte range in the source (#102).
- A
<template shadowrootmode>attaches a declarative shadow root, with slots and the flat tree (#119). - A
NodeIdfor a removed node reads as nothing, andis_removedsays so, instead of reading the old node (#121). - The crafted pages that crashed the parser, hung serialization or made it crawl no longer do, and limits on time, input size and tree depth are yours to set (#49, #84, #96).
Selectors
- Selectors Level 4 in
parsec::css, with:has(),:nth-child(… of S), the form states,:lang(),:dir(),:target,:local-link,:blank,:defined,pattern=with\p{…},||and:nth-col(), and namespace prefixes (#62, #90, #103, #107). - The web-platform-tests selector cases run in
cargo test(#105).
Encoding (parsec::encoding)
parse_bytessniffs a page’s encoding as a browser does and parses it;ByteParserdoes the same as the bytes arrive (#79, #115).
URL (parsec::url)
- The WHATWG URL Standard,
URLSearchParams, IDNA, Punycode and Unicode normalization, passing all 4,565 web-platform-tests URL cases (#77, #86).
XPath (parsec::xpath)
- XPath 1.0 over the parsed document, passing libxml2’s expression tests but its own extensions (#104).
CSS (parsec::stylesheet, feature css)
- CSS Syntax Level 3: the tokenizer, the parser and serialization, with a span on every rule (#87, #89).
- Typed values for all 822 properties in the specs, written back in CSSOM’s canonical forms (#91, #98).
- The cascade and computed values, with media queries,
@layer,@scope,@container,@import,@propertyand pseudo-elements (#94, #99, #109, #112).
C API
libparsec, shared and static, withparsec.h, pkg-config and CMake files, packaged for Linux, macOS and Windows on x86-64 and ARM (#78).- XPath, positions, parse errors and bytes in any encoding, whole or streamed (#108, #118).
Python
pip install parsec-html: selectolax’s API, free-threaded Python included (#80), with XPath, positions and parse errors (#108), andbytessniffed as browsers do, whole or streamed (#118).
WebAssembly
Source: CHANGELOG.md on GitHub.