xiaohongshu
xiaohongshu
mdx-content
Content schema design and MDX configuration patterns for knowledge bases. Use when designing content structure, configuring MDX processing, or setting up frontmatter schemas.
Full skill instructions
Required fields for all content:
---
title: string # Page title
description: string # Short description (for nav, search)
---
Common optional fields:
date: date # Publication/update date
tags: string[] # Categorization
draft: boolean # Hide from production
order: number # Manual ordering
category: string # Primary category
import { z } from 'zod';
const schema = z.object({
title: z.string(),
description: z.string(),
date: z.date().optional(),
tags: z.array(z.string()).optional(),
draft: z.boolean().default(false),
});
Critical: Validate at build time, not runtime. Catch schema errors early.
Markdown processing (remark):
remark-gfm: GitHub Flavored Markdown (tables, task lists)remark-frontmatter: Parse YAML frontmatterHTML processing (rehype):
rehype-slug: Add IDs to headings (required for TOC)rehype-autolink-headings: Clickable heading linksrehype-pretty-code: Syntax highlighting (Shiki-based)export default defineConfig({
markdown: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
[rehypePrettyCode, { theme: 'github-dark' }],
],
},
});
content/
docs/ # Main documentation
index.md
getting-started.md
api/ # Nested sections
auth.md
guides/ # Tutorials/guides
changelog.md # Special pages
Routing: Directory structure maps to URLs
docs/index.md → /docsdocs/api/auth.md → /docs/api/authGroup related content into collections:
export const collections = {
'docs': docsCollection,
'guides': guidesCollection,
'blog': blogCollection,
};
Benefits: Separate schemas, different processing, type safety per collection.
// Make components available in MDX
const components = {
// Override defaults
h1: CustomH1,
code: CustomCode,
// Add custom components
Callout: CalloutComponent,
Tabs: TabsComponent,
};
Callout/Alert:
<Callout type="warning">
Important information here
</Callout>
Code with tabs:
<Tabs>
<Tab label="JavaScript">...</Tab>
<Tab label="TypeScript">...</Tab>
</Tabs>
[rehypePrettyCode, {
theme: 'github-dark',
keepBackground: false, // Use CSS custom properties
}]
Theme switching: Set keepBackground: false, control via CSS:
pre {
background: var(--code-background);
}
```js title="example.js" {3-5}
// Line 1
// Line 2
// Lines 3-5 highlighted
// ...
Supported: Line highlighting, titles, line numbers (framework-dependent).
## Content Queries
### Basic Filtering
```typescript
import { getCollection } from 'astro:content';
// Get published docs
const docs = await getCollection('docs', ({ data }) => {
return !data.draft;
});
// Sort by date
docs.sort((a, b) =>
b.data.date.getTime() - a.data.date.getTime()
);
// Generate nav from content
const nav = docs
.filter(doc => !doc.data.draft)
.map(doc => ({
label: doc.data.title,
href: `/docs/${doc.slug}`,
order: doc.data.order ?? 999,
}))
.sort((a, b) => a.order - b.order);
// From markdown AST or rendered HTML
function extractHeadings(content: string) {
const headings = [];
// Parse headings from content
return headings.map(h => ({
depth: h.depth,
text: h.text,
slug: h.slug,
}));
}
Display: Show h2 and h3 only, indent by depth.
Before committing content schema:
Frontmatter not parsing:
--- around YAMLCustom components not rendering:
Syntax highlighting broken:
Document for content authors:
## Content Guidelines
1. **Frontmatter**: Required fields: `title`, `description`
2. **Headings**: Start with h2 (h1 is title)
3. **Links**: Use relative paths: `./other-doc.md`
4. **Images**: Place in `src/assets/`, use relative paths
5. **Code blocks**: Include language identifier
Schema design:
MDX features:
Organization:
Document decisions in CLAUDE.md under "Content Structure" section.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience