Skip to content

juanisidoro/mako-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mako-js

JavaScript/TypeScript library for MAKO — the open standard for serving LLM-optimized content on the web.

Features

  • Parse & generate .mako.md files 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/js

Quick 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 tests

License

Apache-2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors