explaingit

yuin/goldmark

4,759GoAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A Go library that converts Markdown text to HTML, fully compliant with the CommonMark standard. Highly extensible, add custom syntax, AST transformers, or renderers without forking the library.

Mindmap

mindmap
  root((goldmark))
    What it does
      Markdown to HTML
      CommonMark compliant
    Extensions
      Tables
      Strikethrough
      Task lists
      Custom syntax
    Tech Stack
      Go only
      Zero dependencies
    Use Cases
      Static site generators
      Web apps
      Documentation tools
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Convert Markdown files to HTML in a Go web application or static site generator.

USE CASE 2

Add custom Markdown syntax extensions without forking the library.

USE CASE 3

Use as a standards-compliant parser that produces the same output as GitHub and other CommonMark platforms.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 5min

Zero third-party dependencies, uses only Go standard library packages.

Free to use for any purpose, including commercial use, as long as the MIT license notice is kept.

In plain English

goldmark is a library written in Go that converts Markdown text into HTML. Markdown is a lightweight writing format where you use simple symbols to indicate structure: asterisks for bold, pound signs for headings, hyphens for list items. goldmark reads that source text and produces the HTML output a browser or document tool can display. The library was built because the author found that existing Go Markdown parsers either did not follow the CommonMark standard or could not be extended from outside the package. CommonMark is a formal specification that defines exactly how Markdown should be parsed in ambiguous situations, and goldmark follows the latest version of it. Being standards-compliant matters in practice: Markdown documents written for GitHub or other CommonMark-based platforms should produce the same output in goldmark without surprises. Extensibility is a central design goal. Developers can add custom block and inline syntax, write new tree-transformation steps, or replace the HTML renderer entirely, all without forking the library. goldmark also ships with several built-in extras: tables, strikethrough, task lists, definition lists, and a GitHub Flavored Markdown bundle that activates the most commonly used extensions in one call. The library depends only on Go standard library packages, which means no third-party dependencies to manage. Performance is described as comparable to cmark, the reference CommonMark implementation written in C. The library is tested with Go built-in fuzzing tools to catch edge cases in parsing. An online playground lets anyone try goldmark in a browser without installing Go locally. The library is released under the MIT license.

Copy-paste prompts

Prompt 1
Using goldmark in Go, write a function that takes a Markdown string and returns an HTML string, with the GitHub Flavored Markdown bundle enabled.
Prompt 2
In goldmark, how do I write a custom extension that adds a new inline syntax for highlighting text with ==double equals==?
Prompt 3
Using goldmark, how do I add a transformer that walks the AST and adds a target='_blank' attribute to all external links in the rendered HTML?
Prompt 4
Show me how to enable goldmark's built-in table, strikethrough, and task-list extensions all at once in a single goldmark.New() call.
Open on GitHub → Explain another repo

← yuin on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.