傅里叶变换公式如下: $$ \mathcal{F}(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} dt $$
markdown-render katex
markdown 中使用 LaTeX (KaTeX) 语法来显示复杂的数学公式。你需要在公式的两边加上两个美元符号 $$ (块级公式) 或一个美元符号 $ (行内公式) ,然后输入 LaTeX 代码。
输入方式为 $公式内容$ ,示例:$\sqrt{3x-1}+(1+x)^2$,可以在行内输入,前后有文字也可以解析。
块级公式是需要 $$ 顶格写,才会进行解析,解析后,公式居中展示,示例:
$$
\begin{array}{c}
\nabla \times \vec{\mathbf{B}} -, \frac1c, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}, +, \frac1c, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{array}
$$
GitCode 会把公式解析成居中显示,而且支持公式间的换行,Gitee 不能正确渲染上面的块级公式。
源码:
$$\begin{array}{c}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
= \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{array}$$
导致渲染异常的行是:
$$运算符为系统组件提供TS变量的引用,使得TS变量和系统组件的内部状态保持同步。
- $$绑定的变量变化时,会触发UI的同步刷新。
顶格写的 $$ 符号,触发了标准的 markdown 公式解析。
处理方法: 如果上面行中的 $$ 没有特殊用途的话,去除掉行中的 $$ 符号即可。
文档内其他的 $$ 符号,没有特殊作用的话,也可以去掉。
运算符为系统组件提供TS变量的引用,使得TS变量和系统组件的内部状态保持同步。
内部状态具体指什么取决于组件。例如,TextInput组件的text参数。
说明:
$$还用于@Builder装饰器的按引用传递参数,开发者需要注意两种用法的区别。
-
当前$$支持的组件:
组件 支持的参数/属性 起始API版本 Checkbox select 10 CheckboxGroup selectAll 10 DatePicker selected 10 TimePicker selected 10 MenuItem selected 10 Panel mode 10 Radio checked 10 Rating rating 10 Search value 10 SideBarContainer showSideBar 10 Slider value 10 Stepper index 10 Swiper index 10 Tabs index 10 TextArea text 10 TextInput text 10 TextPicker selected、value 10 Toggle isOn 10 AlphabetIndexer selected 10 Select selected、value 10 BindSheet isShow 10 BindContentCover isShow 10 Refresh refreshing 8 GridItem selected 10 ListItem selected 10 -
绑定的变量变化时,会触发UI的同步刷新。
以TextInput方法的text参数为例:
// xxx.ets
@Entry
@Component
struct TextInputExample {
@State text: string = ''
controller: TextInputController = new TextInputController()
build() {
Column({ space: 20 }) {
Text(this.text)
TextInput({ text: $$this.text, placeholder: 'input your word...', controller: this.controller })
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.caretColor(Color.Blue)
.width(300)
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
}