Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unist-builder

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unist-builder

unist utility to create a new trees with a nice syntax

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-14.83%
Maintainers
2
Weekly downloads
 
Created

What is unist-builder?

The `unist-builder` npm package is a utility for creating trees of nodes, specifically designed for the Unified ecosystem. It simplifies the process of creating Unist (Universal Syntax Tree) nodes, which are used in processing complex structures like markdown, HTML, or other abstract syntax trees. This package is particularly useful for developers working with markdown, abstract syntax trees, or needing a structured way to programmatically generate or manipulate document structures.

What are unist-builder's main functionalities?

Creating simple Unist nodes

This feature allows for the creation of simple Unist nodes, such as paragraphs or text nodes, which can be used to represent parts of a document. The code sample demonstrates how to create a paragraph node containing a single text node.

{"type": "paragraph", "children": [{"type": "text", "value": "Hello, world!"}]}

Building complex tree structures

With `unist-builder`, users can build more complex tree structures by nesting nodes. This is useful for representing entire documents or sections of content. The provided code sample illustrates how to create a root node that contains a paragraph node, which in turn contains a text node.

{"type": "root", "children": [{"type": "paragraph", "children": [{"type": "text", "value": "Hello, world!"}]}]}

Manipulating node properties

This functionality enables the addition or modification of properties on nodes, such as adding URLs to link nodes. It's particularly useful for creating hyperlinks or adding metadata to nodes. The code sample shows how to create a link node with a URL property.

{"type": "link", "url": "https://example.com", "children": [{"type": "text", "value": "Example"}]}

Other packages similar to unist-builder

Keywords

FAQs

Package last updated on 07 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc