Markdown Features

This guide explains how to use various Markdown features in the valaxy-theme-antfu theme, including table of contents, admonitions, and more.

Markdown 功能

本指南将解释如何在 valaxy-theme-antfu 主题中使用各种 Markdown 功能,包括目录、提示框等。

Table of Contents

You can easily add a table of contents to your Markdown files using the [[toc]] directive. This will automatically generate a table of contents based on the headings in your document.

目录

您可以使用 [[toc]] 指令轻松地向 Markdown 文件添加目录。这将根据文档中的标题自动生成目录。

Usage

Simply add [[toc]] at the beginning of your Markdown file or wherever you want the table of contents to appear:

使用方法

只需在 Markdown 文件的开头或您希望目录出现的位置添加 [[toc]]

md
---
title: My Document
---

[[toc]]

# Introduction

Content here...

# Section 1

More content...

## Subsection 1.1

Even more content...

This will generate a nested list of links to all headings in your document, making it easy for readers to navigate through longer content.

这将生成一个包含文档中所有标题链接的嵌套列表,使读者能够轻松浏览较长的内容。

Customization

The table of contents is automatically styled to match the theme. It will display all heading levels by default.

自定义

目录会自动采用与主题匹配的样式。默认情况下,它将显示所有标题级别。

Code Blocks

The theme supports syntax highlighting for code blocks. You can specify the language after the opening triple backticks:

代码块

主题支持代码块的语法高亮。您可以在开头的三个反引号后指定语言:

js
// JavaScript code with syntax highlighting
function greeting(name) {
  return `Hello, ${name}!`
}
css
/* CSS code with syntax highlighting */
.container {
  display: flex;
  justify-content: center;
}

Line Highlighting

You can highlight specific lines in code blocks by adding line numbers in curly braces:

行高亮

您可以通过在花括号中添加行号来高亮代码块中的特定行:

js
function example() {
  // This line is highlighted
  const a = 1
  // These lines are
  // also highlighted
  return a
}

Inline Code

You can use backticks to create inline code within your text.

内联代码

您可以使用反引号在文本中创建内联代码

You can create links using the standard Markdown syntax.

链接

您可以使用标准 Markdown 语法创建链接

Images

Images can be added using the standard Markdown syntax:

图片

可以使用标准 Markdown 语法添加图片:

md
![Alt text](/path/to/image.jpg)

Lists

You can create ordered and unordered lists:

列表

您可以创建有序和无序列表:

Unordered Lists

  • Item 1
  • Item 2
    • Nested item 1
    • Nested item 2
  • Item 3

无序列表

  • 项目 1
  • 项目 2
    • 嵌套项目 1
    • 嵌套项目 2
  • 项目 3

Ordered Lists

  1. First item
  2. Second item
    1. Nested item 1
    2. Nested item 2
  3. Third item

有序列表

  1. 第一项
  2. 第二项
    1. 嵌套项目 1
    2. 嵌套项目 2
  3. 第三项

Tables

You can create tables using the standard Markdown syntax:

表格

您可以使用标准 Markdown 语法创建表格:

Header 1Header 2Header 3
Cell 1Cell 2Cell 3
Cell 4Cell 5Cell 6

Conclusion

These are the basic Markdown features supported by the valaxy-theme-antfu theme. For more advanced features, please refer to the Valaxy documentation.

结论

这些是 valaxy-theme-antfu 主题支持的基本 Markdown 功能。有关更高级的功能,请参阅 Valaxy 文档

CC BY-NC-SA 4.0 2024-PRESENT © WRXinYue