Registry / testing / myst-spec

myst-spec

JSON →
library0.0.5jsnpmunverified

MyST Spec (myst-spec v0.0.5) formalizes the MyST (Markedly Structured Text) abstract syntax tree (AST), markup syntax, and HTML output for computational documents. It is currently in active development and may change without notice. The spec extends CommonMark and mdast (used by unifiedjs), and includes JSON schemas and test cases. It is designed for JupyterBook and similar tools, aiming for cross-language interoperability unlike single-implementation alternatives.

npm install myst-spec
INSTALL
IMPORT
SIG · MYST-SPEC
M
myst-spec
testingjavascriptv0.0.5
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.

Myst
import { Myst } from 'myst-spec'
const Myst = require('myst-spec')
Package is ESM-only; no CommonJS support. Exports TypeScript types.
type DirectiveNode
import type { DirectiveNode } from 'myst-spec'
import { DirectiveNode } from 'myst-spec'
Use import type for type-only imports to avoid bundling issues.
Heading
import { Heading } from 'myst-spec'
import { heading } from 'myst-spec'
Exports are PascalCase (e.g., Heading, Paragraph). Lowercase names are not exported.

Creates a MyST AST with a heading and paragraph using exported types.

import { Root, Heading, Paragraph, Text } from 'myst-spec'; const heading: Heading = { type: 'heading', depth: 1, children: [{ type: 'text', value: 'Hello World' } as Text] }; const paragraph: Paragraph = { type: 'paragraph', children: [{ type: 'text', value: 'This is a test.' } as Text] }; const doc: Root = { type: 'root', children: [heading, paragraph] }; console.log(JSON.stringify(doc, null, 2));
Debug
Known issues
breakingThe MyST AST specification is still in dev; any structures or features present in the JSON schema may change at any time without notice.
fix
Pin to a specific patch version and regularly update as spec stabilizes.
affects: >=0.0.1 <1.0.0
gotchaNo CommonJS support; all imports must use ESM syntax.
fix
Use import statements instead of require() and ensure your project is configured for ESM (e.g., type: 'module' in package.json).
affects: >=0.0.1
gotchaPackage does not export any runtime functions or values; only TypeScript types and JSON schemas.
fix
This is a type-only and schema package. Do not expect to import executable code.
affects: >=0.0.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/myst-spec/index.js from /path/to/file.js not supported.
Package is ESM-only; require() cannot be used.
fix
Convert to import syntax or use dynamic import() in a CommonJS context.
TypeError: myst_spec_1.Myst is not a constructor
Myst is a type, not a constructor or function.
fix
Use Myst as a type annotation only (e.g., const x: Myst = ...).
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
myst-spec — npm install myst-spec · libregistry