Registry / serialization / ecmarkdown

ecmarkdown

JSON →
library8.1.0jsnpmunverified

A compiler for converting Ecmarkdown algorithm shorthand (a Markdown-inspired syntax used in ECMAScript specifications) into HTML. Current stable version is 8.1.0, with a history of active development. Key differentiators: tailored specifically for writing spec algorithms, supports inline formatting for variables, values, and field references, and integrates with ecmarkup for full spec generation. The library is ESM-only and ships TypeScript type definitions. Release cadence is irregular but frequent, with breaking changes in major versions (e.g., v7 attrs, v6 column numbers, v5 types).

npm install ecmarkdown
INSTALL
IMPORT
SIG · ECMARKDOWN
E
ecmarkdown
serializationjavascriptv8.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import { parse } from 'ecmarkdown'
const { parse } = require('ecmarkdown')
ESM-only since v5; use dynamic import() in CommonJS.
emit
import { emit } from 'ecmarkdown'
import { emit } from 'ecmarkdown/emit'
Emit is a named export from the main entry point since v5.
FragmentNode
import { FragmentNode } from 'ecmarkdown'
import { Fragment } from 'ecmarkdown'
Type name changed from Fragment to FragmentNode in v7.1.0.

Shows parsing Ecmarkdown text into an AST and emitting HTML.

import { parse, emit } from 'ecmarkdown'; const input = `1. Let _x_ be *true*.\n 1. ReturnIfAbrupt(_x_).`; const doc = parse(input); const html = emit(doc); console.log(html); // Expected output: '<emu-alg><ol><li>Let <var>x</var> be <emu-val>true</emu-val>.<ol><li>ReturnIfAbrupt(<var>x</var>).</li></ol></li></ol></emu-alg>'
ecmarkdown --version
Debug
Known issues
breakingv7.0.0 changed list item 'id' attribute to 'attrs' (array of key-value pairs).
fix
Update code that accesses ListItemNode.id to use ListItemNode.attrs instead.
affects: >=7.0.0 <8.0.0
breakingv6.0.0 changed column numbers from 0-based to 1-based in location info.
fix
Adjust any logic relying on 0-based column numbers.
affects: >=6.0.0 <7.0.0
breakingv5.0.0 changed parse node types and prevented mixing numbered/bulleted list items.
fix
Update type references and ensure lists are homogeneous.
affects: >=5.0.0 <6.0.0
deprecatedDefault export was removed in v5.0.0; use named exports instead.
fix
Replace `import ecmarkdown from 'ecmarkdown'` with `import { parse, emit } from 'ecmarkdown'`.
affects: >=5.0.0
gotchaInline formatting constructs (e.g., _ _) are left verbatim if empty; __proto__ is not treated as a variable.
fix
Use _ proto _ (with spaces) if you need to denote a variable named 'proto'.
affects: >=3.0.8
Errors
Common errors & fixes
Cannot find module 'ecmarkdown'
Missing npm install or incorrect package path.
fix
Run `npm install ecmarkdown` and ensure the import path is correct.
SyntaxError: The requested module 'ecmarkdown' does not provide an export named 'parse'
Using a CommonJS require or importing from an older version without named exports.
fix
Use ESM import syntax or update to v5+ where named exports are available.
Property 'id' does not exist on type 'ListItemNode'
Migrated to v7.0.0 where ListItemNode.id was replaced by attrs.
fix
Change `node.id` to `node.attrs` and handle array of attribute objects.
Upgrade
Version history
8.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
ecmarkdown — npm install ecmarkdown · libregistry