markedin-parser 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.
Files changed (2) hide show
  1. package/README.md +140 -0
  2. package/package.json +9 -2
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # markedin-parser
2
+
3
+ Parse and render `.mi` (markedin) files โ€” Structured data in the frontmatter, readable prose in the rendered body.
4
+
5
+ Markedin (`.mi`) is a file format for both machines and humans. ๐Ÿค YAML frontmatter + templated Markdown. No framework required.
6
+
7
+ Full documentation at [markedin.dev](https://markedin.dev)
8
+
9
+ ## Install
10
+
11
+ ```
12
+ npm install markedin-parser
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```javascript
18
+ const {
19
+ parse,
20
+ render,
21
+ renderHtmlFrag,
22
+ renderHtml,
23
+ } = require("markedin-parser");
24
+
25
+ const source = `---
26
+ title: My Project
27
+ status: active
28
+ items:
29
+ - name: Alpha
30
+ status: stable
31
+ - name: Beta
32
+ status: experimental
33
+ ---
34
+
35
+ # {{title}}
36
+
37
+ **Status:** {{status}}
38
+
39
+ {{#each items}}
40
+ - **{{name}}** โ€” {{status}}
41
+ {{/each}}`;
42
+
43
+ // Extract frontmatter and body
44
+ const { data, body } = parse(source);
45
+ // data โ†’ { title: 'My Project', status: 'active', items: [...] }
46
+
47
+ // Render to markdown (template expressions resolved)
48
+ render(source);
49
+
50
+ // Render to HTML fragment
51
+ renderHtmlFrag(source);
52
+
53
+ // Render to full HTML document with styles
54
+ renderHtml(source);
55
+
56
+ // Embed frontmatter in output
57
+ render(source, { embed: true }); // appends as HTML comment
58
+ renderHtml(source, { embed: true }); // adds <script> tag in <head>
59
+ ```
60
+
61
+ ## API
62
+
63
+ ### `parse(source)` โ†’ `{ data, body }`
64
+
65
+ Extract YAML frontmatter and body. Does not resolve template expressions.
66
+
67
+ ### `render(source, options?)` โ†’ `string`
68
+
69
+ Resolve all template expressions and return rendered Markdown.
70
+
71
+ Options: `{ embed: true }` appends frontmatter as an HTML comment.
72
+
73
+ ### `renderHtmlFrag(source)` โ†’ `string`
74
+
75
+ Render to an HTML fragment โ€” no document wrapper.
76
+
77
+ ### `renderHtml(source, options?)` โ†’ `string`
78
+
79
+ Render to a full HTML document with styles.
80
+
81
+ Options: `{ embed: true }` includes frontmatter as a `<script type="application/json">` tag in `<head>`.
82
+
83
+ ### `resolvePath(data, path)` โ†’ `any`
84
+
85
+ Resolve a dotted/bracketed path against a data object.
86
+
87
+ ```javascript
88
+ resolvePath(data, "items[0].name"); // โ†’ 'Alpha'
89
+ ```
90
+
91
+ ## Template expressions
92
+
93
+ | Expression | Description |
94
+ | ---------------------------------- | -------------------------------------------- |
95
+ | `{{key}}` | Scalar value (arrays render comma-separated) |
96
+ | `{{key.nested}}` | Dot-path into objects |
97
+ | `{{array[0]}}` | Array index access |
98
+ | `{{#each items}}...{{/each}}` | Iterate an array |
99
+ | `{{#if key}}...{{else}}...{{/if}}` | Conditional block |
100
+ | `{{> key}}` | Inline a frontmatter string as raw text |
101
+
102
+ ## Example
103
+
104
+ ```
105
+ ---
106
+ task: Implement rate limiting
107
+ status: in_progress
108
+ owner:
109
+ name: Dana
110
+ team: Platform
111
+ priority: high
112
+ notes:
113
+ - Token bucket algorithm chosen over leaky bucket
114
+ - Limit is 100 req/min per API key
115
+ - Redis required for distributed enforcement
116
+ blocked: false
117
+ ---
118
+
119
+ # {{task}}
120
+
121
+ **Status:** {{status}} ยท **Owner:** {{owner.name}} ({{owner.team}}) ยท **Priority:** {{priority}}
122
+
123
+ First note: {{notes[0]}}
124
+
125
+ ## Notes
126
+
127
+ {{#each notes}}
128
+ - {{this}}
129
+ {{/each}}
130
+
131
+ {{#if blocked}}
132
+ โš ๏ธ This task is currently blocked.
133
+ {{else}}
134
+ โœ… No blockers.
135
+ {{/if}}
136
+ ```
137
+
138
+ ## License
139
+
140
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markedin-parser",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Parse and render .mi (markedin) files โ€” YAML frontmatter + templated Markdown",
5
5
  "main": "parse.js",
6
6
  "files": [
@@ -20,7 +20,14 @@
20
20
  },
21
21
  "author": "Jason Stonebraker",
22
22
  "license": "MIT",
23
- "keywords": ["markedin", "mi", "frontmatter", "yaml", "markdown", "template"],
23
+ "keywords": [
24
+ "markedin",
25
+ "mi",
26
+ "frontmatter",
27
+ "yaml",
28
+ "markdown",
29
+ "template"
30
+ ],
24
31
  "dependencies": {
25
32
  "js-yaml": "^4.1.1",
26
33
  "marked": "^17.0.4"