返回首页

使用 Nuxt Content 写博客的几个小技巧

介绍 frontmatter、代码高亮、目录等常用能力。

2 约 1 分钟 · 398 字 前端

Frontmatter

每篇文章顶部用 YAML 写元信息:

---
title: 文章标题
description: 文章描述
date: 2026-05-10
tags:
  - Nuxt
---

内置组件

@nuxt/content 内置了一些 Markdown 组件,例如代码块自动高亮、链接自动外开等。

数学公式 / 流程图

可以通过 remark / rehype 插件扩展,比如 remark-mathrehype-mermaid 等。

提示:对于本框架,如需扩展 Markdown 能力,在 nuxt.config.tscontent.build.markdown 中添加 remarkPlugins / rehypePlugins 即可。