explaingit

johanneskaufmann/html-to-markdown

Analysis updated 2026-05-18

3,636GoAudience · developerComplexity · 2/5Setup · easy

TLDR

A Go library and command-line tool that converts HTML, even entire websites, into clean Markdown text.

Mindmap

mindmap
  root((html-to-markdown))
    What it does
      HTML to Markdown
      Handles tables lists quotes
      Website conversion
    Tech stack
      Go
      CLI tool
      REST API
    Use cases
      Docs pipelines
      Scraping to Markdown
      AI text prep
    Audience
      Go developers
      CLI users
      Non coders via demo

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

What do people build with it?

USE CASE 1

Convert scraped web pages into clean Markdown for documentation or note taking.

USE CASE 2

Feed HTML content into an AI pipeline that expects Markdown input.

USE CASE 3

Build a custom plugin to handle unusual HTML tags or web components.

USE CASE 4

Run one off conversions from the terminal using the CLI without writing Go code.

What is it built with?

GoCLIREST API

How does it compare?

johanneskaufmann/html-to-markdownarl/statsvizspegel-org/spegel
Stars3,6363,6353,634
LanguageGoGoGo
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

html-to-markdown is a Go library and command-line tool that converts HTML content into Markdown text. Markdown is a lightweight text format used by many writing tools, documentation systems, and AI applications. The library handles the conversion of common HTML elements: bold and italic text, ordered and unordered lists with nesting, blockquotes, inline code and code blocks, links, images, and HTML tables with alignment, rowspan, and colspan support. The library is designed to handle edge cases that simpler converters miss. It escapes special characters only when necessary to avoid accidentally triggering Markdown formatting, and it correctly handles multi-line links and nested blockquotes. You can also tell it to keep certain HTML tags as-is in the output, or to strip them out entirely, which is useful when you want to preserve some structure that Markdown cannot express. The architecture is plugin-based. A base plugin provides shared functionality, and a Commonmark plugin handles standard Markdown output. Additional plugins cover things like strikethrough text and table conversion. You can write your own plugins to handle custom HTML elements or web components. The converter also lets you register how specific tag types (block-level versus inline) should be treated, which affects how whitespace is handled around them. For Go developers, the library is imported as a module and conversion can be as simple as one function call: pass in an HTML string and get back a Markdown string. For converting whole pages, a WithDomain option turns relative URLs into absolute ones. A CLI version lets non-Go users run conversions from the terminal without writing any code. An online demo and a hosted REST API are available for quick testing without installation. The project is on version 2, which has breaking changes compared to version 1. Both versions are available on separate branches.

Copy-paste prompts

Prompt 1
Show me how to import the html-to-markdown Go library and convert a string of HTML into Markdown.
Prompt 2
Write a small Go program that uses html-to-markdown with the Commonmark plugin to convert an entire webpage, using WithDomain to fix relative links.
Prompt 3
Explain how to write a custom plugin for html-to-markdown that keeps a specific HTML tag instead of converting it.
Prompt 4
Give me the CLI command to convert a local HTML file to Markdown using html-to-markdown.

Frequently asked questions

What is html-to-markdown?

A Go library and command-line tool that converts HTML, even entire websites, into clean Markdown text.

What language is html-to-markdown written in?

Mainly Go. The stack also includes Go, CLI, REST API.

How hard is html-to-markdown to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is html-to-markdown for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.