npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jmd-format

v0.1.2

Published

JMD (JSON Markdown) — structured data format for LLM-driven infrastructure. JavaScript reference implementation.

Readme

jmd-format

JMD (JSON Markdown) — JavaScript reference implementation.

JMD is a structured data format for LLM-driven infrastructure, designed to work with the natural generation behavior of large language models rather than against it. See the JMD specification for the format itself.

This package is the JavaScript reference implementation. A Python reference implementation exists as the jmd-format package on PyPI.

Status

Byte-compatible with the Python reference. The core syntax (all four document modes, nested objects, arrays of scalars / objects / sub-arrays, multiline blockquotes, frontmatter, thematic breaks) produces output identical to jmd-format on PyPI for the same input value and label — verified by a 10 000-case randomized cross-implementation stress test.

Schema-specific type expressions (§14) and QBE filter conditions (§13) are still parsed as raw strings on both sides; structured interpretation will follow.

Install

npm install jmd-format

Node 20+ required. Pure ESM, no transpilation, no dependencies.

Usage

Batch

import { parse, serialize } from 'jmd-format'

const { mode, label, frontmatter, value } = parse(text)
const out = serialize({ id: 42, status: 'pending' }, 'Order')

Frontmatter and alternate root modes are expressed at the call site:

serialize(value, '? Order', { page: 1, 'page-size': 50 })  // query mode
serialize(value, '! Order')                                 // schema mode
serialize(value, '- Order')                                 // delete mode

Streaming

The parser and serializer both have streaming surfaces — async generator for input, sync generator for output. Events follow the sequence from spec §18.2.

import { createParser, toLines, serializeLines } from 'jmd-format'

// Parse a stream of arbitrary text chunks (e.g. an HTTP response body).
const parser = createParser()
for await (const event of parser.events(toLines(response.body))) {
  // event: { type: 'field', key: 'id', value: 42 }
  // event: { type: 'object_start', key: 'address' }
  // event: { type: 'document_end' }
}

// Serialize line by line.
for (const line of serializeLines(value, 'Orders')) {
  res.write(line)  // each line includes its trailing newline
}

toLines(source) is the adapter that turns an async iterable of arbitrary string chunks into an async iterable of complete lines.

Currently supported

  • All four document modes (#, #!, #?, #-): parsing recognizes the mode and extracts the label; the body parses as standard JMD.
  • Scalars: null, true, false, numbers, bare and quoted strings.
  • Nested objects via heading depth.
  • Arrays of scalars and of objects (with indented continuation fields).
  • Sub-arrays and arrays of arrays (### [], §8.4).
  • Blockquote multiline strings (§9.1).
  • Frontmatter (§3.5): both key: value and bare-key forms.
  • Deferred blank-line scope reset (§7.2a) — a blank followed by a deeper heading re-enters the nested scope; a blank followed by a bare field triggers the reset. Matches the Python reference behavior.
  • Scalar headings for scope return (## total: 84.99, §7.2).
  • Anonymous headings (§3.2a).
  • Thematic breaks (---) as array-item separators (§8.6). Consumed by the innermost enclosing array whose most-recent item is a dict with nested structures.
  • Depth-qualified array items (##N -, §8.6a) and depth+1 items (##N - key: val, §8.6b). Parser-tolerance forms: the canonical serializer emits bare - items with thematic-break separators, but the parser accepts the depth-annotated forms that LLMs tend to produce when items sit one heading level below the array heading.
  • Streaming parser via async generator: events match the sequence defined in §18.2 (document_start, field, field_start, field_content, object_start/end, array_start/end, item_start/value/end, scope_reset, document_end, frontmatter).
  • Streaming serializer via sync generator (serializeLines).
  • Line adapter (toLines) to convert chunked input to lines.

Not yet structured

Schema-specific type expressions (§14) and QBE filter conditions (§13) are parsed as raw strings on both this implementation and the Python reference. Structured interpretation will follow in a later release.

Design

JavaScript-native throughout:

  • Functions and closures, not classes. No new, no this.
  • Plain objects as data carriers.
  • ESM only; no build step.
  • No external dependencies.
  • Zero Node-specific APIs in the core — runs in the browser unchanged.

The implementation is strict on the generator side and tolerant on the parser side, following §22.1 of the specification.

License

MIT — see LICENSE.