샘플
markdown-it 14.3.2
검증된 샘플 — npm markdown-it 14.3.2. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: markdown-it renders headings, paragraphs, and inline formatting…
sha256:6cd9b4bfb0966e1ef3d06753ab7d6d1ed3fc8f1b8ae2c1aac85c07392bfc38fc
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 |
케이스
HOW- 목표
- verify pkg:npm/markdown-it@14.3.2
- 생성일
- 2026-09-15T05:21:25Z
컨트랙트
- markdown-it renders headings, paragraphs, and inline formatting to HTML
- renderMarkdown formats unordered lists into HTML unordered list elements
- renderInline formats inline markdown without wrapping paragraph tags
- renderInlineMarkdown renders link markup without paragraph tags
- parseToTokens parses markdown into structured token stream with type, tag, and content
- zero preset disables inline formatting rules while preserving block paragraph structure
- commonmark preset parses strong emphasis
- markdown-it plugins customize rendering via use method
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
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 pkg:npm/markdown-it@14.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/markdown-it@14.3.2
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:1b87a1e1698411fb8f16839c4c424d0420b319dab2a5395b8815818acbd1fd7c","contract":["markdown-it renders headings, paragraphs, and inline formatting to HTML","renderMarkdown formats unordered lists into HTML unordered list elements","renderInline formats inline markdown without wrapping paragraph tags","renderInlineMarkdown renders link markup without paragraph tags","parseToTokens parses markdown into structured token stream with type, tag, and content","zero preset disables inline formatting rules while preserving block paragraph structure","commonmark preset parses strong emphasis","markdown-it plugins customize rendering via use method"],"goal":"verify pkg:npm/markdown-it@14.3.2","kind":"HOW","packages":["pkg:npm/markdown-it@14.3.2"],"schemaVersion":1},"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/markdown-it@14.3.2"],"schemaVersion":1,"subject":"pkg:npm/markdown-it@14.3.2","verifierAdapter":"node-typescript@1"}
const MarkdownIt = require('markdown-it');
/**
* Creates a configured markdown-it instance.
* @param {string|Object} [preset] - Preset name ('default', 'zero', 'commonmark') or options object.
* @param {Object} [options] - Configuration options if preset name was provided.
* @returns {MarkdownIt}
*/
function createParser(preset, options) {
return new MarkdownIt(preset, options);
}
/**
* Renders markdown text to HTML string.
* @param {string} src - Markdown source text.
* @param {Object} [options] - Parser options.
* @returns {string} Rendered HTML.
*/
function renderMarkdown(src, options) {
const md = new MarkdownIt(options);
return md.render(src);
}
/**
* Renders inline markdown text without wrapping block paragraph tags.
* @param {string} src - Markdown inline text.
* @param {Object} [options] - Parser options.
* @returns {string} Rendered inline HTML.
*/
function renderInlineMarkdown(src, options) {
const md = new MarkdownIt(options);
return md.renderInline(src);
}
/**
* Parses markdown source into a token stream array.
* @param {string} src - Markdown source text.
* @param {Object} [env] - Environment sandbox object.
* @returns {Array} Array of token objects.
*/
function parseToTokens(src, env = {}) {
const md = new MarkdownIt();
return md.parse(src, env);
}
module.exports = {
MarkdownIt,
createParser,
renderMarkdown,
renderInlineMarkdown,
parseToTokens,
};
{
"name": "sample-markdown-it",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-markdown-it",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"markdown-it": "14.3.2"
}
},
"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/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-markdown-it",
"version": "1.0.0",
"description": "Clean-room sample verifying pkg:npm/markdown-it@14.3.2 functionality",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"markdown-it": "14.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/markdown-it@14.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/markdown-it@14.3.2"
]
}
import assert from 'node:assert/strict';
import MarkdownIt from 'markdown-it';
import {
createParser,
renderMarkdown,
renderInlineMarkdown,
parseToTokens,
} from '../index.js';
// 1. Assert markdown-it renders markdown headings, paragraphs, lists and inline formatting to HTML
const defaultMd = new MarkdownIt();
const renderedHtml = defaultMd.render('# Heading 1\n\nParagraph with **bold** and *italic* text.');
assert.equal(
renderedHtml,
'<h1>Heading 1</h1>\n<p>Paragraph with <strong>bold</strong> and <em>italic</em> text.</p>\n',
'markdown-it must render headings, paragraphs, and inline formatting to HTML'
);
const listHtml = renderMarkdown('- item A\n- item B\n');
assert.equal(
listHtml,
'<ul>\n<li>item A</li>\n<li>item B</li>\n</ul>\n',
'renderMarkdown must format unordered lists into HTML unordered list elements'
);
// 2. Assert markdown-it renderInline formats inline tokens without wrapping paragraph tags
const inlineResult = defaultMd.renderInline('Inline **bold** and `code` span');
assert.equal(
inlineResult,
'Inline <strong>bold</strong> and <code>code</code> span',
'renderInline must format inline markdown without wrapping <p> tags'
);
const inlineLink = renderInlineMarkdown('[CodeSampleX](https://example.com)');
assert.equal(
inlineLink,
'<a href="https://example.com">CodeSampleX</a>',
'renderInlineMarkdown must render link markup without paragraph tags'
);
// 3. Assert markdown-it parses markdown input into structured token stream with type, tag, and content
const tokens = parseToTokens('# Section Title\n\nBody paragraph');
assert.ok(Array.isArray(tokens), 'parseToTokens must return an array of tokens');
assert.ok(tokens.length >= 4, 'Token array must contain heading and paragraph tokens');
assert.equal(tokens[0].type, 'heading_open', 'First token must be heading_open');
assert.equal(tokens[0].tag, 'h1', 'Heading tag must be h1');
assert.equal(tokens[1].type, 'inline', 'Second token must be inline');
assert.equal(tokens[1].content, 'Section Title', 'Inline token content must match heading title');
assert.equal(tokens[2].type, 'heading_close', 'Third token must be heading_close');
assert.equal(tokens[3].type, 'paragraph_open', 'Fourth token must be paragraph_open');
// 4. Assert markdown-it supports zero and commonmark presets to control parsing rules
const zeroParser = createParser('zero');
assert.equal(
zeroParser.render('**text** and *italic*'),
'<p>**text** and *italic*</p>\n',
'zero preset must disable inline formatting rules while preserving block paragraph structure'
);
const commonmarkParser = createParser('commonmark');
const cmHtml = commonmarkParser.render('__strong text__');
assert.ok(
cmHtml.includes('<strong>strong text</strong>'),
'commonmark preset must parse strong emphasis'
);
// 5. Assert markdown-it plugin architecture enables custom rendering rules via use method
function samplePlugin(md, options) {
const defaultFence = md.renderer.rules.fence || function (tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.fence = function (tokens, idx, opts, env, self) {
const token = tokens[idx];
if (token.info.trim() === 'callout') {
const cls = (options && options.cssClass) || 'notice';
return `<aside class="${cls}">${token.content}</aside>\n`;
}
return defaultFence(tokens, idx, opts, env, self);
};
}
const customMd = new MarkdownIt();
customMd.use(samplePlugin, { cssClass: 'custom-callout' });
const pluginOutput = customMd.render('```callout\nImportant note\n```');
assert.equal(
pluginOutput,
'<aside class="custom-callout">Important note\n</aside>\n',
'markdown-it plugins must customize rendering via use method'
);
오리진 시더
익명