샘플
marked 18.0.5: marked
검증된 샘플 — npm marked 18.0.5: marked. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: marked exports marked function and parse, parseInline, lexer…
sha256:a045891bc008528e55d4eb19457fc54781d30223272d70c50ce3291e653d0ba4
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-28 |
케이스
HOW- 목표
- verify marked.marked in pkg:npm/marked@18.0.5
- 패키지
- 심벌
-
- marked.marked
- 생성일
- 2026-08-28T00:03:45Z
컨트랙트
- marked exports marked function and parse, parseInline, lexer, parser, use, and walkTokens methods
- marked parses markdown into HTML synchronously by default with heading and paragraph formatting
- marked.parseInline parses inline markdown without wrapping in block-level paragraph tags
- marked.lexer tokenizes markdown string into structured token objects
- marked.parser renders an array of token objects into an HTML string
- marked.walkTokens iterates over all token nodes in a token tree
- marked.use extends behavior with custom hooks
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 marked.marked in pkg:npm/marked@18.0.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/marked@18.0.5
Demonstrate these symbols/APIs:
- marked.marked
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:a7e15f9e2c97bacd5774bf56c866f4f99e59aee68efefa8020b4ccce47e36b21","contract":["marked exports marked function and parse, parseInline, lexer, parser, use, and walkTokens methods","marked parses markdown into HTML synchronously by default with heading and paragraph formatting","marked.parseInline parses inline markdown without wrapping in block-level paragraph tags","marked.lexer tokenizes markdown string into structured token objects","marked.parser renders an array of token objects into an HTML string","marked.walkTokens iterates over all token nodes in a token tree","marked.use extends behavior with custom hooks"],"goal":"verify marked.marked in pkg:npm/marked@18.0.5","kind":"HOW","packages":["pkg:npm/marked@18.0.5"],"schemaVersion":1,"symbols":["marked.marked"]},"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/marked@18.0.5"],"schemaVersion":1,"subject":"pkg:npm/marked@18.0.5","symbols":["marked.marked"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-marked-marked",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-marked-marked",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"marked": "18.0.5"
}
},
"node_modules/marked": {
"version": "18.0.5",
"resolved": "https://registry.npmjs.org/marked/-/marked-18.0.5.tgz",
"integrity": "sha512-S6GcvALHg6K4ohtu4E7x0a1AqhAjp6cV8KhLSyN9qVapnzJkusVBxZRcIU9AeYsbe6P1hKDusSbEOzGyyuce6w==",
"license": "MIT",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 20"
}
}
}
}
{
"name": "sample-marked-marked",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"main": "src/index.js",
"dependencies": {
"marked": "18.0.5"
}
}
{
"schemaVersion": 1,
"goal": "verify marked.marked in pkg:npm/marked@18.0.5",
"kind": "HOW",
"packages": [
"pkg:npm/marked@18.0.5"
],
"symbols": [
"marked.marked"
]
}
const { marked } = require('marked');
/**
* Parses markdown string to HTML using marked.
*
* @param {string} src - Markdown input string.
* @param {object} [options] - Parsing options.
* @returns {string|Promise<string>} Parsed HTML string (or Promise if async).
*/
function parseMarkdown(src, options) {
return marked(src, options);
}
/**
* Parses inline markdown tokens without wrapping with paragraph tags.
*
* @param {string} src - Inline markdown string.
* @param {object} [options] - Parsing options.
* @returns {string} Inline HTML string.
*/
function parseInlineMarkdown(src, options) {
return marked.parseInline(src, options);
}
/**
* Tokenizes markdown source into structured token nodes.
*
* @param {string} src - Markdown input string.
* @param {object} [options] - Lexer options.
* @returns {Array<object>} Array of parsed token objects.
*/
function tokenizeMarkdown(src, options) {
return marked.lexer(src, options);
}
/**
* Compiles a token list back into HTML output.
*
* @param {Array<object>} tokens - Array of token objects.
* @param {object} [options] - Parser options.
* @returns {string} Compiled HTML string.
*/
function parseTokens(tokens, options) {
return marked.parser(tokens, options);
}
/**
* Configures marked instance with extensions or options.
*
* @param {...object} extensions - Extensions or options to apply.
* @returns {typeof marked} The marked instance.
*/
function configureMarked(...extensions) {
return marked.use(...extensions);
}
module.exports = {
marked,
parseMarkdown,
parseInlineMarkdown,
tokenizeMarkdown,
parseTokens,
configureMarked
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
marked,
parseMarkdown,
parseInlineMarkdown,
tokenizeMarkdown,
parseTokens,
configureMarked
} = require('../src/index.js');
const markedModule = require('marked');
// 1. Verify marked export and member methods
assert.equal(typeof marked, 'function', 'marked must be a function');
assert.strictEqual(marked, markedModule.marked, 'marked export must match marked.marked from the package');
assert.strictEqual(marked, markedModule.parse, 'marked function must equal marked.parse');
assert.equal(typeof marked.parse, 'function', 'marked.parse must be a function');
assert.equal(typeof marked.parseInline, 'function', 'marked.parseInline must be a function');
assert.equal(typeof marked.lexer, 'function', 'marked.lexer must be a function');
assert.equal(typeof marked.parser, 'function', 'marked.parser must be a function');
assert.equal(typeof marked.use, 'function', 'marked.use must be a function');
assert.equal(typeof marked.walkTokens, 'function', 'marked.walkTokens must be a function');
// 2. marked parses markdown into HTML synchronously by default with heading and paragraph formatting
const markdownInput = '# Main Title\n\nThis is a paragraph with **bold** text and *italic* text.';
const renderedHtml = marked(markdownInput);
assert.equal(typeof renderedHtml, 'string', 'marked output must be a string');
assert.ok(renderedHtml.includes('<h1>Main Title</h1>'), 'rendered HTML must contain <h1>Main Title</h1>');
assert.ok(
renderedHtml.includes('<p>This is a paragraph with <strong>bold</strong> text and <em>italic</em> text.</p>'),
'rendered HTML must contain formatted paragraph'
);
const helperRendered = parseMarkdown(markdownInput);
assert.equal(helperRendered, renderedHtml, 'parseMarkdown helper must produce identical HTML');
// 3. marked.parseInline parses inline markdown without wrapping in block-level paragraph tags
const inlineInput = '**Bold statement** and [Link](https://example.com)';
const inlineOutput = marked.parseInline(inlineInput);
assert.equal(typeof inlineOutput, 'string', 'parseInline output must be a string');
assert.ok(inlineOutput.includes('<strong>Bold statement</strong>'), 'parseInline must render bold tags');
assert.ok(inlineOutput.includes('<a href="https://example.com">Link</a>'), 'parseInline must render anchor tags');
assert.ok(!inlineOutput.includes('<p>'), 'parseInline must not wrap content in paragraph tags');
const helperInline = parseInlineMarkdown(inlineInput);
assert.equal(helperInline, inlineOutput, 'parseInlineMarkdown helper must match marked.parseInline output');
// 4. marked.lexer tokenizes markdown string into structured token objects
const complexMarkdown = '# Section Heading\n\nParagraph text.\n\n- Item 1\n- Item 2';
const tokens = marked.lexer(complexMarkdown);
assert.ok(Array.isArray(tokens), 'lexer must return an array of tokens');
assert.equal(tokens[0].type, 'heading', 'first token must be heading');
assert.equal(tokens[0].depth, 1, 'heading depth must be 1');
assert.equal(tokens[0].text, 'Section Heading', 'heading text must match');
assert.equal(tokens[1].type, 'space', 'second token must be space');
assert.equal(tokens[2].type, 'paragraph', 'third token must be paragraph');
assert.equal(tokens[4].type, 'list', 'fifth token must be list');
assert.equal(tokens[4].items.length, 2, 'list must contain 2 items');
const helperTokens = tokenizeMarkdown(complexMarkdown);
assert.deepEqual(helperTokens, tokens, 'tokenizeMarkdown helper must match marked.lexer output');
// 5. marked.parser renders an array of token objects into an HTML string
const htmlFromTokens = marked.parser(tokens);
assert.equal(typeof htmlFromTokens, 'string', 'parser output must be a string');
assert.ok(htmlFromTokens.includes('<h1>Section Heading</h1>'), 'parsed tokens must include heading');
assert.ok(htmlFromTokens.includes('<p>Paragraph text.</p>'), 'parsed tokens must include paragraph');
assert.ok(htmlFromTokens.includes('<ul>'), 'parsed tokens must include unordered list');
assert.ok(htmlFromTokens.includes('<li>Item 1</li>'), 'parsed tokens must include list items');
const helperParsedTokens = parseTokens(tokens);
assert.equal(helperParsedTokens, htmlFromTokens, 'parseTokens helper must match marked.parser output');
// 6. marked.walkTokens iterates over all token nodes in a token tree
const visitedTypes = [];
marked.walkTokens(tokens, (token) => {
visitedTypes.push(token.type);
});
assert.ok(visitedTypes.includes('heading'), 'walkTokens must visit heading token');
assert.ok(visitedTypes.includes('paragraph'), 'walkTokens must visit paragraph token');
assert.ok(visitedTypes.includes('list'), 'walkTokens must visit list token');
assert.ok(visitedTypes.includes('list_item'), 'walkTokens must visit nested list items');
// 7. marked.use extends behavior with custom hooks
configureMarked({
hooks: {
postprocess(html) {
return html.trim() + '\n<!-- verified -->';
}
}
});
const hookedOutput = marked('# Hook Test');
assert.ok(hookedOutput.includes('<h1>Hook Test</h1>'), 'hooked output must contain heading');
assert.ok(hookedOutput.endsWith('<!-- verified -->'), 'postprocess hook must append comment');
console.log('Contract tests passed successfully.');
오리진 시더
익명