-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
709 lines (646 loc) · 36.8 KB
/
Copy pathindex.html
File metadata and controls
709 lines (646 loc) · 36.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>.INGR — Compact Git-Friendly Record Format</title>
<meta name="description"
content="INGR is a compact, deterministic, self-describing, Git-friendly fixed-line record format for structured data."/>
<!-- Apply theme before first paint to avoid flash -->
<script>
(function () {
var hash = location.hash;
var t = hash === '#dark' ? 'dark' : hash === '#light' ? 'light' : localStorage.getItem('ingr-theme');
if (t === 'light' || t === null) {
document.documentElement.setAttribute('data-theme', 'light');
}
})();
</script>
<script type="module" src="/src/home.ts"></script>
<style>
.diff-grid {
display: grid;
grid-template-columns: 60% 40%;
gap: 32px;
}
@media (max-width: 768px) {
.diff-grid {
grid-template-columns: 70% 30%;
}
}
/* Sponsorship section */
.sponsor-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 64px;
align-items: center;
}
.sponsor-terminal {
background: var(--bg);
border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 70px color-mix(in srgb, var(--accent) 9%, transparent),
0 24px 64px rgba(0, 0, 0, 0.65);
width: 100%;
max-width: 380px;
}
.sponsor-terminal__chrome {
background: var(--surface-2);
padding: 10px 16px;
display: flex;
align-items: center;
gap: 7px;
border-bottom: 1px solid var(--border);
}
.sponsor-terminal__dot {
width: 10px;
height: 10px;
border-radius: 50%;
flex-shrink: 0;
}
.sponsor-terminal__file {
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-muted);
margin: 0 auto;
letter-spacing: 0.05em;
}
.sponsor-terminal__body {
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.8;
padding: 16px 20px;
margin: 0;
white-space: pre;
color: var(--text);
}
.sponsor-you {
display: block;
background: color-mix(in srgb, var(--accent) 8%, transparent);
margin: 0 -20px;
padding: 0 20px;
}
@media (max-width: 820px) {
.sponsor-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-L0TY1NK8R0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-L0TY1NK8R0');
</script>
<body>
<!-- ── HEADER ──────────────────────────────────────────────────────────────── -->
<header class="site-header site-header--sticky">
<span class="site-logo">.INGR</span>
<nav class="site-nav">
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
class="nav-link">GitHub</a>
<a href="/converter/" class="nav-link-btn">Converter →</a>
</nav>
</header>
<!-- Theme toggle -->
<div class="theme-toggle-bar">
<div class="theme-toggle" id="theme-toggle" role="group" aria-label="Color theme">
<span class="theme-toggle__label" id="theme-label-dark">🌑 Dark</span>
<button class="theme-toggle__track" id="theme-toggle-btn" aria-label="Toggle theme" title="Toggle theme"></button>
<span class="theme-toggle__label" id="theme-label-light">☀️ Light</span>
<span class="theme-toggle__hint" id="theme-hint">Go dark, friend 😈</span>
</div>
</div>
<!-- ── HERO ────────────────────────────────────────────────────────────────── -->
<section class="section-wrap" style="padding-bottom:0;">
<div class="animate-fade-up" style="margin-bottom:16px;">
<span style="font-family:var(--font-mono);font-size:11px;text-transform:uppercase;letter-spacing:0.12em;color:var(--accent);border:1px solid var(--accent-dim);padding:4px 10px;">v1.0.0-RC</span>
</div>
<h1 class="animate-fade-up delay-1"
style="font-family:var(--font-display);font-size:clamp(28px,4vw,48px);font-weight:700;line-height:1.15;letter-spacing:-0.01em;color:var(--text);margin:0 0 24px;max-width:800px;">
The diff-friendly record format<br/>
<span style="color:var(--accent);">for large datasets in Git.</span>
</h1>
<p class="animate-fade-up delay-2"
style="font-size:18px;line-height:1.6;color:var(--text-muted);max-width:560px;margin:0 0 48px;">
INGR is a compact, deterministic, self-describing fixed-line record format.
One field per line. Every diff meaningful. Every merge clean.
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
class="link-accent">Full specification ↗</a>
</p>
<!-- Mini converter -->
<div class="animate-fade-up delay-3 ingr-right" id="hero-grid"
style="display:grid;gap:0;border:1px solid var(--border);">
<!-- Input -->
<div id="hero-left-panel" class="hero-panel" style="display:flex;flex-direction:column;">
<div class="panel-header">
<div class="panel-title-group">
<span id="hero-left-title" class="panel-title"><b style="color:var(--text);">Input</b></span>
<span id="hero-input-size" class="size-label"></span>
</div>
<div id="hero-tabs" class="format-tabs in-header-tabs"></div>
</div>
<textarea id="hero-input" class="code-area" rows="12"
style="border:none;width:100%;flex:1;min-height:0;"
placeholder="Paste your data here…"></textarea>
</div>
<!-- Center controls -->
<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:20px 16px;background:var(--surface);border-left:1px solid var(--border);border-right:1px solid var(--border);">
<button id="hero-convert" class="btn-primary hero-convert-btn"
style="display:flex;flex-direction:column;align-items:center;padding:16px 10px;letter-spacing:0.12em;line-height:1.4;">
<span class="arrow-desktop" style="font-size:13px;">⇒</span>
<span class="btn-text-vertical">C</span><span class="btn-text-vertical">O</span><span
class="btn-text-vertical">N</span><span class="btn-text-vertical">V</span><span
class="btn-text-vertical">E</span><span class="btn-text-vertical">R</span><span
class="btn-text-vertical">T</span>
<span class="arrow-desktop" style="font-size:13px;">⇒</span>
<span class="btn-mobile" style="font-size:13px;">⇓</span>
<span class="btn-text-mobile">CONVERT</span>
<span class="btn-mobile" style="font-size:13px;">⇓</span>
</button>
<button id="hero-swap" class="btn-ghost hero-swap-btn"
style="display:flex;flex-direction:column;align-items:center;padding:12px 8px;font-size:11px;line-height:1.5;">
<span class="arrow-desktop" style="font-size:13px;">⇐</span>
<span class="btn-text-vertical">S</span><span class="btn-text-vertical">W</span><span
class="btn-text-vertical">A</span><span class="btn-text-vertical">P</span>
<span class="arrow-desktop" style="font-size:13px;">⇒</span>
<span class="btn-mobile" style="font-size:13px;">⇑</span>
<span class="btn-text-mobile">SWAP</span>
<span class="btn-mobile" style="font-size:13px;">⇓</span>
</button>
</div>
<!-- Output -->
<div id="hero-right-panel" class="hero-panel" style="display:flex;flex-direction:column;">
<div class="panel-header">
<div class="panel-title-group">
<span id="hero-right-title" class="panel-title"><b
style="color:var(--text);">.INGR</b> output</span>
<span id="hero-output-size" class="size-label"></span>
</div>
<div id="hero-ingr-controls"
style="display:flex;align-items:center;gap:12px;margin-left:auto;padding:0 14px;">
<label class="checkbox-label">
<input id="hero-delimiter" type="checkbox" class="checkbox-input" checked/>
<span class="mono-sm">Record delimiters</span>
</label>
<label class="checkbox-label">
<input id="hero-sha256" type="checkbox" class="checkbox-input"/>
<span class="mono-sm">sha256</span>
</label>
</div>
<div id="hero-right-tabs" class="format-tabs in-header-tabs" style="display:none;"></div>
</div>
<pre id="hero-output" class="code-area code-output"
style="border:none;width:100%;flex:1;min-height:0;"
data-placeholder="Converted INGR will appear here…"></pre>
</div>
</div>
<div id="hero-size-info"
style="display:none;margin-top:12px;padding:12px 16px;background:var(--surface-2);border:1px solid var(--border);border-radius:4px;font-family:var(--font-mono);font-size:11px;color:var(--text-muted);text-align:center;">
<span id="hero-size-change"></span>
</div>
<div class="animate-fade-up delay-5"
style="display:flex;align-items:center;justify-content:space-between;margin-top:16px;flex-wrap:wrap;gap:8px;">
<p class="mono-note">JSON · JSONL · CSV · TSV · YAML · XML → INGR</p>
<a href="/converter/" class="link-accent"
style="font-family:var(--font-mono);font-size:11px;text-transform:uppercase;letter-spacing:0.06em;">Full
converter →</a>
</div>
</section>
<!-- ── FEATURES ────────────────────────────────────────────────────────────── -->
<section class="section-wrap what-it-is-section" style="padding-top:96px;">
<div style="display:grid;grid-template-columns:1fr 2px 2fr;gap:48px;align-items:start;margin-bottom:80px;"
class="what-it-is-grid">
<div>
<p class="section-label">What it is</p>
<h2 style="font-family:var(--font-display);font-size:36px;font-weight:700;line-height:1.15;color:var(--text);margin:0;">
Structured data,<br/>line by line.
</h2>
</div>
<div style="background:var(--border);align-self:stretch;"></div>
<div style="padding-top:8px;">
<p class="body-p" style="margin:0 0 20px;">
Each INGR file starts with a single header declaring the dataset name and column list.
Every record then occupies exactly <strong style="color:var(--text);font-weight:600;">N lines</strong> —
one JSON-encoded value per field.
No separators required. No ambiguity. No surprises.
</p>
<p class="body-p" style="margin:0;">
Because each field lives on its own line, Git sees exactly which values changed in every commit —
not a blob of JSON noise. Merge conflicts are rare, and when they happen, they're trivial to resolve.
</p>
</div>
</div>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:1px;background:var(--border);">
<div class="feature-card">
<div class="feature-num">01</div>
<h3 class="feature-h3">Self-describing</h3>
<p class="feature-p">The header encodes the recordset name and every column. No schema file needed.</p>
</div>
<div class="feature-card">
<div class="feature-num">02</div>
<h3 class="feature-h3">Deterministic</h3>
<p class="feature-p">Fixed column order and JSON encoding rules mean identical data always produces
identical bytes.</p>
</div>
<div class="feature-card">
<div class="feature-num">03</div>
<h3 class="feature-h3">Git-native</h3>
<p class="feature-p">One field per line means diffs are surgical. Cherry-picks and rebases work cleanly.</p>
</div>
<div class="feature-card">
<div class="feature-num">04</div>
<h3 class="feature-h3">JSON-typed</h3>
<p class="feature-p">All values are single-line JSON: strings, numbers, booleans, null, objects, arrays.</p>
</div>
</div>
</section>
<!-- ── SYNTAX EXAMPLE ──────────────────────────────────────────────────────── -->
<section class="full-bleed">
<div class="section-inner">
<p class="section-label">Format anatomy</p>
<h2 class="section-h2">Readable by humans. Trivial to parse.</h2>
</div>
<div class="section-inner format-anatomy-grid"
style="display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:64px;align-items:stretch;">
<div style="display:flex;flex-direction:column;">
<ul class="format-anatomy-list"
style="list-style:none;padding:12px 0 41px;margin:0;display:flex;flex-direction:column;justify-content:space-between;gap:32px;flex:1;">
<li class="anatomy-item" data-section="header"
style="display:flex;gap:12px;align-items:flex-start;cursor:pointer;">
<span class="anatomy-badge"
style="font-family:var(--font-mono);font-size:11px;color:var(--accent);background:var(--accent-dim);padding:2px 8px;flex-shrink:0;">HEADER</span><span
class="anatomy-desc">One line. Declares the recordset name and columns with <code
style="font-family:var(--font-mono);color:var(--accent);">$ID</code> as the primary key.</span>
</li>
<li class="anatomy-item" data-section="records"
style="display:flex;gap:12px;align-items:flex-start;cursor:pointer;">
<span class="anatomy-badge"
style="font-family:var(--font-mono);font-size:11px;color:var(--teal);background:var(--teal-dim);padding:2px 8px;flex-shrink:0;">RECORDS</span><span
class="anatomy-desc">N lines per record, one JSON value each. Optional <code
style="font-family:var(--font-mono);color:var(--text-subtle);">#</code> delimiter lines between records.</span>
</li>
<li class="anatomy-item" data-section="footer"
style="display:flex;gap:12px;align-items:flex-start;cursor:pointer;">
<span class="anatomy-badge"
style="font-family:var(--font-mono);font-size:11px;color:#9090C0;background:#1E1E30;padding:2px 8px;flex-shrink:0;">FOOTER</span><span
class="anatomy-desc">Record count for validation. Optional digest lines.</span>
</li>
</ul>
</div>
<div style="min-width:0;">
<div class="code-block" id="anatomy-code"><span class="code-section" data-section="header"><span
class="comment"># INGR.io | people: $ID, name, age</span></span><span class="code-section"
data-section="records"><span
class="string">"john"</span>
<span class="string">"John Doe"</span>
<span class="number">35</span>
<span class="string">"jane"</span>
<span class="string">"Jane Smith"</span>
<span class="number">29</span>
<span class="string">"carol"</span>
<span class="string">"Carol Wu"</span>
<span class="number">31</span></span><span class="code-section" data-section="footer"><span
class="comment"># 3 records</span></span></div>
<p class="mono-note" style="margin-top:12px;">3 columns × 3 records = 9 data lines + 1 header + 1 footer</p>
</div>
</div>
</section>
<script>
{
const items = document.querySelectorAll('.anatomy-item');
const sections = document.querySelectorAll('.code-section');
const list = document.querySelector('.format-anatomy-list');
const code = document.getElementById('anatomy-code');
function activate(key) {
list.classList.add('is-hovering');
code.classList.add('is-hovering');
items.forEach(el => el.classList.toggle('hovered', el.dataset.section === key));
sections.forEach(el => el.classList.toggle('hovered', el.dataset.section === key));
}
function deactivate() {
list.classList.remove('is-hovering');
code.classList.remove('is-hovering');
items.forEach(el => el.classList.remove('hovered'));
sections.forEach(el => el.classList.remove('hovered'));
}
items.forEach(el => {
el.addEventListener('mouseenter', () => activate(el.dataset.section));
el.addEventListener('mouseleave', deactivate);
});
sections.forEach(el => {
el.addEventListener('mouseenter', () => activate(el.dataset.section));
el.addEventListener('mouseleave', deactivate);
});
}
</script>
<!-- ── GIT DIFF SHOWCASE ───────────────────────────────────────────────────── -->
<section class="section-wrap">
<p class="section-label">Why it matters</p>
<h2 class="section-h2" style="max-width:600px;">Every change is exactly one changed line.</h2>
<div class="diff-grid">
<div>
<p style="font-family:var(--font-mono);font-size:10px;text-transform:uppercase;letter-spacing:0.1em;color:var(--error);margin:0 0 10px;">
<b>JSON diff</b> (<i>can be noisy</i>)</p>
<div class="code-block" style="border-left-color:var(--error);font-size:11px;"><span
style="color:var(--text-muted);"> {"name": "alice", "role": "admin"},</span>
<span style="color:var(--error);">- {"name": "bob", "role": "editor"},</span>
<span style="color:var(--success);">+ {"name": "bob", "role": "viewer"},</span>
<span style="color:var(--error);">- {"name": "carol", "role": "viewer"},</span>
<span style="color:var(--success);">+ {"name": "carol", "role": "admin"},</span>
<span style="color:var(--text-muted);"> {"name": "dave", "role": "editor"}</span></div>
</div>
<div>
<p style="font-family:var(--font-mono);font-size:10px;text-transform:uppercase;letter-spacing:0.1em;color:var(--success);margin:0 0 10px;">
INGR diff (surgical)</p>
<div class="code-block" style="border-left-color:var(--success);font-size:11px;"><span
style="color:var(--text-muted);"> "alice"</span>
<span style="color:var(--text-muted);"> "admin"</span>
<span style="color:var(--text-muted);"> "bob"</span>
<span style="color:var(--error);">- "editor"</span>
<span style="color:var(--success);">+ "viewer"</span>
<span style="color:var(--text-muted);"> "carol"</span>
<span style="color:var(--error);">- "viewer"</span>
<span style="color:var(--success);">+ "admin"</span>
<span style="color:var(--text-muted);"> "dave"</span>
<span style="color:var(--text-muted);"> "editor"</span></div>
</div>
</div>
</section>
<!-- ── CONVERTER CTA ───────────────────────────────────────────────────────── -->
<section class="full-bleed">
<div class="section-inner"
style="display:flex;align-items:center;justify-content:space-between;gap:40px;flex-wrap:wrap;">
<div>
<p class="section-label">Online tool</p>
<h2 style="font-family:var(--font-display);font-size:clamp(28px,4vw,48px);font-weight:800;line-height:1.15;color:var(--text);margin:0 0 16px;">
Convert your data to INGR<br/>— and back.
</h2>
<p style="font-size:16px;line-height:1.65;color:var(--text-muted);margin:0;max-width:480px;">
Paste or drop a file. The converter auto-detects your format, converts it, and lets you
copy or download the result. Supports JSON, JSONL, CSV, TSV, YAML, XML, and INGR —
all processed locally in your browser.
</p>
</div>
<div style="display:flex;flex-direction:column;gap:12px;align-items:flex-start;">
<a href="/converter/" class="btn-primary"
style="text-decoration:none;display:inline-block;font-size:13px;padding:14px 28px;letter-spacing:0.1em;">
Open Converter →
</a>
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
class="btn-ghost" style="text-decoration:none;display:inline-block;">
Read the Spec ↗
</a>
</div>
</div>
</section>
<!-- ── LIBRARIES ──────────────────────────────────────────────────────────── -->
<section class="section-wrap">
<p class="section-label">Libraries</p>
<h2 class="section-h2" style="margin-bottom:40px;">Ready-to-use in your language.</h2>
<!-- Two-column layout: lib cards left, AI prompt right -->
<div style="display:grid;grid-template-columns:280px 1fr;gap:1px;background:var(--border);align-items:stretch;">
<!-- Left: library cards (vertical) -->
<div style="display:flex;flex-direction:column;gap:1px;background:var(--border);">
<a href="https://github.com/ingr-io/ingr-go" target="_blank" rel="noopener"
class="feature-card" style="text-decoration:none;display:block;">
<div class="lib-lang">Go</div>
<div class="lib-name">ingr-go</div>
<div class="lib-link">ingr-io/ingr-go ↗</div>
</a>
<a href="https://github.com/ingr-io/ingr-js" target="_blank" rel="noopener"
class="feature-card" style="text-decoration:none;display:block;">
<div class="lib-lang">JavaScript / TypeScript</div>
<div class="lib-name">ingr-js</div>
<div class="lib-link">ingr-io/ingr-js ↗</div>
</a>
</div>
<!-- Right: AI prompt block -->
<div style="display:flex;flex-direction:column;background:var(--surface);">
<div style="background:var(--surface-2);padding:20px 24px;border-bottom:1px solid var(--border);">
<p class="section-label" style="margin-bottom:8px;">Don't see a library in your language?</p>
<h3 class="feature-h3" style="margin-bottom:8px;">Generate one with AI.</h3>
<p style="font-size:13px;line-height:1.6;color:var(--text-muted);margin:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
Copy a prompt for
<input id="lang-input" type="text" placeholder="YOUR LANGUAGE"
style="font-family:var(--font-mono);font-size:12px;background:var(--bg);border:1px solid var(--border-2);color:var(--text);padding:3px 8px;width:160px;outline:none;transition:border-color 0.15s;"
onfocus="this.style.borderColor='var(--accent)'"
onblur="this.style.borderColor='var(--border-2)'"/>
and paste it into your AI tool of choice.
</p>
</div>
<!-- Prompt tabs -->
<div id="prompt-tabs" class="format-tabs" style="background:var(--surface);">
<button class="format-tab active" data-prompt="parser">Parser</button>
<button class="format-tab" data-prompt="builder">Builder</button>
<button class="format-tab" data-prompt="both">PARSER+BUILDER</button>
</div>
<!-- Prompt output -->
<div style="position:relative;flex:1;">
<pre id="prompt-output" class="code-area code-output"
style="border:none;width:100%;height:100%;min-height:200px;color:var(--text);font-size:12px;line-height:1.7;white-space:pre-wrap;word-break:break-word;"></pre>
<button id="copy-prompt" class="btn-ghost"
style="position:absolute;top:12px;right:12px;font-size:10px;padding:5px 12px;display:flex;align-items:center;gap:5px;">
<span>⎘</span> Copy
</button>
</div>
</div>
</div>
</section>
<script type="module">
const SPEC_URL = 'https://raw.githubusercontent.com/ingitdb/ingitdb-cli/refs/heads/main/docs/file-formats/ingr.md'
const PROMPTS = {
parser: `Implement an INGR file format parser in [YOUR LANGUAGE].
Specification: ${SPEC_URL}
Requirements:
- Parse the header line to extract the recordset name and ordered column list
($ID is the reserved primary key column — strip the $ prefix in the output map key)
- Each record spans exactly N lines where N = number of columns;
each line contains a single JSON-encoded field value (string, number, boolean, null, object, or array)
- Skip optional '#' delimiter lines that may appear between records
- Parse the footer line ("# N record(s)") and validate the count against the number of records parsed
- Validate that (total data lines) % N === 0
- Use UTF-8 encoding and expect LF line separators
- Return a structured result: { recordsetName: string, columns: string[], records: object[] }
- Raise descriptive errors for any malformed input`,
builder: `Implement an INGR file format builder (serializer) in [YOUR LANGUAGE].
Specification: ${SPEC_URL}
Requirements:
- Accept: recordset name (string), ordered column list (string[]), array of records (key-value maps)
- Write the header line: # INGR.io | {recordsetName}: $ID, col2, col3, ...
(the first column must be prefixed with $ to mark it as the primary key)
- Encode each field value as a single-line JSON value — strings, numbers, booleans, null,
objects and arrays are all valid; objects and arrays must be compacted (no embedded newlines)
- Write each record as N consecutive lines, one JSON value per line
- Accept an optional boolean flag \`delimiter\` — when true, insert a bare '#' line between
records (but not after the last record)
- Write the footer line: # N record(s) (use "record" for N=1, "records" otherwise)
- Do NOT write a trailing newline after the final line
- Use UTF-8 encoding and LF line separators
- Raise descriptive errors for invalid input`,
both: `Implement a complete INGR file format library in [YOUR LANGUAGE], including both a parser and a builder.
Specification: ${SPEC_URL}
--- PARSER ---
- Parse the header line to extract the recordset name and ordered column list
($ID is the reserved primary key column — strip the $ prefix in the output map key)
- Each record spans exactly N lines (N = column count);
each line is a JSON-encoded field value (string, number, boolean, null, object, array)
- Skip optional '#' delimiter lines between records
- Parse and validate the footer record count
- Validate that (total data lines) % N === 0
- Return: { recordsetName: string, columns: string[], records: object[] }
- Raise descriptive errors for malformed input
--- BUILDER ---
- Accept recordset name, ordered column list, and array of records
- Write header: # INGR.io | {recordsetName}: $ID, col2, col3, ...
- Encode each field as a single-line JSON value (compact, no embedded newlines)
- Write each record as N consecutive lines
- Optional \`delimiter\` flag: insert a bare '#' line between records (not after the last)
- Write footer: # N record(s)
- No trailing newline after the final line
- UTF-8, LF line separators
Include usage examples for both parsing and building.`,
}
const tabsEl = document.getElementById('prompt-tabs')
const outputEl = document.getElementById('prompt-output')
const copyBtn = document.getElementById('copy-prompt')
const langInput = document.getElementById('lang-input')
let current = 'parser'
function resolvedPrompt() {
const lang = langInput.value.trim() || '[YOUR LANGUAGE]'
return PROMPTS[current].replaceAll('[YOUR LANGUAGE]', lang)
}
function setPrompt(key) {
current = key
outputEl.textContent = resolvedPrompt()
tabsEl.querySelectorAll('.format-tab').forEach(t =>
t.classList.toggle('active', t.dataset.prompt === key)
)
}
tabsEl.addEventListener('click', e => {
const btn = e.target.closest('.format-tab')
if (btn?.dataset.prompt) setPrompt(btn.dataset.prompt)
})
langInput.addEventListener('input', () => {
outputEl.textContent = resolvedPrompt()
})
copyBtn.addEventListener('click', async () => {
await navigator.clipboard.writeText(resolvedPrompt())
const orig = copyBtn.innerHTML
copyBtn.innerHTML = '<span>✓</span> Copied'
setTimeout(() => {
copyBtn.innerHTML = orig
}, 1500)
})
setPrompt('parser')
</script>
<!-- ── SPEC HIGHLIGHTS ─────────────────────────────────────────────────────── -->
<section class="section-wrap">
<p class="section-label">Specification</p>
<h2 class="section-h2">The rules are simple.<br/>The guarantees are strong.</h2>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:32px;">
<div>
<p class="spec-category">Encoding</p>
<ul class="spec-list">
<li>UTF-8 with LF line endings</li>
<li>All values are valid single-line JSON</li>
<li>No trailing newline on the final line</li>
</ul>
</div>
<div>
<p class="spec-category">Structure</p>
<ul class="spec-list">
<li>Header → Records → Footer</li>
<li><code style="font-family:var(--font-mono);">$ID</code> is the reserved primary key column</li>
<li>Optional <code style="font-family:var(--font-mono);">#</code> delimiters between records</li>
</ul>
</div>
<div>
<p class="spec-category">Validation</p>
<ul class="spec-list">
<li>Footer records count is machine-verifiable</li>
<li><code style="font-family:var(--font-mono);">(data_lines % N) === 0</code></li>
<li>Optional hash digest for integrity checks</li>
</ul>
</div>
</div>
<div style="margin-top:48px;padding-top:32px;border-top:1px solid var(--border);">
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
style="font-family:var(--font-mono);font-size:12px;text-transform:uppercase;letter-spacing:0.08em;color:var(--accent);text-decoration:none;">
Full specification on GitHub ↗
</a>
</div>
</section>
<!-- ── SPONSORSHIP ───────────────────────────────────────────────────────── -->
<section style="background:radial-gradient(ellipse 80% 280px at 50% 0%,color-mix(in srgb,var(--accent) 7%,var(--surface)),var(--surface));border-top:1px solid color-mix(in srgb,var(--accent) 22%,var(--border));border-bottom:1px solid var(--border);padding:80px 32px;">
<div style="max-width:1100px;margin:0 auto;" class="sponsor-grid">
<div>
<p class="section-label">Support the project</p>
<h2 style="font-family:var(--font-display);font-size:clamp(28px,4vw,44px);font-weight:700;line-height:1.15;color:var(--text);margin:0 0 20px;">
Help keep INGR<br/><span style="color:var(--accent);">free & evolving.</span>
</h2>
<p style="font-size:16px;line-height:1.75;color:var(--text-muted);margin:0 0 12px;max-width:440px;">
INGR is free and open-source. Your sponsorship — a one-off tip or a recurring contribution — funds new libraries, tooling, and ongoing spec work.
</p>
<p style="font-family:var(--font-mono);font-size:11px;color:var(--text-subtle);letter-spacing:0.05em;margin:0 0 36px;">
Every contribution, big or small, keeps this going.
</p>
<a href="https://github.com/sponsors/ingr-io" target="_blank" rel="noopener"
class="btn-primary" style="text-decoration:none;display:inline-flex;align-items:center;gap:10px;font-size:13px;padding:14px 28px;letter-spacing:0.08em;">
<span style="font-size:15px;line-height:1;">♥</span> Sponsor on GitHub
</a>
<div style="margin-top:24px;display:flex;flex-direction:column;gap:10px;">
<p style="font-family:var(--font-mono);font-size:11px;color:var(--text-muted);margin:0;">
Not in a position to sponsor?
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
class="link-accent" style="font-family:var(--font-mono);font-size:11px;">⭐ A star on GitHub</a>
costs nothing and helps others discover the project.
</p>
<p style="font-family:var(--font-mono);font-size:11px;color:var(--text-muted);margin:0;">
Using INGR at work or in a project?
Tell a colleague, write a post, or just mention it — word of mouth is everything for open-source.
</p>
</div>
</div>
<div style="display:flex;justify-content:center;align-items:center;">
<div class="sponsor-terminal">
<div class="sponsor-terminal__chrome">
<span class="sponsor-terminal__dot" style="background:#FF5F57;"></span>
<span class="sponsor-terminal__dot" style="background:#FFBD2E;"></span>
<span class="sponsor-terminal__dot" style="background:#28CA41;"></span>
<span class="sponsor-terminal__file">sponsors.ingr</span>
</div>
<pre class="sponsor-terminal__body"><span style="color:var(--text-muted);"># INGR.io | sponsors: $ID, name, tier</span>
<span style="color:var(--text);">"alice"</span>
<span style="color:var(--text);">"Alice Chen"</span>
<span style="color:var(--teal);">"⭐ gold"</span>
<span style="color:var(--border-2);">#</span>
<span style="color:var(--text);">"bob"</span>
<span style="color:var(--text);">"Bob Martinez"</span>
<span style="color:var(--teal);">"☕ one-time"</span>
<span style="color:var(--border-2);">#</span>
<span class="sponsor-you"><span style="color:var(--accent);">"you"</span></span>
<span class="sponsor-you"><span style="color:var(--accent);">"..."</span></span>
<span class="sponsor-you"><span style="color:var(--accent);">"♥ sponsor"</span></span>
<span style="color:var(--text-muted);"># 3 records</span><span class="cursor-blink"></span></pre>
</div>
</div>
</div>
</section>
<!-- ── FOOTER ──────────────────────────────────────────────────────────────── -->
<footer class="site-footer">
<span class="footer-link" style="cursor:default;">INGR File Format</span>
<div style="display:flex;gap:24px;">
<a href="https://github.com/ingr-io/ingr-file-format" target="_blank" rel="noopener"
class="footer-link">Spec</a>
<a href="/converter/" class="footer-link">Converter</a>
</div>
</footer>
</body>
</html>