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

unified-engine

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unified-engine

unified engine to process multiple files, lettings users configure from the file system

  • 11.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
372K
decreased by-5.68%
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 18 Aug 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