A lightweight utility to convert Lake Markup Language (LML) to HTML
npm install lake-html


---
A lightweight, zero-dependency utility to convert Lake Markup Language (LML) strings into standard, semantic HTML.
Designed for Lake, this library handles the parsing of custom tags and transforms them into clean HTML elements like images, code blocks, embeds, and more.
* Lightweight: Zero external dependencies.
* Isomorphic: Works perfectly in Node.js and Browsers.
* Safe: Auto-encodes HTML entities to prevent XSS.
* Extensible: Easily override default renderers or add custom box types.
* TypeScript: Written in TypeScript with complete type definitions.
``bash`
npm install lake-html
Import the toHTML function and pass your LML string.
` js
import { toHTML } from 'lake-html';
const content =
Hello World
End of content
;const html = toHTML(content);
console.log(html);
// Output:
//
Hello World
// 
// End of content
`Customization
You can customize how specific boxes are rendered or add support for new box types by passing a
renderers object as the second argument.$3
For example, if you want to wrap all images in a
tag:`js
import { toHTML, getBoxRenderers } from 'lake-html';const renderers = getBoxRenderers();
// Override the 'image' renderer
renderers.image = (boxValue, encode) => {
return {
tagName: 'figure',
attributes: { class: 'custom-image' },
innerHTML:
};
};const html = toHTML(content, renderers);
`$3
`js
import { toHTML, getBoxRenderers } from 'lake-html';const renderers = getBoxRenderers();
// Add a custom 'card' box
renderers.card = (boxValue, encode) => {
return
${encode(boxValue.summary)}
;
};const html = toHTML(content, renderers);
`API Reference
$3
The main conversion function.
*
value: The input LML string.*
renderers: (Optional) An object to override default renderers.$3
Returns the default map of box renderers. Useful when you want to extend the defaults rather than replace them entirely.
Development
`bash
Build the library
pnpm buildRun tests
pnpm test
``