Skip to content

jasperdevs/lessmark

Repository files navigation

lessmark

lessmark <M

The markdown alternative that agents (and humans) love.

lessmark.org

npm PyPI crates.io VS Code Marketplace

Lessmark is readable markup with typed blocks, canonical formatting, safe rendering, and a stable JSON AST across JavaScript, Python, and Rust.

Why use Lessmark instead of Markdown?

Markdown is good when a human is the only reader. Lessmark is for documents that humans edit and AI agents need to trust.

In Markdown, the same-looking document can parse differently across engines, raw HTML can change the output, and malformed structure often gets accepted silently. That is fine for notes and comments, but painful for AI agent context files, docs pipelines, renderers, and import/export paths that need one predictable tree.

Lessmark keeps the readable parts and removes the guesswork:

Markdown Lessmark
Many equivalent spellings for the same idea One canonical format
Parser-dependent edge cases Shared grammar and conformance tests
Raw HTML and renderer-specific behavior Safe rendering with no raw HTML
Loose structure that AI agents and parsers have to infer Typed blocks with explicit attributes
Formatting is mostly cosmetic Formatting produces stable source
AST shape depends on the parser Stable JSON AST across JavaScript, Python, and Rust

Use Markdown for casual prose. Use Lessmark when the file is part of a build, a parser, a validator, a site, or an agent workflow.

Install

npm install lessmark
pip install lessmark
cargo add lessmark
CLI
lessmark parse file.lmk
lessmark parse --positions file.lmk
lessmark parse -
lessmark check file.lmk
lessmark check docs
lessmark check --json file.lmk
lessmark format file.lmk
lessmark format --check file.lmk
lessmark format --check --json docs
lessmark fix --write file.lmk
lessmark fix --write docs
lessmark from-markdown README.md
lessmark from-markdown -
lessmark to-markdown file.lmk
lessmark to-markdown -
lessmark init docs
lessmark skill init code-review
lessmark skill check code-review
lessmark skill build code-review --target both
lessmark skill import code-review/SKILL.md --out code-review/skill.lmk
lessmark skill install code-review --target codex
lessmark skill dev code-review
lessmark render --document file.lmk
lessmark build --strict input public
lessmark info --json

Use - to read from stdin. check, format --check, and fix --write can also walk a directory recursively. parse --positions includes source ranges for tooling. init creates a starter docs/index.lmk without overwriting. parse, check, format, fix, from-markdown, to-markdown, init, and info are shared by the JavaScript, Python, and Rust packages. HTML rendering, static-site builds, and skill bundle commands are npm CLI features.

API
import { parseLessmark, validateSource, formatLessmark, renderHtml } from "lessmark";

const source = "# Notes\n\nPlain prose becomes a paragraph.\n";
const ast = parseLessmark(source);
const errors = validateSource(source);
const formatted = formatLessmark(source);
const html = renderHtml(ast, { document: true });
from lessmark import parse_lessmark, validate_source, format_lessmark
use lessmark::{parse_lessmark, validate_source, format_lessmark};
Language

Lessmark source files use .lmk; .lessmark is a readable alias. The language includes plain top-level paragraphs, headings, inline functions, typed context blocks, skill metadata, lists, tables, callouts, code, math, diagrams, links, footnotes, and page/navigation metadata.

Conformance is checked across JavaScript, Python, Rust, docs, Markdown conversion, fixtures, schemas, VS Code syntax, and the Tree-sitter starter grammar. See lessmark.org/docs/conformance.

License

MIT

About

The markdown alternative that agents (and humans) love.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors