软件开发的核心原则之一是 DRY(Don’t Repeat Yourself,不要重复自己)。这个原则同样适用于文档编写。如果你发现自己在多个地方重复相同的内容,就应该考虑创建一个自定义代码片段来保持内容的同步。Documentation Index
Fetch the complete documentation index at: https://mcp.vyagent.com/llms.txt
Use this file to discover all available pages before exploring further.
Creating a custom snippet
Pre-condition: You must create your snippet file in thesnippets directory.
Any page in the
snippets directory will be treated as a snippet and will not
be rendered into a standalone page. If you want to create a standalone page
from the snippet, import the snippet into another file and call it as a
component.Default export
- Add content to your snippet file that you want to re-use across multiple locations. Optionally, you can add variables that can be filled in via props when you import the snippet.
snippets/my-snippet.mdx
- Import the snippet into your destination file.
destination-file.mdx
Reusable variables
- Export a variable from your snippet file:
snippets/path/to/custom-variables.mdx
- Import the snippet from your destination file and use the variable:
destination-file.mdx
Reusable components
- Inside your snippet file, create a component that takes in props by exporting your component in the form of an arrow function.
snippets/custom-component.mdx
- Import the snippet into your destination file and pass in the props
destination-file.mdx