explaingit

remarkjs/remark

8,874JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

Remark is a JavaScript Markdown processor that parses text into a syntax tree and lets a plugin pipeline transform, lint, reformat, or convert it to HTML, claimed to be the world's most popular Markdown parser.

Mindmap

mindmap
  root((remark))
    What it does
      Parse Markdown
      Plugin transforms
      Output HTML or MD
    Ecosystem
      150+ plugins
      rehype HTML
      retext prose
    Formats
      CommonMark spec
      GitHub Flavored MD
      MDX with JSX
    Usage
      Node.js
      Browser
      CLI tool
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 a folder of Markdown files to HTML using remark-cli and a plugin chain.

USE CASE 2

Lint and auto-format Markdown documentation in a project to enforce consistent style across all files.

USE CASE 3

Generate a table of contents for a long Markdown document automatically using a remark plugin.

USE CASE 4

Process MDX files with embedded JSX for use in a React documentation or blog site.

Tech stack

JavaScriptNode.js

Getting it running

Difficulty · easy Time to first run · 30min
License information is not described in the explanation.

In plain English

Remark is a JavaScript tool for processing Markdown text using a plugin system. Instead of converting Markdown to HTML directly and stopping there, remark first parses the Markdown into a tree structure (called an AST, or abstract syntax tree) where each heading, paragraph, link, and code block becomes a node you can inspect or modify with code. Plugins then walk that tree and do whatever they need: convert it to HTML, check for style inconsistencies, generate a table of contents, or restructure headings. The project claims to be the world's most popular Markdown parser and it follows the CommonMark specification precisely. Extensions for GitHub-Flavored Markdown (which adds tables, strikethrough, footnotes, and task lists) and for MDX (Markdown with embedded JSX) are available as plugins. Over 150 plugins exist in the ecosystem, covering everything from linting and formatting to generating sitemaps and embedding code examples. Remark is part of the larger unified ecosystem, which applies the same plugin pipeline approach to other content types like HTML (handled by rehype) and prose (handled by retext). Because all these tools use the same underlying pipeline pattern, you can chain them together: parse Markdown, transform it, then hand the tree off to rehype to produce HTML, all in a few lines. This repository is a monorepo containing the core packages: remark-parse (reads Markdown into a tree), remark-stringify (writes a tree back out as Markdown), remark itself (combines both), and remark-cli (a command-line tool for linting and formatting Markdown files in a project). You can use it in Node.js, in the browser, on Deno, and in command-line scripts.

Copy-paste prompts

Prompt 1
Show me how to set up remark in Node.js to convert a Markdown file to HTML using remark and remark-html.
Prompt 2
Write a custom remark plugin that finds all headings in a Markdown AST and adds an anchor link to each one.
Prompt 3
Configure remark-cli to lint all Markdown files in my project and auto-fix style issues.
Prompt 4
How do I chain remark and rehype plugins to process Markdown into clean static HTML in a build script?
Prompt 5
Write a Node.js script that uses remark to extract all external links from a Markdown file and print them.
Open on GitHub → Explain another repo

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

Verify against the repo before relying on details.