Sample
prosemirror-markdown 1.13.7: MarkdownParser
Verified sample for npm prosemirror-markdown 1.13.7: MarkdownParser. The contract ran on node 22 · linux debian/x64 · docker and passed.
sha256:f64febe2c33836896719b17f491fdf446ad06c396fbb3b824e0ea61867c3e8b1
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-15 |
Case
HOW- Goal
- verify prosemirror-markdown.MarkdownParser in pkg:npm/prosemirror-markdown@1.13.7
- Packages
- Symbols
-
- prosemirror-markdown.MarkdownParser
- Created
- 2026-09-15T06:58:54Z
Contract
- MarkdownParser is exported as a constructor and defaultMarkdownParser is an instance of MarkdownParser
- MarkdownParser parses CommonMark headings and paragraphs into ProseMirror document nodes
- MarkdownParser parses inline formatting marks including strong, em, and code
- MarkdownParser parses container block structures including blockquotes and bullet lists
- custom MarkdownParser instance parses markdown using custom tokenizer and token mapping specifications
- MarkdownParser parses empty and whitespace input into a valid empty ProseMirror document
Files
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify prosemirror-markdown.MarkdownParser in pkg:npm/prosemirror-markdown@1.13.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/prosemirror-markdown@1.13.7
Demonstrate these symbols/APIs:
- prosemirror-markdown.MarkdownParser
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:48526a7b4e8fe0fa51bb59ca5abb94bff4dee791158a8c4e771596a22421cd88","contract":["MarkdownParser is exported as a constructor and defaultMarkdownParser is an instance of MarkdownParser","MarkdownParser parses CommonMark headings and paragraphs into ProseMirror document nodes","MarkdownParser parses inline formatting marks including strong, em, and code","MarkdownParser parses container block structures including blockquotes and bullet lists","custom MarkdownParser instance parses markdown using custom tokenizer and token mapping specifications","MarkdownParser parses empty and whitespace input into a valid empty ProseMirror document"],"goal":"verify prosemirror-markdown.MarkdownParser in pkg:npm/prosemirror-markdown@1.13.7","kind":"HOW","packages":["pkg:npm/prosemirror-markdown@1.13.7"],"schemaVersion":1,"symbols":["prosemirror-markdown.MarkdownParser"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/prosemirror-markdown@1.13.7"],"schemaVersion":1,"subject":"pkg:npm/prosemirror-markdown@1.13.7","symbols":["prosemirror-markdown.MarkdownParser"],"verifierAdapter":"node-typescript@1"}
import { MarkdownParser, defaultMarkdownParser, schema } from 'prosemirror-markdown';
/**
* Parses markdown text into a ProseMirror Node using the provided parser (or defaultMarkdownParser).
*
* @param {string} markdown - The markdown string to parse.
* @param {MarkdownParser} [parser] - Optional MarkdownParser instance.
* @returns {import('prosemirror-model').Node} The parsed document node.
*/
export function parseMarkdown(markdown, parser = defaultMarkdownParser) {
return parser.parse(markdown);
}
/**
* Creates a custom MarkdownParser instance with the given schema, tokenizer, and tokens mapping.
*
* @param {object} [options] - Custom parser configuration.
* @param {import('prosemirror-model').Schema} [options.schema] - ProseMirror schema.
* @param {any} [options.tokenizer] - Markdown tokenizer instance.
* @param {Record<string, any>} [options.tokens] - Token mapping specifications.
* @returns {MarkdownParser} The configured MarkdownParser instance.
*/
export function createCustomMarkdownParser(options = {}) {
const customSchema = options.schema || schema;
const tokenizer = options.tokenizer || defaultMarkdownParser.tokenizer;
const tokens = options.tokens || {
paragraph: { block: 'paragraph' },
heading: { block: 'heading', getAttrs: (tok) => ({ level: +tok.tag.slice(1) }) },
em: { mark: 'em' },
strong: { mark: 'strong' },
};
return new MarkdownParser(customSchema, tokenizer, tokens);
}
export { MarkdownParser, defaultMarkdownParser, schema };
{
"name": "sample-prosemirror-markdown-parser",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-prosemirror-markdown-parser",
"version": "1.0.0",
"dependencies": {
"prosemirror-markdown": "1.13.7"
}
},
"node_modules/@types/linkify-it": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
"license": "MIT"
},
"node_modules/@types/markdown-it": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.2.0.tgz",
"integrity": "sha512-NoQ2yGlLWj4wpxMs+TYmRKk3thDrQ97agr7sFqfLsAlvoS8SNQuTrlObhFqG9iugdTtgOE9jpJ6FNM4ZGsa5xQ==",
"license": "MIT",
"dependencies": {
"@types/linkify-it": "^5",
"@types/mdurl": "^2"
}
},
"node_modules/@types/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==",
"license": "MIT"
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
},
"node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/linkify-it": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz",
"integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/markdown-it"
}
],
"license": "MIT",
"dependencies": {
"uc.micro": "^2.0.0"
}
},
"node_modules/markdown-it": {
"version": "14.3.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.2.tgz",
"integrity": "sha512-sHHjZ5fJKlgrG4qns2YwVcdNep35h5fERrfkD2YNsb9UFk0UIHarbiTaHKVMlPuWAoiilyK8Fv/jAm11slsY7Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/markdown-it"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1",
"entities": "^4.5.0",
"linkify-it": "^5.0.2",
"mdurl": "^2.0.0",
"punycode.js": "^2.3.1",
"uc.micro": "^2.1.0"
},
"bin": {
"markdown-it": "bin/markdown-it.mjs"
}
},
"node_modules/mdurl": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.1.0.tgz",
"integrity": "sha512-1+HBaOx0zi/dQWht8rNv9MYf9qqpqL/kxI0hXImU6Y547zM6Sni8BQibt7ifgMcYtQg41ao3Ivd6cnSM86inpg==",
"license": "MIT"
},
"node_modules/orderedmap": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz",
"integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==",
"license": "MIT"
},
"node_modules/prosemirror-markdown": {
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/prosemirror-markdown/-/prosemirror-markdown-1.13.7.tgz",
"integrity": "sha512-NV57Oxe3fXR+bNGXS5XW4sKt/XGIyY3n0eHVUoJORcismeF4FFMpLBnl0YESy2BvJQHloexX+9P+zT3VqFj/CQ==",
"license": "MIT",
"dependencies": {
"@types/markdown-it": "^14.0.0",
"markdown-it": "^14.0.0",
"prosemirror-model": "^1.25.0"
}
},
"node_modules/prosemirror-model": {
"version": "1.25.11",
"resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.11.tgz",
"integrity": "sha512-QWg9RhnpLlogAmp3p96uEFrE5txQpFynd4vhBAELkwgOCWQs/X0yCzB3/hrHqiPwf91RG5KyWq6553zs9JqIOQ==",
"license": "MIT",
"dependencies": {
"orderedmap": "^2.0.0"
}
},
"node_modules/punycode.js": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/uc.micro": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
"license": "MIT"
}
}
}
{
"name": "sample-prosemirror-markdown-parser",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"prosemirror-markdown": "1.13.7"
}
}
{
"schemaVersion": 1,
"goal": "verify prosemirror-markdown.MarkdownParser in pkg:npm/prosemirror-markdown@1.13.7",
"kind": "HOW",
"packages": [
"pkg:npm/prosemirror-markdown@1.13.7"
],
"symbols": [
"prosemirror-markdown.MarkdownParser"
]
}
import assert from 'node:assert/strict';
import {
MarkdownParser,
defaultMarkdownParser,
schema,
parseMarkdown,
createCustomMarkdownParser,
} from '../index.mjs';
// 1. MarkdownParser is exported as a constructor and defaultMarkdownParser is an instance of MarkdownParser
{
assert.equal(typeof MarkdownParser, 'function', 'MarkdownParser must be a constructor function');
assert.ok(defaultMarkdownParser instanceof MarkdownParser, 'defaultMarkdownParser must be an instance of MarkdownParser');
assert.equal(typeof defaultMarkdownParser.parse, 'function', 'defaultMarkdownParser.parse must be a function');
assert.ok(defaultMarkdownParser.schema, 'defaultMarkdownParser must hold a schema');
assert.ok(defaultMarkdownParser.tokenizer, 'defaultMarkdownParser must hold a tokenizer');
assert.ok(defaultMarkdownParser.tokens, 'defaultMarkdownParser must hold token specs');
}
// 2. MarkdownParser parses CommonMark headings and paragraphs into ProseMirror document nodes
{
const markdown = '# Heading 1\n\n## Subheading 2\n\nStandard paragraph content.';
const doc = parseMarkdown(markdown);
assert.ok(doc, 'Parsed doc must not be null');
assert.equal(doc.type.name, 'doc', 'Root node must be doc');
assert.equal(doc.childCount, 3, 'Document must contain three top-level children');
const h1 = doc.child(0);
assert.equal(h1.type.name, 'heading');
assert.equal(h1.attrs.level, 1);
assert.equal(h1.textContent, 'Heading 1');
const h2 = doc.child(1);
assert.equal(h2.type.name, 'heading');
assert.equal(h2.attrs.level, 2);
assert.equal(h2.textContent, 'Subheading 2');
const p = doc.child(2);
assert.equal(p.type.name, 'paragraph');
assert.equal(p.textContent, 'Standard paragraph content.');
}
// 3. MarkdownParser parses inline formatting marks including strong, em, and code
{
const markdown = 'Here is **strong**, *emphasized*, and `inline code`.';
const doc = parseMarkdown(markdown);
const paragraph = doc.child(0);
let hasStrong = false;
let hasEm = false;
let hasCode = false;
paragraph.forEach((child) => {
for (const mark of child.marks) {
if (mark.type.name === 'strong' && child.text === 'strong') {
hasStrong = true;
}
if (mark.type.name === 'em' && child.text === 'emphasized') {
hasEm = true;
}
if (mark.type.name === 'code' && child.text === 'inline code') {
hasCode = true;
}
}
});
assert.ok(hasStrong, 'Expected strong mark on "strong"');
assert.ok(hasEm, 'Expected em mark on "emphasized"');
assert.ok(hasCode, 'Expected code mark on "inline code"');
}
// 4. MarkdownParser parses container block structures including blockquotes and bullet lists
{
const markdown = '> Quoted block content\n\n- first item\n- second item';
const doc = parseMarkdown(markdown);
assert.equal(doc.childCount, 2, 'Document should have 2 children');
const blockquote = doc.child(0);
assert.equal(blockquote.type.name, 'blockquote');
assert.equal(blockquote.child(0).type.name, 'paragraph');
assert.equal(blockquote.child(0).textContent, 'Quoted block content');
const list = doc.child(1);
assert.equal(list.type.name, 'bullet_list');
assert.equal(list.childCount, 2);
assert.equal(list.child(0).type.name, 'list_item');
assert.equal(list.child(0).child(0).textContent, 'first item');
assert.equal(list.child(1).type.name, 'list_item');
assert.equal(list.child(1).child(0).textContent, 'second item');
}
// 5. custom MarkdownParser instance parses markdown using custom tokenizer and token mapping specifications
{
const customTokens = {
paragraph: { block: 'paragraph' },
heading: { block: 'heading', getAttrs: (tok) => ({ level: +tok.tag.slice(1) }) },
em: { mark: 'em' },
strong: { mark: 'strong' },
};
const customParser = createCustomMarkdownParser({ tokens: customTokens });
assert.ok(customParser instanceof MarkdownParser, 'customParser must be an instance of MarkdownParser');
const customDoc = customParser.parse('# Custom Title\n\nCustom **bold** text.');
assert.equal(customDoc.type.name, 'doc');
assert.equal(customDoc.childCount, 2);
assert.equal(customDoc.child(0).type.name, 'heading');
assert.equal(customDoc.child(0).attrs.level, 1);
assert.equal(customDoc.child(0).textContent, 'Custom Title');
assert.equal(customDoc.child(1).type.name, 'paragraph');
}
// 6. MarkdownParser parses empty and whitespace input into a valid empty ProseMirror document
{
const emptyDoc = parseMarkdown('');
assert.ok(emptyDoc, 'Empty document must be produced');
assert.equal(emptyDoc.type.name, 'doc');
assert.equal(emptyDoc.childCount, 1);
assert.equal(emptyDoc.child(0).type.name, 'paragraph');
assert.equal(emptyDoc.child(0).textContent, '');
const whitespaceDoc = parseMarkdown(' \n\n ');
assert.ok(whitespaceDoc, 'Whitespace document must be produced');
assert.equal(whitespaceDoc.type.name, 'doc');
assert.equal(whitespaceDoc.childCount, 1);
assert.equal(whitespaceDoc.child(0).textContent, '');
}
console.log('All prosemirror-markdown MarkdownParser contract tests passed successfully.');
Origin Seeder
anonymous