Socket
Socket
Sign inDemoInstall

unified-engine

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unified-engine

Engine to process multiple files with unified


Version published
Weekly downloads
312K
increased by1.71%
Maintainers
1
Weekly downloads
 
Created

What is unified-engine?

The unified-engine is a powerful tool for processing text using plugins. It is part of the unified collective, which is a project that provides a suite of tools for working with content as structured data. The engine allows you to read, process, and write files using a pipeline of plugins, making it highly extensible and customizable.

What are unified-engine's main functionalities?

Reading Files

This feature allows you to read files from the filesystem. In this example, the engine reads a Markdown file using the 'remark-parse' plugin.

const engine = require('unified-engine');
const vfile = require('to-vfile');

engine({
  files: ['example.md'],
  processor: unified().use(require('remark-parse')),
  cwd: process.cwd(),
  extensions: ['md'],
  output: false
}, (err, status) => {
  if (err) throw err;
  console.log('Files read successfully');
});

Processing Files

This feature allows you to process files using a pipeline of plugins. In this example, the engine processes a Markdown file and converts it to HTML using 'remark-parse' and 'remark-html' plugins.

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

engine({
  files: ['example.md'],
  processor: unified().use(markdown).use(html),
  cwd: process.cwd(),
  extensions: ['md'],
  output: 'example.html'
}, (err, status) => {
  if (err) throw err;
  console.log('Files processed successfully');
});

Writing Files

This feature allows you to write processed files back to the filesystem. In this example, the engine writes the processed HTML output to 'example.html'.

const engine = require('unified-engine');
const vfile = require('to-vfile');
const unified = require('unified');
const markdown = require('remark-parse');
const html = require('remark-html');

engine({
  files: ['example.md'],
  processor: unified().use(markdown).use(html),
  cwd: process.cwd(),
  extensions: ['md'],
  output: 'example.html'
}, (err, status) => {
  if (err) throw err;
  console.log('Files written successfully');
});

Other packages similar to unified-engine

Keywords

FAQs

Package last updated on 01 Apr 2021

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