Guides

Getting Started

Install

npm install nizel

Basic Usage

import { useNizel } from 'nizel';

const nizel = useNizel();

const { html } = await nizel('# Hello');

With Options

const nizel = useNizel({
  output: 'html',
  frontmatter: true,
  toc: true,
  anchors: true,
});

With Variables

const { html } = await nizel(
  `
---
title: {{ product.name | title }}
slug: {{ product.name | kebab }}
---

# {{ meta.title }}

Price: {{ price | format('currency', 'EUR') }}
`,
  {
    variables: {
      product: { name: 'nizel handbook' },
      price: 29.99,
    },
  },
);

Result

The main call returns a structured object:

const {
  result,       // the selected main output (HTML by default)
  html,         // rendered HTML string
  text,         // plain text extraction
  meta,         // parsed frontmatter
  frontmatter,  // raw frontmatter object
  toc,          // table of contents entries
  title,        // first heading text
  description,  // first paragraph text
  excerpt,      // truncated summary
  headings,     // all heading nodes
  links,        // all link references
  images,       // all image references
  readingTime,  // estimated reading time
  ast,          // full AST tree
} = await nizel(markdown);

Next Steps