跳转至主要内容
Version: v1.6.0

Markdown 语法

本节将简要介绍在此网站撰写文档的方法。 请注意文档由 Markdown 的扩展版本撰写,所以大多数时候您不需要超出 Markdown 基本语法的特殊语法。

代码块

本网站支持高亮显示的插入代码块。 例如,下面的代码段:

```python {1-2,4,6} title=snippet.py
@ti.kernel
def paint(t: float):
for i, j in pixels: # Parallelized over all pixels
c = ti.Vector([-0.8, ti.cos(t) * 0.2])
z = ti.Vector([i / n - 1, j / n - 0.5]) * 2
iterations = 0
while z.norm() < 20 and iterations < 50:
z = complex_sqr(z) + c
iterations += 1
pixels[i, j] = 1 - iterations * 0.02
```

将会是以下代码块的渲染结果:

snippet.py
@ti.kernel
def paint(t: float):
for i, j in pixels: # Parallelized over all pixels
c = ti.Vector([-0.8, ti.cos(t) * 0.2])
z = ti.Vector([i / n - 1, j / n - 0.5]) * 2
iterations = 0
while z.norm() < 20 and iterations < 50:
z = complex_sqr(z) + c
iterations += 1
pixels[i, j] = 1 - iterations * 0.02

表格

| 某表 列 1 | 某表 列 2 |
| :--------------: | :--------------: |
| 值1 | 值4 |
| 值2 | 值5 |
| 值3 | 值6 |
某表 列 1某表 列 2
值1值4
值2值5
值3值6
TIP

Tables Generator is a great tool for generating and re-formatting Markdown tables.

交叉引用

若要链接到同一篇文章中的另一个部分,您可以使用 [Return to ## 1. Code blocks](#1-code-blocks): Return to ## 1. Code blocks.

We follow the best practices suggested by Docusaurus to cross-reference other documents, so to link to sections in other articles, please use the following relative-path based syntax, which is docs-versioning and IDE/GitHub friendly:

文本块居中

若想使图片或文本块居中,请使用:

<center>

居中文本块!

</center>

居中文本块!

NOTE

You HAVE TO insert blank lines to make them work:

<center>

![](./some_pic.png)

</center>

带颜色背景的文本

您可以使用以下方式突出显示您的文本:

<span id="inline-blue"> 蓝色背景的文本 </span>,
<span id="inline-purple"> 紫色背景的文本 </span>,
<span id="inline-yellow"> 黄色背景的文本 </span>,
<span id="inline-green"> 绿色背景的文本 </span>
蓝色背景的文本 , 紫色背景的文本 , 黄色背景的文本 , 绿色背景的文本

自定义容器

正如您已经多次在本指南中看到的那样,您可以添加自定义容器:

:::tip
This is a tip without a title!
:::
tip

This is a tip without a title!

:::tip TITLE
This is a tip with a title!
:::
TITLE

This is a tip with a title!

:::note
This is a note!
:::
note

This is a note!

:::caution WARNING
This is a warning!
:::
WARNING

This is a warning!

:::danger DANGER
This is a danger!
:::
DANGER

This is a danger!

代码组

您也可以插入基于标签的代码组:

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs
defaultValue="apple"
values={[
{label: 'Apple', value: 'apple'},
{label: 'Orange', value: 'orange'},
{label: 'Banana', value: 'banana'},
]}>
<TabItem value="apple">这是个苹果 🍎.</TabItem>
<TabItem value="orange">这是个橘子 🍊.</TabItem>
<TabItem value="banana">这是支香蕉 🍌.</TabItem>
</Tabs>
This is an apple 🍎.
## Footnotes

To add footnotes, use:

This sentence[^1] has two footnotes[^2]. (See the footnotes at the bottom of this guide.)

[^1]: 我是一个脚注!
[^2]: 我也是一个脚注!

which results in:

---==crwdHRulesLBB_2_BBsuleRHdwrc==

This sentence1 has two footnotes2. (See the footnotes at the bottom of this guide.)

---==crwdHRulesLBB_2_BBsuleRHdwrc==

Images

Inserting images is as straight-forward as using the ordinary Markdown syntax:

![kernel](../internals/life_of_kernel_lowres.jpg)

kernel

In-line Table of Contents (ToC)

You could use:

import TOCInline from '@theme/TOCInline';

<TOCInline toc={toc} />

to insert an in-line ToC:


  1. 我是一个脚注!
  2. 我也是一个脚注!