Gathering detailed insights and metrics for hast-util-to-parse5
Gathering detailed insights and metrics for hast-util-to-parse5
Gathering detailed insights and metrics for hast-util-to-parse5
Gathering detailed insights and metrics for hast-util-to-parse5
utility to transform hast to Parse5’s AST
npm install hast-util-to-parse5
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2 Stars
120 Commits
2 Forks
9 Watching
1 Branches
11 Contributors
Updated on 31 Jan 2023
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-0.8%
655,991
Compared to previous day
Last week
2.4%
3,374,396
Compared to previous week
Last month
11.4%
14,312,271
Compared to previous month
Last year
-20%
168,567,657
Compared to previous year
hast utility to transform to a parse5
AST.
This package is a utility that can turn a hast syntax tree into a parse5
AST.
Why not use a Parse5 adapter, you might ask?
Well, because it’s more code weight to use adapters, and more fragile.
This package is useful when working with parse5
, and for some reason want to
generate its AST again.
The inverse utility, hast-util-from-parse5
, is more
likely what you want.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install hast-util-to-parse5
In Deno with esm.sh
:
1import {toParse5} from 'https://esm.sh/hast-util-to-parse5@8'
In browsers with esm.sh
:
1<script type="module"> 2 import {toParse5} from 'https://esm.sh/hast-util-to-parse5@8?bundle' 3</script>
1import {toParse5} from 'hast-util-to-parse5' 2 3const tree = toParse5({ 4 type: 'element', 5 tagName: 'h1', 6 properties: {}, 7 children: [{type: 'text', value: 'World!'}] 8}) 9 10console.log(tree)
Yields:
1{ nodeName: 'h1', 2 tagName: 'h1', 3 attrs: [], 4 namespaceURI: 'http://www.w3.org/1999/xhtml', 5 childNodes: [ { nodeName: '#text', value: 'World!', parentNode: [Circular] } ] }
This package exports the identifier toParse5
.
There is no default export.
toParse5(tree[, options])
Transform a hast tree to a parse5
AST.
parse5
node (Parse5Node
).
Options
Configuration (TypeScript type).
space
(Space
, optional)
— which space the document is inSpace
Namespace (TypeScript type).
1type Space = 'html' | 'svg'
This package is fully typed with TypeScript.
It exports the additional types Options
and
Space
.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, hast-util-to-parse5@^8
,
compatible with Node.js 16.
Use of hast-util-to-parse5
can open you up to a
cross-site scripting (XSS) attack if the hast tree is unsafe.
hast-util-from-parse5
— transform from Parse5’s AST to hasthast-util-to-nlcst
— transform hast to nlcsthast-util-to-mdast
— transform hast to mdasthast-util-to-xast
— transform hast to xastmdast-util-to-hast
— transform mdast to hastmdast-util-to-nlcst
— transform mdast to nlcstSee contributing.md
in syntax-tree/.github
for
ways to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More