MCPcopy Index your code
hub / github.com/astro-community/md

github.com/astro-community/md @1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0 ↗ · + Follow
12 symbols 20 edges 15 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Astro Markdown

Astro Markdown lets you render any Markdown content in Astro, optionally integrating with any existing configuration.

NPM Version NPM Downloads Open in StackBlitz

---
import { Markdown } from '@astropub/md'
---
<Markdown of={`# Hi, there!` /* Renders `<h1>Hi, there!</h1>` */} />
---
import { markdown } from '@astropub/md'
---
{
  /* Renders `<h1>Hi, there!</h1>` */
  await markdown(`# Hi, there!`)
}

Usage

Add Astro Markdown to your project.

npm install @astropub/md

Use Astro Markdown in your project.

---
import { markdown } from '@astropub/md'
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Astro</title>
  </head>
  <body>
    {await markdown(
`# Hi, there!

Welcome to my _website_.`
    )}
  </body>
</html>

Optionally, integrate Astro Markdown with your existing Astro configuration.

// astro.config.js
import { defineConfig } from 'astro/config'
import markdownIntegration from '@astropub/md'

export default defineConfig({
  integrations: [
    markdownIntegration(),
  ],
  markdown: {
    remarkPlugins: [],
    rehypePlugins: [],
    // syntaxHighlight: 'shiki'
    // syntaxHighlight: 'prism'
  }
})

Now markdown configuration is automatically applied to <Markdown> components and markdown() functions.

Use markdown.inline() or <Markdown.Inline> to handle short strings of text without the surrounding paragraph.

---
import { Markdown } from '@astropub/md'
---
<Markdown.Inline of={
  /* Renders `Welcome to my <em>website</em>.` */
  `Welcome to my _website_.`
} />
---
import { markdown } from '@astropub/md'
---
{await markdown.inline(
  /* Renders `Welcome to my <em>website</em>.` */
  `Welcome to my _website_.`
)}

Enjoy!

Project Structure

Inside of this Astro project, you'll see the following folders and files:

/
├── demo/
│   ├── public/
│   └── src/
│       └── pages/
            ├── index.astro
│           └── ...etc
└── packages/
    └── md/
        ├── package.json
        └── ...etc

This project uses workspaces to develop a single package, @astropub/md.

It also includes a minimal Astro project, demo, for developing and demonstrating the component.

Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run start Starts local dev server at localhost:3000
npm run build Build your production site to ./dist/
npm run serve Preview your build locally, before deploying

Want to learn more? Read the Astro documentation or jump into the Astro Discord.

Extension points exported contracts — how you extend this code

Shared (Interface)
(no doc)
packages/md/lib/shared.d.ts
Props (Interface)
(no doc)
packages/md/lib/component.d.ts

Core symbols most depended-on inside this repo

markdown
called by 1
packages/md/lib/markdown.js
[Symbol.toStringTag]
called by 0
packages/md/lib/component.js
[Symbol.asyncIterator]
called by 0
packages/md/lib/component.js
mdAstro
called by 0
packages/md/lib/integration.js
'astro:config:done'
called by 0
packages/md/lib/integration.js
[Symbol.toStringTag]
called by 0
packages/md/lib/html-string.js

Shape

Function 5
Class 4
Interface 2
Method 1

Languages

TypeScript100%

Modules by API surface

packages/md/lib/html-string.js3 symbols
packages/md/lib/integration.js2 symbols
packages/md/lib/html-string.d.ts2 symbols
packages/md/lib/component.js2 symbols
packages/md/lib/shared.d.ts1 symbols
packages/md/lib/markdown.js1 symbols
packages/md/lib/component.d.ts1 symbols

For agents

$ claude mcp add md \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact