redac

0.3.1 • Public • Published

Redac

Redac is a content authoring library to source content into your website. The library handles Markdown, MDX, Yaml files by default.

Installation

Redac is only available as an ESM package for now. Please drop a feature request if you desire a CommonJS version.

Install the dependency into your package using your favorite package manager.

npm install redac

Usage

Import the redac package, source some data and start querying your dataset.

Short form:

// Import the redac package
import redac from 'redac'
// Initializethe engine
const articles = await redac
  // Source Markdown documents
  .mdx('./articles')
  // Start querying
  .from('articles')
  .filter( document => document.lang === 'fr')
  .list()

Long form:

// Import the redac package
import redac from 'redac'
// Initialize the engine
const engine = redac([
  // Source Markdown documents
  {
    module: 'redac/plugins/mdx',
    config: './articles',
  },
  // Source Yaml documents
  {
    module: 'redac/plugins/yaml',
    config: './tags',
  },
])
// Start querying
const articles = await engine
  .from('articles')
  .filter((document) => document.lang === 'fr')
  .list()

Package Sidebar

Install

npm i redac

Weekly Downloads

12

Version

0.3.1

License

MIT

Unpacked Size

25.6 kB

Total Files

23

Last publish

Collaborators

  • david