Scripts2026年7月13日·1 分钟阅读

Markdoc — Powerful Markdown Authoring Framework by Stripe

A flexible, extensible Markdown-based authoring system that adds custom tags, attributes, and validation to standard Markdown for building documentation sites and content systems.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Markdoc Overview
直接安装命令
npx -y tokrepo@latest install cec0c5b3-7eb7-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Markdoc is a Markdown-based authoring framework created by Stripe for building documentation. It extends standard Markdown with a custom tag syntax, attribute annotations, and a schema-based validation system, letting teams create richly interactive documentation pages while keeping content in readable Markdown files.

What Markdoc Does

  • Extends Markdown with custom tags, nodes, and functions using {% tag %} syntax
  • Validates documents against a schema to catch errors at build time
  • Transforms parsed content into a renderable tree for React, HTML, or any target
  • Supports variables and conditional content for dynamic documentation
  • Provides a plugin architecture for custom transformations

Architecture Overview

Markdoc's pipeline has three stages: parse, transform, and render. The parser builds a Markdown AST extended with tag nodes. The transform stage applies a schema (defining tags, attributes, and validation rules) to produce a render tree. Renderers then convert the tree to React components, HTML strings, or custom output. The schema is plain JavaScript, making it easy to define new tags.

Self-Hosting & Configuration

  • Install the @markdoc/markdoc npm package in your project
  • Define tag schemas in JavaScript files that specify attributes, children, and validation
  • Use the Next.js plugin (@markdoc/next.js) for file-based routing of Markdoc pages
  • Content files use the .md or .markdoc extension and live alongside code
  • Integrate with any static site generator or server-side framework

Key Features

  • Clean, readable syntax that stays close to standard Markdown
  • Schema validation catches documentation errors before deployment
  • First-class React rendering for interactive components inside docs
  • Variables and functions enable conditional and dynamic content
  • Created and battle-tested at Stripe for their public documentation

Comparison with Similar Tools

  • MDX — embeds JSX in Markdown; Markdoc uses a tag syntax that non-developers can read
  • Docusaurus — full docs framework; Markdoc is a content layer that plugs into any framework
  • Contentlayer — type-safe content SDK; Markdoc focuses on authoring and validation
  • remark/rehype — low-level AST plugins; Markdoc provides a higher-level schema abstraction
  • AsciiDoc — rich document format; Markdoc stays closer to Markdown simplicity

FAQ

Q: Is Markdoc compatible with standard Markdown? A: Yes. Any valid Markdown file is valid Markdoc. The custom tag syntax is additive.

Q: Can non-technical writers use it? A: Yes. The tag syntax is designed to be readable and writable by content authors without JavaScript knowledge.

Q: Does it work with frameworks other than Next.js? A: Yes. The core library is framework-agnostic. The Next.js plugin is a convenience wrapper.

Q: How does validation work? A: Schemas define allowed attributes, required children, and type constraints. The transform step reports errors for any violations.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。