nizel
v0.1.1
Published
Markdown content processor for modern applications.
Readme
nizel
Markdown content processor for modern applications.
Custom CommonMark 0.31 parser with frontmatter, templates, filters, elements, plugins, custom blocks, and transforms. No third-party markdown libraries.
Install
npm install nizelUsage
import { useNizel } from 'nizel';
const processor = useNizel({
// optional configuration
});
const result = processor.process('# Hello {{ name }}', {
data: { name: 'World' }
});Result
process() returns:
files— output files (HTML by default)pages— page metadata from frontmatterproject— project-level datalanguages— language info
Convenience Methods
processor.parse(markdown); // AST only, no rendering
processor.render(markdown); // HTML stringFeatures
- CommonMark 0.31 — full spec compliance (652/652 tests)
- Frontmatter — YAML with arrays, templates, and variable resolution
- Filters — 14 built-in: camel, capital, const, dot, header, kebab, lower, pascal, path, sentence, slug, snake, upper, format
- Elements — customize HTML tags and attributes for any node type
- Templates —
{{ variable }}syntax with filter chains - Plugins —
defineNizelPlugin()withbeforeParse,afterParse,afterRenderhooks - Custom blocks —
defineBlock()for domain-specific content - Transforms — post-processing pipeline
- Presets —
blog,emailbuilt-in, or create your own - Safety —
onclick/onerrorhandlers stripped,javascript:URLs stripped - TOC — table of contents with level/slug aliases
Options
useNizel({
data: {}, // template variables
variables: {}, // alias for data
preset: 'blog', // or 'email', or custom object
slugStyle: 'kebab', // slug generation style
elements: {
a: { tag: 'a', attrs: { target: '_blank' } }
},
plugins: [myPlugin()],
filters: { custom: (v) => v.toUpperCase() },
blocks: { note: myNoteBlock },
});Plugins
Official plugins available:
nizel-plugin-autolink— configure autolink behaviornizel-plugin-code-copy— CSP-friendly copy buttons on code blocksnizel-plugin-shiki— code syntax highlighting via Shiki
License
MIT
