
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
react-htmltree
Advanced tools
React component for HTML structures based on a string, react component or DOM node
TreeView for HTML/XML structures
The motivation for this component was the lack of a standalone TreeView for HTML documents, which can be easily integrated. Existing solutions are often tightly coupled into specific projects or don't provide necessary customizations options. While its original is based on the TreeView implementation of react-devtools, additional improvements regarding performance and usability were done.
Checkout the example in your browser.
import HTMLTree from 'react-htmltree'
<HTMLTree source={document.documentElement}/>
source: Text | React Component | HTMLElement
<HTMLElement source={document.documentElement} onSelect={handleSelect}/>
// others events include: 'hover', 'expand' and 'unfocus'
function handleSelect (element, component) {
console.log(element)
}
<HTMLElement source={'<ul><li>1</li><li>2</li></ul>'} customRender={customRender}/>
// create wrapper around the matched components
function customRender (decorate, node) {
return decorate(function (Component) {
if (node.name === 'script') {
return (
<div style={{ backgroundColor: 'red' }}>
<Component {...Component.props}/>
</div>
)
}
})
}
Further examples can be found here.
To build your own version run npm run dev
for development (incl. watch) or npm run build
for production (minified).
FAQs
React component for HTML structures based on a string, react component or DOM node
The npm package react-htmltree receives a total of 1 weekly downloads. As such, react-htmltree popularity was classified as not popular.
We found that react-htmltree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.