2025-12-14 11:30:22 -08:00
---
title: "Writing Markdown with Code Examples"
description: "A sample post showing how to write markdown with syntax-highlighted code blocks, tables, and more."
date: "2025-01-17"
slug: "markdown-with-code-examples"
published: true
tags: ["markdown", "tutorial", "code"]
readTime: "5 min read"
feat(fork-config): add automated fork configuration with npm run configure
Add a complete fork configuration system that allows users to set up their
forked site with a single command or follow manual instructions.
## New files
- FORK_CONFIG.md: Comprehensive guide with two setup options
- Option 1: Automated JSON config + npm run configure
- Option 2: Manual step-by-step instructions with code snippets
- AI agent prompt for automated updates
- fork-config.json.example: JSON template with all configuration fields
- Site info (name, title, description, URL, domain)
- GitHub and contact details
- Creator section for footer links
- Optional feature toggles (logo gallery, GitHub graph, blog page)
- Theme selection
- scripts/configure-fork.ts: Automated configuration script
- Reads fork-config.json and applies changes to all files
- Updates 11 configuration files in one command
- Type-safe with ForkConfig interface
- Detailed console output showing each file updated
## Updated files
- package.json: Added configure script (npm run configure)
- .gitignore: Added fork-config.json to keep user config local
- files.md: Added new fork configuration files
- changelog.md: Added v1.18.0 entry
- changelog-page.md: Added v1.18.0 section with full details
- TASK.md: Updated status and completed tasks
- README.md: Replaced Files to Update section with Fork Configuration
- content/blog/setup-guide.md: Added Fork Configuration Options section
- content/pages/docs.md: Added Fork Configuration section
- content/pages/about.md: Added fork configuration mention
- content/blog/fork-configuration-guide.md: New featured blog post
## Files updated by configure script
| File | What it updates |
| ----------------------------------- | -------------------------------------- |
| src/config/siteConfig.ts | Site name, bio, GitHub, features |
| src/pages/Home.tsx | Intro paragraph, footer links |
| src/pages/Post.tsx | SITE_URL, SITE_NAME constants |
| convex/http.ts | SITE_URL, SITE_NAME constants |
| convex/rss.ts | SITE_URL, SITE_TITLE, SITE_DESCRIPTION |
| index.html | Meta tags, JSON-LD, page title |
| public/llms.txt | Site info, GitHub link |
| public/robots.txt | Sitemap URL |
| public/openapi.yaml | Server URL, site name |
| public/.well-known/ai-plugin.json | Plugin metadata |
| src/context/ThemeContext.tsx | Default theme |
## Usage
Automated:
cp fork-config.json.example fork-config.json
# Edit fork-config.json
npm run configure
Manual:
Follow FORK_CONFIG.md step-by-step guide
2025-12-20 22:15:33 -08:00
featured: false
2025-12-20 11:05:38 -08:00
featuredOrder: 5
image: "/images/markdown.png"
2025-12-14 11:30:22 -08:00
---
# Writing Markdown with Code Examples
This post demonstrates how to write markdown content with code blocks, tables, and formatting. Use it as a reference when creating your own posts.
## Frontmatter
Every post starts with frontmatter between `---` delimiters:
```yaml
---
title: "Your Post Title"
description: "A brief description for SEO"
date: "2025-01-17"
slug: "your-url-slug"
published: true
tags: ["tag1", "tag2"]
readTime: "5 min read"
---
```
## Code Blocks
### TypeScript
```typescript
import { query } from "./_generated/server";
import { v } from "convex/values";
export const getPosts = query({
args: {},
returns: v.array(
v.object({
_id: v.id("posts"),
title: v.string(),
slug: v.string(),
}),
),
handler: async (ctx) => {
return await ctx.db.query("posts").collect();
},
});
```
### React Component
```tsx
import { useQuery } from "convex/react";
import { api } from "../convex/_generated/api";
export function PostList() {
const posts = useQuery(api.posts.getPosts);
if (posts === undefined) {
return <div>Loading...</div>;
}
return (
<ul>
{posts.map((post) => (
<li key={post._id}>
<a href={`/${post.slug}` }>{post.title}</a>
</li>
))}
</ul>
);
}
```
### Bash Commands
```bash
# Install dependencies
npm install
# Start development server
npm run dev
2025-12-15 09:25:42 -08:00
# Sync posts to Convex (development)
2025-12-14 11:30:22 -08:00
npm run sync
2025-12-15 09:25:42 -08:00
# Sync posts to Convex (production)
npm run sync:prod
2025-12-14 11:30:22 -08:00
# Deploy to production
npm run deploy
```
### JSON
```json
{
"name": "markdown-blog",
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"sync": "npx ts-node scripts/sync-posts.ts"
}
}
```
## Inline Code
Use backticks for inline code like `npm install` or `useQuery` .
Reference files with inline code: `convex/schema.ts` , `src/pages/Home.tsx` .
## Tables
2025-12-20 11:05:38 -08:00
| Command | Description |
| ------------------- | ------------------------------ |
| `npm run dev` | Start development server |
| `npm run build` | Build for production |
| `npm run sync` | Sync markdown to Convex (dev) |
| `npm run sync:prod` | Sync markdown to Convex (prod) |
| `npx convex dev` | Start Convex dev server |
2025-12-14 11:30:22 -08:00
## Lists
### Unordered
- Write posts in markdown
- Store in Convex database
- Deploy to Netlify
- Updates sync in real-time
### Ordered
1. Fork the repository
2. Set up Convex backend
3. Configure Netlify
4. Start writing
## Blockquotes
2025-12-20 11:05:38 -08:00
> Markdown files in your repo are simpler than a CMS. Commit changes, review diffs, roll back anytime. AI agents can create posts programmatically. No admin panel needed.
2025-12-14 11:30:22 -08:00
## Links
External links open in new tabs: [Convex Docs ](https://docs.convex.dev )
Internal links: [Setup Guide ](/setup-guide )
## Emphasis
Use **bold ** for strong emphasis and _ italics _ for lighter emphasis.
## Horizontal Rule
---
## Images
Place images in `public/` and reference them:
```markdown

```
## File Structure Reference
```
content/blog/
├── about-this-blog.md
├── markdown-with-code-examples.md
├── setup-guide.md
└── your-new-post.md
```
## Tips
1. Keep slugs URL-friendly (lowercase, hyphens)
2. Set `published: false` for drafts
2025-12-15 09:25:42 -08:00
3. Run `npm run sync` after adding posts (or `npm run sync:prod` for production)
2025-12-14 11:30:22 -08:00
4. Use descriptive titles for SEO