Open-Source Wikis

/

Astro

/

Packages

/

@astrojs/markdown-remark

withastro/astro

@astrojs/markdown-remark

The shared markdown processor used by the framework, MDX integration, content collections, and a few examples. Published from packages/markdown/remark/.

Purpose

@astrojs/markdown-remark configures a unified remark + rehype pipeline with sensible defaults for Astro:

  • GitHub-flavored markdown support
  • Smartypants (configurable; see commit 10a1a5a "feat: Smartypants config").
  • Syntax highlighting via Shiki, with a curated set of bundled themes.
  • A heading-id plugin and TOC extraction.
  • Image transformation that integrates with astro:assets.

The package exports createMarkdownProcessor(), the markdownConfigDefaults, the syntaxHighlightDefaults, and types like RemarkPlugin, RehypePlugin, ShikiConfig, MarkdownHeading. Astro re-exports these from astro/types for user code.

Directory layout

packages/markdown/remark/
├── src/        # processor.ts, defaults, shiki, plugins
├── test/
└── package.json

How it's wired in

graph LR
    A[.md file] -->|src/vite-plugin-markdown| B[createMarkdownProcessor]
    C[.mdx file] -->|@mdx-js/mdx + @astrojs/mdx| B
    D[Content collection .md] -->|content-layer loader| B
    B --> E[remark plugins]
    E --> F[rehype plugins]
    F --> G[Shiki highlighting]
    G --> H[HTML + frontmatter + headings]
    H --> I[Astro page or content entry]

Configuration flows from astro.config.mjs's markdown key into packages/astro/src/core/config/schemas/base.ts and out through the markdown processor.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

@astrojs/markdown-remark – Astro wiki | Factory