@mako-spec/js
v0.2.0
Published
JavaScript library for parsing, generating, and serving MAKO files — the open standard for LLM-optimized web content
Maintainers
Readme
mako-js
JavaScript/TypeScript library for MAKO — the open standard for serving LLM-optimized content on the web.
Features
- Parse & generate
.mako.mdfiles with full TypeScript types - CEF encode/decode — Compact Embedding Format for HTTP header transport
- Express middleware — content negotiation for serving MAKO alongside HTML
- Validator — validate MAKO files against the spec
Install
npm install @mako-spec/jsQuick Start
import { parseMakoFile, generateMakoFile, cefEncode, cefDecode } from '@mako-spec/js';
// Parse a .mako.md file
const file = parseMakoFile(makoContent);
console.log(file.frontmatter.entity); // "Nike Air Max 90"
// Generate a .mako.md file
const output = generateMakoFile(file);
// CEF encode/decode embeddings
const encoded = cefEncode([0.1, -0.3, 0.5, ...]);
const decoded = cefDecode(encoded, 512);Express Middleware
import express from 'express';
import { makoMiddleware } from '@mako-spec/js/middleware/express';
const app = express();
app.use(makoMiddleware({ dir: './mako-files' }));
app.use(express.static('./html-files'));Demo
npm run demo # Start demo server on localhost:3000
npm run benchmark # Compare HTML vs Cloudflare MD vs MAKO tokens
npm test # Run testsLicense
Apache-2.0
