goldmark

A CommonMark-compliant Markdown parser and renderer for Go, built around a walkable AST and pluggable extensions.

Library
Go
vv1.8.6
5,056 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 92
Maintenance 100
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 88
Code Quality 90
Innovation 78
Learning Curve 70

goldmark is a pure-Go Markdown parser and HTML renderer that fully implements the CommonMark specification while staying easy to extend. Rather than converting text directly to output, it builds an intermediate AST that preserves source positions, so callers can inspect, transform, or re-render the parsed document before it becomes HTML.

Every stage of the pipeline is a set of prioritized, swappable components: block parsers, inline parsers, paragraph transformers, AST transformers, and node renderers are all registered as ordered lists, so third-party extensions can slot new syntax (custom node kinds, new inline delimiters, new renderer funcs) in alongside the built-ins without forking the library. It ships built-in extensions for GitHub Flavored Markdown (tables, strikethrough, autolinks, task lists), PHP Markdown Extra style definition lists and footnotes, a typographer for smart punctuation, and CJK-aware line breaking.

By default goldmark does not render raw HTML or unsafe URLs, leaving that decision explicit via renderer options, and it is validated against the full CommonMark spec test suite plus Go’s native fuzzer. It has become the de facto Markdown engine for a large share of the Go ecosystem, including Hugo.

What You Get

  • A CommonMark 0.31.2-compliant block and inline parser producing a walkable, position-preserving AST
  • A default HTML renderer plus a renderer.NodeRenderer interface for building renderers to other formats
  • Built-in GFM extensions: tables, strikethrough, autolinks (linkify), and task lists, bundled as extension.GFM
  • Definition lists and footnotes matching PHP Markdown Extra syntax
  • A typographer extension for smart quotes/dashes and a CJK extension for East Asian line-breaking rules
  • Priority-ordered extension points for adding custom block parsers, inline parsers, paragraph/AST transformers, and node renderers
  • Heading attribute syntax ({#id .class attr=value}) via parser.WithAttribute
  • Safe-by-default HTML output that strips raw HTML and dangerous URLs unless explicitly opted into

Common Use Cases

  • Static site generators - converting Markdown content files to HTML at build time with GFM-flavored tables and task lists
  • Documentation tooling - rendering README/docs Markdown into HTML with custom heading IDs and sanitized output for embedding in a web UI
  • Custom Markdown dialects - adding project-specific inline syntax (e.g. @mentions, custom shortcodes) by registering new inline parsers and AST node kinds
  • Non-HTML rendering - walking the parsed AST to emit PDF, plain text, or another markup format instead of HTML by swapping in a custom NodeRenderer
  • Comment/wiki systems - parsing untrusted user Markdown safely by default (no raw HTML passthrough) while selectively allowing GFM extensions

Under The Hood

Architecture

goldmark separates conversion into three composable stages wired together by the Markdown interface in markdown.go: a parser.Parser that turns a text.Reader into an ast.Node tree, and a renderer.Renderer that walks that tree to produce output. Both the parser and renderer are built from util.PrioritizedSlice registries — block parsers, inline parsers, paragraph transformers, AST transformers, and node renderers are all registered with numeric priorities (e.g. util.Prioritized(html.NewRenderer(), 1000)), so ordering and precedence between built-in and third-party components is explicit and deterministic rather than hardcoded. Extensions implement a single Extend(Markdown) method (see extension/gfm.go, extension/footnote.go) and hook themselves into any of these registries, which is what lets extension.GFM bundle four independent extensions (Table, Strikethrough, Linkify, TaskList) without any special-casing in the core. The ast package defines node kinds as an interface hierarchy (ast/block.go, ast/inline.go) rather than concrete structs, which is the specific design choice that makes external packages able to define wholly new node types goldmark itself never anticipated.

Tech Stack

goldmark is written in pure Go (module github.com/yuin/goldmark, Go 1.22+ per CI, though go.mod in this snapshot targets a newer toolchain) with zero runtime dependencies outside the standard library — the entire parser, AST, renderer, and extension set is self-contained across the ast, parser, renderer (with an html subpackage), text, and util packages. util/html5entities.gen.go and util/unicode_case_folding.gen.go are code-generated tables (HTML5 entity references and Unicode case folding) rather than hand-maintained data, keeping spec compliance mechanical to update. The project builds no CLI or server component; it is consumed purely as an importable library, and a separate WASM build powers the online playground referenced in the README.

Code Quality

The repo carries close to twenty _test.go files at the package root and within parser, ast, and extension, including commonmark_test.go and extra_test.go which run the official CommonMark spec fixtures (_test/spec.json) plus goldmark-specific edge cases (_test/extra.txt, _test/options.txt) through table-driven tests. A dedicated fuzz/ package wires goldmark.New with the full extension set into Go’s native fuzz testing (f.Fuzz), directly supporting the README’s “tested with go test —fuzz” claim. CI (.github/workflows/test.yaml) runs the suite with coverage across three Go versions and three OS platforms (Ubuntu/macOS/Windows) and reports to Coveralls, and golangci-lint runs with an explicit multi-linter set (errcheck, gosimple, govet, ineffassign, staticcheck, unused) enforced only on non-Windows runners to dodge CRLF false positives. Error handling favors returned error values over panics in the public API (Convert returns an error), and the codebase is idiomatically typed with no use of reflection-heavy patterns in the hot parsing path.

What Makes It Unique

goldmark’s distinguishing choice is treating the AST as a first-class, externally extensible interface rather than an implementation detail — competing Go Markdown libraries either aren’t CommonMark-compliant or expose concrete structs that block third-party node types, which the README calls out directly as a limitation of blackfriday.v2. Combined with the prioritized-registry extension model, this lets goldmark hit CommonMark 0.31.2 compliance, GFM feature parity, and cmark-comparable performance simultaneously, while remaining safe-by-default (no raw HTML/dangerous URL rendering without an explicit opt-in) — a combination the project’s own benchmarks and security section position as its core value proposition against alternatives like blackfriday and golang-commonmark.

Used by 18 apps in this directory

Go
42%
AGPL 3.0

listmonk

Blogging · Marketing

23,727

High-performance, self-hosted newsletter and mailing list manager packaged as a single binary with built-in analytics, transactional messaging, and multi-channel delivery.

View details
81
Repo Health
74
Technical
67
Dependency
Built with
Go 42%
Vue 24%
JavaScript 19%
Updated 2 weeks ago
TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,048

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
69
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 2 months ago
TypeScript
52%
Other

Mattermost

Collaboration · Devops · Team Chat

39,306

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript 52%
Go 40%
Updated 2 weeks ago
Go
51%
MIT

memos

Note Taking

63,656

Open-source, self-hosted note-taking built for quick capture — Markdown-native, lightweight, and fully yours.

View details
91
Repo Health
78
Technical
65
Dependency
Built with
Go 51%
TypeScript 48%
Updated 1 weeks ago
Go
56%
Other

Multica

AI Assistants · AI Development

52,342

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go 56%
TypeScript 38%
Updated 1 weeks ago
TypeScript
90%
MIT

OpenClaw

AI Agents · AI Assistants

391,553

An open-source AI assistant that runs on your own hardware and meets you in Discord, Slack, WhatsApp, iMessage, Telegram, and 20+ other channels, with native apps for every major platform.

View details
88
Repo Health
88
Technical
67
Dependency
Built with
TypeScript 90%
Updated 1 weeks ago
Go
68%
MIT

Probo

Automation · Security

1,451

Open-source GRC platform for engineering and security teams.

View details
87
Repo Health
90
Technical
76
Dependency
Built with
Go 68%
TypeScript 31%
Updated 1 weeks ago
TypeScript
50%
Other

SigNoz

Analytics · Monitoring

32,323

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 50%
Go 38%
Updated 2 weeks ago
Go
65%
AGPL 3.0

Vikunja

Project Management

5,667

Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.

View details
86
Repo Health
81
Technical
68
Dependency
Built with
Go 65%
TypeScript 24%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers