A powerful, flexible, Markdown-based authoring framework.
A powerful, flexible, Markdown-based authoring framework.
Markdoc is a Markdown-based syntax and toolchain for creating custom documentation sites and experiences.
We designed Markdoc to power Stripe's public docs, our largest and most complex content site.
To get started with Markdoc, first install the library:
npm install @markdoc/markdocor
yarn add @markdoc/markdocand import it in your app:
const Markdoc = require('@markdoc/markdoc');or if you are using ESM
import Markdoc from '@markdoc/markdoc';then use Markdoc in your app or tool:
const doc = `
# Markdoc README
{% image src="/logo.svg" /%}
`;
const ast = Markdoc.parse(doc);
const content = Markdoc.transform(ast);
return Markdoc.renderers.react(content, React);Check out our docs for more guidance on how to use Markdoc.
This is the minimal tsconfig.json required to use Markdoc in your TypeScript project:
{
"compilerOptions": {
"moduleResolution": "node",
"target": "esnext", // works with es2015 or greater
"esModuleInterop": true
}
}If you are using React, install Markdoc with:
npm install @markdoc/markdoc react @types/reactContributions and feedback are welcome and encouraged. Check out our contributing guidelines on how to do so.
npm installnpm run buildnpm testThis project has adopted the Stripe Code of conduct.
This project uses the MIT license.
Special shout out to:
Heading escape regex matches # anywhere in text, not just at line start
Tag is ignored when double quote is missing in tag attribute
Escaped links/images lose escaping after formatting
Markdoc Language Server is not working on Windows
ESM support breaks on plain Node.js
Incorrect line length calculation in formatter
Multi-line opening tags break sibling tag detection
VSCode extension markdoc file icon support
Example projects are out of date
Prettier plugin for Markdoc tags