nizel 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # nizel
2
+
3
+ Markdown content processor for modern applications.
4
+
5
+ Custom CommonMark 0.31 parser with frontmatter, templates, filters, elements, plugins, custom blocks, and transforms. No third-party markdown libraries.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install nizel
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ import { useNizel } from 'nizel';
17
+
18
+ const processor = useNizel({
19
+ // optional configuration
20
+ });
21
+
22
+ const result = processor.process('# Hello {{ name }}', {
23
+ data: { name: 'World' }
24
+ });
25
+ ```
26
+
27
+ ## Result
28
+
29
+ `process()` returns:
30
+
31
+ - `files` — output files (HTML by default)
32
+ - `pages` — page metadata from frontmatter
33
+ - `project` — project-level data
34
+ - `languages` — language info
35
+
36
+ ## Convenience Methods
37
+
38
+ ```js
39
+ processor.parse(markdown); // AST only, no rendering
40
+ processor.render(markdown); // HTML string
41
+ ```
42
+
43
+ ## Features
44
+
45
+ - **CommonMark 0.31** — full spec compliance (652/652 tests)
46
+ - **Frontmatter** — YAML with arrays, templates, and variable resolution
47
+ - **Filters** — 14 built-in: camel, capital, const, dot, header, kebab, lower, pascal, path, sentence, slug, snake, upper, format
48
+ - **Elements** — customize HTML tags and attributes for any node type
49
+ - **Templates** — `{{ variable }}` syntax with filter chains
50
+ - **Plugins** — `defineNizelPlugin()` with `beforeParse`, `afterParse`, `afterRender` hooks
51
+ - **Custom blocks** — `defineBlock()` for domain-specific content
52
+ - **Transforms** — post-processing pipeline
53
+ - **Presets** — `blog`, `email` built-in, or create your own
54
+ - **Safety** — `onclick`/`onerror` handlers stripped, `javascript:` URLs stripped
55
+ - **TOC** — table of contents with level/slug aliases
56
+
57
+ ## Options
58
+
59
+ ```js
60
+ useNizel({
61
+ data: {}, // template variables
62
+ variables: {}, // alias for data
63
+ preset: 'blog', // or 'email', or custom object
64
+ slugStyle: 'kebab', // slug generation style
65
+ elements: {
66
+ a: { tag: 'a', attrs: { target: '_blank' } }
67
+ },
68
+ plugins: [myPlugin()],
69
+ filters: { custom: (v) => v.toUpperCase() },
70
+ blocks: { note: myNoteBlock },
71
+ });
72
+ ```
73
+
74
+ ## Plugins
75
+
76
+ Official plugins available:
77
+
78
+ - `nizel-plugin-autolink` — configure autolink behavior
79
+ - `nizel-plugin-code-copy` — CSP-friendly copy buttons on code blocks
80
+ - `nizel-plugin-shiki` — code syntax highlighting via Shiki
81
+
82
+ ## License
83
+
84
+ MIT