샘플
github.com/russross/blackfriday/v2 v2.1.0: blackfriday.Run
검증된 샘플 — golang github.com/russross/blackfriday/v2 v2.1.0: blackfriday.Run. go 1.26 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:75d693324904db2f672734f0c381392e7a8e81b034887e8c428171f9b4088979
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
go linux 24 · ubuntu · glibc 2.39 x64 go go go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-02 |
케이스
HOW- 목표
- verify blackfriday.Run in pkg:golang/github.com/russross/blackfriday/v2@v2.1.0
- 심벌
-
- blackfriday.Run
- 환경
- go
- 생성일
- 2026-09-02T07:49:44Z
컨트랙트
- blackfriday.Run converts standard markdown input into HTML bytes including headings, bold, and italic text.
- blackfriday.Run with WithExtensions(CommonExtensions) enables extensions such as tables, strikethrough, and autolinks.
- blackfriday.Run with WithRenderer and HrefTargetBlank flag renders links with target="_blank".
- blackfriday.Run with WithNoExtensions disables markdown extensions and treats syntax characters literally.
- blackfriday.Run safely handles nil, empty, and whitespace-only byte slice inputs returning empty output.
파일
- NOTES.md
- PROMPT.md
- blackfriday_test.go
- csx.json
- go.mod
- go.sum
- spec.json
소스
# Blackfriday Markdown to HTML Rendering
A search for `blackfriday.Run` in `github.com/russross/blackfriday/v2@v2.1.0` required verification against the target package version.
This sample verifies markdown parsing and HTML rendering behavior using `blackfriday.Run` with various option configurations.
## Observed Behavior
1. **Basic Markdown to HTML Conversion (`blackfriday.Run`)**:
- `blackfriday.Run(input []byte)` converts markdown input into HTML byte slice, rendering standard markdown elements such as headings, bold, and italic text.
2. **Extensions Configuration (`blackfriday.WithExtensions`)**:
- Passing `blackfriday.WithExtensions(...)` allows configuring extensions such as `blackfriday.CommonExtensions` (enabling tables, strikethrough, autolinks, and fenced code blocks).
3. **Custom HTML Renderer Configuration (`blackfriday.WithRenderer`)**:
- `blackfriday.WithRenderer(blackfriday.NewHTMLRenderer(params))` allows fine-grained customization of HTML generation, including flags like `blackfriday.HrefTargetBlank` which injects `target="_blank"` attributes on rendered links.
4. **Disabling Extensions (`blackfriday.WithNoExtensions`)**:
- Passing `blackfriday.WithNoExtensions()` disables all markdown extension parsing, treating syntax like `~~text~~` as literal characters rather than strikethrough HTML tags.
5. **Empty and Nil Input Handling**:
- Calling `blackfriday.Run(nil)` or `blackfriday.Run([]byte(""))` safely returns an empty byte slice without panicking or allocating unneeded buffers.
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 blackfriday.Run in pkg:golang/github.com/russross/blackfriday/v2@v2.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/russross/blackfriday/v2@v2.1.0
Demonstrate these symbols/APIs:
- blackfriday.Run
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.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.
package blackfridaydemo_test
import (
"bytes"
"strings"
"testing"
"github.com/russross/blackfriday/v2"
)
// TestBlackfridayRunBasicMarkdown verifies blackfriday.Run converts standard markdown to HTML bytes.
func TestBlackfridayRunBasicMarkdown(t *testing.T) {
input := []byte("# Hello World\n\nThis is **bold** and *italic* text.")
output := blackfriday.Run(input)
outputStr := string(output)
if !strings.Contains(outputStr, "<h1>Hello World</h1>") {
t.Errorf("expected <h1>Hello World</h1> in output, got %q", outputStr)
}
if !strings.Contains(outputStr, "<strong>bold</strong>") {
t.Errorf("expected <strong>bold</strong> in output, got %q", outputStr)
}
if !strings.Contains(outputStr, "<em>italic</em>") {
t.Errorf("expected <em>italic</em> in output, got %q", outputStr)
}
}
// TestBlackfridayRunWithExtensions verifies blackfriday.Run with WithExtensions enables tables, strikethrough, and autolink.
func TestBlackfridayRunWithExtensions(t *testing.T) {
tableInput := []byte("| Header 1 | Header 2 |\n|---|---|\n| Cell 1 | Cell 2 |\n\n~~deleted text~~\n\nhttps://example.com")
// Blackfriday default Run uses CommonExtensions (which includes Tables, Strikethrough, Autolink, etc.)
output := blackfriday.Run(tableInput, blackfriday.WithExtensions(blackfriday.CommonExtensions))
outputStr := string(output)
if !strings.Contains(outputStr, "<table>") || !strings.Contains(outputStr, "<td>Cell 1</td>") {
t.Errorf("expected table rendering in output, got %q", outputStr)
}
if !strings.Contains(outputStr, "<del>deleted text</del>") {
t.Errorf("expected strikethrough <del> in output, got %q", outputStr)
}
if !strings.Contains(outputStr, `<a href="https://example.com">https://example.com</a>`) {
t.Errorf("expected autolink in output, got %q", outputStr)
}
}
// TestBlackfridayRunWithRenderer verifies blackfriday.Run accepts custom HTML renderer parameters.
func TestBlackfridayRunWithRenderer(t *testing.T) {
input := []byte("[Example](https://example.com)")
renderer := blackfriday.NewHTMLRenderer(blackfriday.HTMLRendererParameters{
Flags: blackfriday.HrefTargetBlank,
})
output := blackfriday.Run(input, blackfriday.WithRenderer(renderer))
outputStr := string(output)
if !strings.Contains(outputStr, `target="_blank"`) {
t.Errorf("expected target=\"_blank\" in rendered link, got %q", outputStr)
}
}
// TestBlackfridayRunWithNoExtensions verifies blackfriday.Run with WithNoExtensions ignores markdown extensions.
func TestBlackfridayRunWithNoExtensions(t *testing.T) {
input := []byte("~~not deleted~~")
output := blackfriday.Run(input, blackfriday.WithNoExtensions())
outputStr := string(output)
if strings.Contains(outputStr, "<del>") {
t.Errorf("expected no <del> tag with WithNoExtensions, got %q", outputStr)
}
if !strings.Contains(outputStr, "~~not deleted~~") {
t.Errorf("expected literal tildes in output, got %q", outputStr)
}
}
// TestBlackfridayRunEmptyAndNilInput verifies blackfriday.Run gracefully handles empty and nil byte slices.
func TestBlackfridayRunEmptyAndNilInput(t *testing.T) {
nilOutput := blackfriday.Run(nil)
if len(nilOutput) != 0 {
t.Errorf("expected empty output for nil input, got %q", string(nilOutput))
}
emptyOutput := blackfriday.Run([]byte(""))
if len(emptyOutput) != 0 {
t.Errorf("expected empty output for empty slice input, got %q", string(emptyOutput))
}
whitespaceOutput := blackfriday.Run([]byte(" \n\n \t "))
trimmed := bytes.TrimSpace(whitespaceOutput)
if len(trimmed) != 0 {
t.Errorf("expected empty trimmed output for whitespace input, got %q", string(whitespaceOutput))
}
}
{"case":{"caseId":"case:sha256:e38e3ca28685be247f8e14b4c224799ce2e0a4023ba7e341007c9ddab19571db","contract":["blackfriday.Run converts standard markdown input into HTML bytes including headings, bold, and italic text.","blackfriday.Run with WithExtensions(CommonExtensions) enables extensions such as tables, strikethrough, and autolinks.","blackfriday.Run with WithRenderer and HrefTargetBlank flag renders links with target=\"_blank\".","blackfriday.Run with WithNoExtensions disables markdown extensions and treats syntax characters literally.","blackfriday.Run safely handles nil, empty, and whitespace-only byte slice inputs returning empty output."],"goal":"verify blackfriday.Run in pkg:golang/github.com/russross/blackfriday/v2@v2.1.0","kind":"HOW","packages":["pkg:golang/github.com/russross/blackfriday/v2@v2.1.0"],"schemaVersion":1,"symbols":["blackfriday.Run"]},"contractCommand":["go","test","./..."],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","executionContext":"go","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","runtime":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/russross/blackfriday/v2@v2.1.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/russross/blackfriday/v2@v2.1.0","symbols":["blackfriday.Run"],"verifierAdapter":"golang@1"}
module example.com/blackfridaydemo
go 1.23
require github.com/russross/blackfriday/v2 v2.1.0
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
{
"schemaVersion": 1,
"goal": "verify blackfriday.Run in pkg:golang/github.com/russross/blackfriday/v2@v2.1.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/russross/blackfriday/v2@v2.1.0"
],
"symbols": [
"blackfriday.Run"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
오리진 시더
익명