
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
rehype-resolve-markdown-links
Advanced tools
A rehype plugin to resolve markdown links to absolute paths
A rehype plugin that resolves relative markdown links into absolute URL paths.
Relative .md / .mdx links are rewritten to root-absolute, extension-less URLs; #hash and ?query suffixes are kept, and a link to a missing file throws. Absolute URLs, absolute paths, and non-markdown links are left untouched.
Given this file structure:
content/
getting-started/
intro.mdx
quick-start.md
references/
core.md
react/
button.md
web/
button.md
And this configuration with rootDir: './content':
| Source file | Markdown | HTML output |
|---|---|---|
references/react/button.md | [Web Button](../web/button.md) | <a href="/references/web/button">Web Button</a> |
references/react/button.md | [Editor](../core.md#editor) | <a href="/references/core#editor">Editor</a> |
getting-started/quick-start.md | [Intro](./intro.mdx) | <a href="/getting-started/intro">Intro</a> |
npm install rehype-resolve-markdown-links
import { rehypeResolveMarkdownLinks } from 'rehype-resolve-markdown-links'
import rehypeStringify from 'rehype-stringify'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import { unified } from 'unified'
const file = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeResolveMarkdownLinks, { rootDir: './content' })
.use(rehypeStringify)
// The file's `path` is required — links are resolved relative to it.
.process({ path: 'content/references/react/button.md', value: markdown })
rootDirRequired. The root directory of your content files. Output links are generated relative to this directory.
Using Sätteri instead of rehype? Use satteri-resolve-markdown-links, which provides the same behavior for Sätteri's plugin API.
MIT
FAQs
A rehype plugin to resolve markdown links to absolute paths
We found that rehype-resolve-markdown-links demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.