nizel
v0.1.12
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-abbr— abbreviation definitions with<abbr>outputnizel-plugin-alert— GitHub-style and custom alert blocksnizel-plugin-autolink— configurable bare URL and email linksnizel-plugin-citations— citation references and bibliography outputnizel-plugin-code-copy— copy controls for code blocksnizel-plugin-deflist— definition-list syntaxnizel-plugin-details— disclosure/details blocksnizel-plugin-diagrams— Mermaid code block containersnizel-plugin-emoji—:name:emoji shortcutsnizel-plugin-footnotes— footnote references and definitionsnizel-plugin-frontmatter-ui— frontmatter metadata rendering helpersnizel-plugin-gfm— GFM-oriented plugin presetnizel-plugin-heading-anchors— visible anchor links on headingsnizel-plugin-math— inline and display math wrappersnizel-plugin-media— figure, caption, lazy, and responsive image helpersnizel-plugin-sanitize— additional rendered HTML sanitizingnizel-plugin-shiki— code syntax highlighting via Shikinizel-plugin-task-list— task-list checkbox renderingnizel-plugin-toc— rendered[[toc]]table of contentsnizel-plugin-typography— mark, subscript, and superscript extensions
For native apps or WebViews that need a single browser bundle with a settings-friendly plugin registry, use nizel-kit.
For ready-to-link content styling, use nizel-style. It ships scoped CSS for core rendered content plus optional plugin CSS entrypoints such as nizel-style/plugins/alert.css and nizel-style/plugins/code-copy.css.
License
MIT
