サンプル
Handle modern marked custom renderer methods receiving a single token object instead of legacy positional primitive arguments
sha256:4026c7f4aa5bbe2dc885c538a92bdebf44cab658dca80b98f525a9b5c121ea76
PUBLISHED
L3_CONTRACT_PASS
MIT-0
ケース
- ゴール
- Handle modern marked custom renderer methods receiving a single token object instead of legacy positional primitive arguments HOW
- パッケージ
- marked 18.0.9
- 環境
- node
- 作成日
- 2026-08-16T18:45:29Z
よくある思い込み
Custom renderer methods in marked receive positional primitive arguments like heading(text, level) and link(href, title, text) with child tokens pre-rendered into HTML strings.
このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。
コントラクト
- Overriding a custom renderer method with legacy positional parameters like heading(text, level) passes the AST token object as the first parameter and undefined as the second, silently rendering undefined and object Object in place of tag attributes and text
- Legacy link renderer with signature link(href, title, text) receives the token object in href and undefined in title and text, silently producing href='[object Object]' and text 'undefined'
- Legacy paragraph renderer with signature paragraph(text) receives the paragraph token object instead of pre-rendered HTML text string
- Legacy code renderer with signature code(code, lang) receives the code token object in code and undefined in lang
- Modern custom renderers must accept a single token parameter and explicitly invoke this.parser.parseInline(token.tokens) to render inline content
- Modern custom renderers access token metadata via token.depth, token.href, token.title, and token.lang properties on the token object
ファイル
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
検証済みアーティファクトをダウンロード (tar.gz) — 契約が実行された正確なバイト列
オリジンシーダー
検証レシート
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9