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

unified

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unified

Text processing framework: Parse / Transform / Compile

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is unified?

The unified npm package is an interface for parsing, inspecting, transforming, and serializing content through syntax trees. It is built on the concept of syntax trees and is often used to work with content in markdown, HTML, and plain text formats. Unified is part of the unified collective which provides a range of plugins and utilities for content processing.

What are unified's main functionalities?

Parsing Markdown to Syntax Trees

This feature allows you to parse Markdown content into an abstract syntax tree (AST) using the remark-parse plugin.

const unified = require('unified');
const markdown = require('remark-parse');

const processor = unified().use(markdown);
const tree = processor.parse('# Hello world');
console.log(tree);

Transforming Syntax Trees

This feature demonstrates transforming a Markdown AST to an HTML AST and then serializing it to an HTML string.

const unified = require('unified');
const markdown = require('remark-parse');
const remark2rehype = require('remark-rehype');
const html = require('rehype-stringify');

const processor = unified()
  .use(markdown)
  .use(remark2rehype)
  .use(html);

const file = processor.processSync('# Hello world');
console.log(String(file));

Linting and Validating Markdown

This feature shows how to use unified with remark-lint to lint and validate Markdown content.

const unified = require('unified');
const markdown = require('remark-parse');
const remarkLint = require('remark-lint');

const processor = unified()
  .use(markdown)
  .use(remarkLint);

processor.process('# Hello world', function (err, file) {
  console.error(report(err || file));
});

Compiling Markdown to HTML

This feature illustrates compiling Markdown to a fully formatted HTML document.

const unified = require('unified');
const markdown = require('remark-parse');
const remark2rehype = require('remark-rehype');
const doc = require('rehype-document');
const format = require('rehype-format');
const html = require('rehype-stringify');

const processor = unified()
  .use(markdown)
  .use(remark2rehype)
  .use(doc)
  .use(format)
  .use(html);

const file = processor.processSync('# Hello world');
console.log(String(file));

Other packages similar to unified

Keywords

FAQs

Package last updated on 31 Jul 2015

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