已发布示例

这是一篇用于预览公开博客样式的示例文章。后台保存后,将 content/ 目录同步到本仓库即可重新构建站点。

带图片:

示例图

代码块示例

正文里的 fenced code 在构建时会经 Shiki 做语法高亮,并显示语言标签。

TypeScript

typescript
type Post = { title: string; slug: string; published: boolean };async function listPublished(posts: Post[]) {  return posts.filter((p) => p.published).map((p) => p.slug);}const slugs = await listPublished([  { title: '示例', slug: 'demo', published: true },]);console.log(slugs.join(', '));

Shell

bash
cd apps/sitenpm run buildnpm run preview

JSON

json
{  "title": "已发布示例文章",  "slug": "published-demo",  "published": true}

Python

python
def excerpt(lines: list[str], max_len: int = 160) ->str:    text = " ".join(line.strip() for line in lines if line.strip())    return text[:max_len]

行内代码如 const x = 1 仍使用浅色底,与整块高亮区分。

引用块也会保留舒适的行距与左侧强调线。