Compare commits

..

33 Commits

Author SHA1 Message Date
bf9022c1ea released v1.24.0 2022-11-20 03:42:40 +08:00
79dcdc7379 website: update dark theme issue. 2022-11-20 03:37:25 +08:00
98eae38934 doc: update css.md 2022-11-20 03:28:13 +08:00
3bd4114c63 website: add search feature. #32 2022-11-20 03:28:13 +08:00
9290c65fdc doc: modify README.md. 2022-11-19 18:49:18 +00:00
7e54b5fb74 doc: modify CONTRIBUTING.md. 2022-11-19 18:49:17 +00:00
436e73a3a9 doc: update find.md (#148) 2022-11-20 02:48:17 +08:00
2843f35c9a doc: modify README.md. 2022-11-19 14:24:09 +00:00
33b2fc592b doc: modify CONTRIBUTING.md. 2022-11-19 14:24:08 +00:00
e4444148f1 docs: update dart.md (#147) 2022-11-19 22:22:55 +08:00
fadabde177 doc: modify README.md. 2022-11-19 12:27:18 +00:00
9c4a98b0f2 doc: modify CONTRIBUTING.md. 2022-11-19 12:27:17 +00:00
103fcc7f16 doc: continue to erite lua.md (#143) 2022-11-19 20:26:10 +08:00
dcbd15c567 doc: modify README.md. 2022-11-19 12:25:57 +00:00
8d081123ba doc: modify CONTRIBUTING.md. 2022-11-19 12:25:56 +00:00
094025da3f docs: update vue.md (#144) 2022-11-19 20:25:43 +08:00
b67c2ed842 doc: update dart.md #145 2022-11-19 20:24:36 +08:00
3e1fd804db docs: update dart.md (#145)
* doc: update dart.md

* doc: update dart.md
2022-11-19 20:10:13 +08:00
ff3a5e18ae feat: add openssl.md #141 2022-11-19 15:06:03 +08:00
ffd5dfdaeb doc: update latex.md #47 2022-11-19 12:38:55 +08:00
5fce11220d doc: update latex.md #47 2022-11-19 12:38:55 +08:00
34f9cd8e92 doc: continue to erite lua.md (#142) 2022-11-19 12:21:57 +08:00
0251081948 doc: update latex.md #47 2022-11-19 10:30:14 +08:00
a006acea29 doc: update latex.md #140 2022-11-19 01:23:32 +08:00
5c1a59bee1 doc: update latex.md #140 2022-11-19 00:46:53 +08:00
fd293f17c9 doc: modify README.md. 2022-11-18 16:14:48 +00:00
e0cb6fbc18 doc: modify CONTRIBUTING.md. 2022-11-18 16:14:47 +00:00
6a0eb40af5 doc: update latex.md (#140) 2022-11-19 00:13:40 +08:00
d52cce7e1c doc: update typescript.md. 2022-11-19 00:02:40 +08:00
7ea215d50f doc: update lua.md (#139) (#62) 2022-11-18 23:11:21 +08:00
e0afdef6ec feat: add sysdig.md #113 2022-11-18 21:32:58 +08:00
1bf9bec6f5 doc: update README.md 2022-11-18 18:14:53 +08:00
0b1bcf693a doc: update CONTRIBUTING.md 2022-11-18 18:14:43 +08:00
28 changed files with 3884 additions and 577 deletions

View File

@ -61,6 +61,8 @@ Contributing 贡献
- SVG 图标尺寸 `<svg height="1em" width="1em"`
- SVG 图标颜色使用继承颜色值 `<svg fill="currentColor"`
图标可以在 [icongo 图标搜索](https://icongo.github.io/) 中搜索
### 提示配置
```markdown
@ -99,21 +101,30 @@ npm run start # 监听 md 文件编译输出 HTML
<a href="https://github.com/Alex-Programer" title="Alex">
<img src="https://avatars.githubusercontent.com/u/115539090?v=4" width="42;" alt="Alex"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/expoli" title="expoli">
<img src="https://avatars.githubusercontent.com/u/31023767?v=4" width="42;" alt="expoli"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/JeffersonHuang" title="Jefferson">
<img src="https://avatars.githubusercontent.com/u/47512530?v=4" width="42;" alt="Jefferson"/>
</a>
<a href="https://github.com/partoneplay" title="partoneplay">
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/catcto" title="喵仙人">
<img src="https://avatars.githubusercontent.com/u/5467932?v=4" width="42;" alt="喵仙人"/>
</a>
<a href="https://github.com/13812700839" title="花殇">
<img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"/>
</a>
<a href="https://github.com/sjh42" title="42:p">
<img src="https://avatars.githubusercontent.com/u/34529275?v=4" width="42;" alt="42:p"/>
</a>
<a href="https://github.com/Smartdousha" title="Anko">
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="Anko"/>
</a>
@ -189,9 +200,6 @@ npm run start # 监听 md 文件编译输出 HTML
<a href="https://github.com/onewesong" title="onewesong">
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
</a>

View File

@ -62,7 +62,7 @@ Quick Reference
[TOML](./docs/toml.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
[YAML](./docs/yaml.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
[Lua](./docs/lua.md)<!--rehype:style=background: rgb(3 3 128/var(\-\-bg\-opacity));-->
[Pytorch](./docs/pytorch.md)<!--rehype:style=background: rgb(43 91 132/var(\-\-bg\-opacity));&class=contributing tag&data-lang=Python&data-info=👆看看还缺点儿什么?-->
[Pytorch](./docs/pytorch.md)<!--rehype:style=background: rgb(238 76 44/var(\-\-bg\-opacity));&class=contributing tag&data-lang=Python&data-info=👆看看还缺点儿什么?-->
<!--rehype:class=home-card-->
## 前端
@ -132,9 +132,11 @@ Quick Reference
[Lsof](./docs/lsof.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Netcat](./docs/netcat.md)<!--rehype:style=background: rgb(4 92 135/var(\-\-bg\-opacity));-->
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[OpenSSL](./docs/openssl.md)<!--rehype:style=background: rgb(114 20 18/var(\-\-bg\-opacity));-->
[Systemd](./docs/systemd.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
[Sysdig](./docs/sysdig.md)<!--rehype:style=background: rgb(1 171 199/var(\-\-bg\-opacity));-->
[Tmux](./docs/tmux.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
[YUM](./docs/yum.md)<!--rehype:style=background: rgb(86 86 123/var(\-\-bg\-opacity));-->
[CMD](./docs/cmd.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
@ -179,21 +181,30 @@ Quick Reference
<a href="https://github.com/Alex-Programer" title="Alex">
<img src="https://avatars.githubusercontent.com/u/115539090?v=4" width="42;" alt="Alex"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/expoli" title="expoli">
<img src="https://avatars.githubusercontent.com/u/31023767?v=4" width="42;" alt="expoli"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/JeffersonHuang" title="Jefferson">
<img src="https://avatars.githubusercontent.com/u/47512530?v=4" width="42;" alt="Jefferson"/>
</a>
<a href="https://github.com/partoneplay" title="partoneplay">
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/catcto" title="喵仙人">
<img src="https://avatars.githubusercontent.com/u/5467932?v=4" width="42;" alt="喵仙人"/>
</a>
<a href="https://github.com/13812700839" title="花殇">
<img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"/>
</a>
<a href="https://github.com/sjh42" title="42:p">
<img src="https://avatars.githubusercontent.com/u/34529275?v=4" width="42;" alt="42:p"/>
</a>
<a href="https://github.com/Smartdousha" title="Anko">
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="Anko"/>
</a>
@ -269,9 +280,6 @@ Quick Reference
<a href="https://github.com/onewesong" title="onewesong">
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
</a>

View File

@ -11,7 +11,9 @@ CSS 备忘清单
CSS 功能丰富,不仅仅是布局页面
#### 外部样式表
#### 外部样式表 `<link>`
`
```html
<link
@ -22,7 +24,7 @@ CSS 功能丰富,不仅仅是布局页面
```
<!--rehype:className=wrap-text -->
#### 内部样式表
#### 内部样式表 `<style>`
```html
<style>
@ -32,7 +34,7 @@ CSS 功能丰富,不仅仅是布局页面
</style>
```
#### 内联样式
#### 内联样式 `style`
```html
<h2 style="text-align: center;">
@ -1258,9 +1260,26 @@ li::before {
}
```
Css 3 技巧
CSS 技巧
------------
### 强制不换行
```css
p {
white-space:nowrap;
}
```
### 强制换行
```css
p {
word-break:break-all; /* 英文 */
white-space:pre-wrap; /* 中文 */
}
```
### 滚动条平滑
```css

View File

@ -464,6 +464,161 @@ class SmartPhone extends Phone {
}
```
枚举
-----
### 定义枚举
```dart
enum Color { red, green, blue }
```
使用枚举,像访问任何其他静态变量一样访问枚举值:
```dart
final favoriteColor = Color.blue;
if (favoriteColor == Color.blue) {
print('Your favorite color is blue!');
}
```
枚举中的每个值都有一个索引获取器,它返回枚举声明中值从零开始的位置。 例如,第一个值的索引为 0第二个值的索引为 1
```dart
assert(Color.red.index == 0);
assert(Color.green.index == 1);
assert(Color.blue.index == 2);
```
要获取所有枚举值的列表,请使用枚举的值常量
```dart
List<Color> colors = Color.values;
assert(colors[2] == Color.blue);
```
您可以在 switch 语句中使用枚举,如果您没有处理枚举的所有值,您将收到警告:
```dart
var aColor = Color.blue;
switch (aColor) {
case Color.red:
print('Red as roses!');
break;
case Color.green:
print('Green as grass!');
break;
default: // 没有这个,你会看到一个警告
print(aColor); // 'Color.blue'
}
```
如果您需要访问枚举值的名称,例如 `Color.blue` 中的“blue”请使用 `.name` 属性:
```dart
print(Color.blue.name); // 'blue'
```
### 枚举示例
<!--rehype:wrap-class=col-span-2-->
声明了一个具有多个实例、实例变量、一个 `getter` 和一个已实现接口的增强型枚举
```dart
// 简单定义一个枚举类型
enum PlanetType { terrestrial, gas, ice }
// 定义一个行星复杂的枚举类型
enum Planet {
mercury(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
venus(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
uranus(planetType: PlanetType.ice, moons: 27, hasRings: true),
neptune(planetType: PlanetType.ice, moons: 14, hasRings: true);
// 定义一个构造函数
const Planet({required this.planetType, required this.moons, required this.hasRings});
// 声明枚举类型中的变量
final PlanetType planetType;
final int moons;
final bool hasRings;
// 实现枚举类型中的get 方法
bool get isGiant =>
planetType == PlanetType.gas || planetType == PlanetType.ice;
}
// 使用枚举类型
void main()
{
final yourPlanet = Planet.mercury;
if (!yourPlanet.isGiant) {
print('Your planet is not a "giant planet".');
}
}
```
Mixin
-----
### 定义Mixin
<!--rehype:wrap-class=col-span-2-->
`Dart`中类只能单继承,使用`Mixin`可以实现多个继承,复用多个类中代码的方法。
```dart
// 定义Mixin
mixin Piloted {
int astronauts = 1;
void describeCrew() {
print('Number of astronauts: $astronauts');
}
}
```
使用`with`关键字并在其后跟上`Mixin类`的名字来使用
```dart
// 使用with将Piloted混入
class PilotedCraft extends Spacecraft with Piloted {
// ···
}
```
支持混入多个Mixin如果出现相同的方法后混入的Mixin会覆盖前面的
```dart
class Musician extends Performer with Musical {
// ···
}
// 混入多个Mixin
class Maestro extends Person with Musical, Aggressive, Demented {
Maestro(String maestroName) {
name = maestroName;
canConduct = true;
}
}
```
使用关键字`on`来指定哪些类可以使用该Mixin比如有Mixin类`MusicalPerformer`,但是`MusicalPerformer`只能被`Musician`类使用,则可以这样定义`MusicalPerformer`
```dart
class Musician {
// ...
}
// 现在MusicalPerformer 只能在 Musican及其子类中使用
mixin MusicalPerformer on Musician {
// ...
}
class SingerDancer extends Musician with MusicalPerformer {
// ...
}
```
异常
-----

View File

@ -196,11 +196,11 @@ $ find /home -user tecmint -iname "*.txt"
### 多个文件名
```shell
$ find . -type f \( -name "*.sh" -o -name "*.txt" \)
$ find . -type f \( -name "*.sh" -or -name "*.txt" \)
```
<!--rehype:className=wrap-text -->
查找带有 `.sh` `.txt` 扩展名的文件
查找带有 `.sh` `.txt` 扩展名的文件
### 多个目录
@ -388,3 +388,11 @@ $ find / -type d -perm 777 -print -exec chmod 755 {} \;
$ find . -type f -name "*.java" | xargs tar cvf myfile.tar
$ find . -type f -name "*.java" | xargs tar rvf myfile.tar
```
### 查找并排除目录
查找当前目录及子目录中的所有`js`文件,但是排除掉`node_modules`目录中的
```shell
$ find . -type f -name "*.js" -not -path "./node_modules/*"
```

View File

@ -88,7 +88,7 @@ Supported Functions
`\left` | `\big` | `\bigl` | `\bigm` | `\bigr`
`\middle` | `\Big` | `\Bigl` | `\Bigm` | `\Bigr`
`\right` | `\bigg` | `\biggl` | `\biggm` | `\biggr`
`` | `\Bigg` | `\Biggl` | `\Biggm` | `\Biggr`
`\` | `\Bigg` | `\Biggl` | `\Biggm` | `\Biggr`
### 希腊和希伯来字母 Greek and Hebrew letters
<!--rehype:wrap-class=col-span-3-->
@ -103,8 +103,106 @@ Supported Functions
| `KaTex:\eta` | <pur>`\eta`</pur> | `KaTex:\omega` | <pur>`\omega`</pur> | `KaTex:\upsilon` | <pur>`\upsilon`</pur> | `KaTex:\varrho` | <pur>`\varrho`</pur> | `KaTex:\Pi` | <pur>`\Pi`</pur> | `KaTex:\beth` | <pur>`\beth`</pur> |
| `KaTex:\gamma` | <pur>`\gamma`</pur> | `KaTex:\phi` | <pur>`\phi`</pur> | `KaTex:\xi` | <pur>`\xi`</pur> | `KaTex:\varsigma` | <pur>`\varsigma`</pur> | `KaTex:\Psi` | <pur>`\Psi`</pur> | `KaTex:\daleth` | <pur>`\daleth`</pur> |
| `KaTex:\iota` | <pur>`\iota`</pur> | `KaTex:\pi` | <pur>`\pi`</pur> | `KaTex:\zeta` | <pur>`\zeta`</pur> | `KaTex:\vartheta` | <pur>`\vartheta`</pur> | `KaTex:\Sigma` | <pur>`\Sigma`</pur> | `KaTex:\gimel` | <pur>`\gimel`</pur> |
<!--rehype:className=left-align-->
其它字母
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\imath` | <pur>`\imath`</pur> | `KaTex:\nabla` | <pur>`\nabla`</pur> | `KaTex:\Im` | <pur>`\Im`</pur> | `KaTex:\Reals` | <pur>`\Reals`</pur> | `KaTex:\text{\OE}` | <pur>`\text{\OE}`</pur> |
`KaTex:\jmath` | <pur>`\jmath`</pur> | `KaTex:\partial` | <pur>`\partial`</pur> | `KaTex:\image` | <pur>`\image`</pur> | `KaTex:\wp` | <pur>`\wp`</pur> | `KaTex:\text{\o}` | <pur>`\text{\o}`</pur> |
`KaTex:\aleph` | <pur>`\aleph`</pur> | `KaTex:\Game` | <pur>`\Game`</pur> | `KaTex:\Bbbk` | <pur>`\Bbbk`</pur> | `KaTex:\weierp` | <pur>`\weierp`</pur> | `KaTex:\text{\O}` | <pur>`\text{\O}`</pur> |
`KaTex:\alef` | <pur>`\alef`</pur> | `KaTex:\Finv` | <pur>`\Finv`</pur> | `KaTex:\N` | <pur>`\N`</pur> | `KaTex:\Z` | <pur>`\Z`</pur> | `KaTex:\text{\ss}` | <pur>`\text{\ss}`</pur> |
`KaTex:\alefsym` | <pur>`\alefsym`</pur> | `KaTex:\cnums` | <pur>`\cnums`</pur> | `KaTex:\natnums` | <pur>`\natnums`</pur> | `KaTex:\text{\aa}` | <pur>`\text{\aa}`</pur> | `KaTex:\text{\i}` | <pur>`\text{\i}`</pur> |
`KaTex:\beth` | <pur>`\beth`</pur> | `KaTex:\Complex` | <pur>`\Complex`</pur> | `KaTex:\R` | <pur>`\R`</pur> | `KaTex:\text{\AA}` | <pur>`\text{\AA}`</pur> | `KaTex:\text{\j}` | <pur>`\text{\j}`</pur> |
`KaTex:\gimel` | <pur>`\gimel`</pur> | `KaTex:\ell` | <pur>`\ell`</pur> | `KaTex:\Re` | <pur>`\Re`</pur> | `KaTex:\text{\ae}` | <pur>`\text{\ae}`</pur> |
`KaTex:\daleth` | <pur>`\daleth`</pur> | `KaTex:\hbar` | <pur>`\hbar`</pur> | `KaTex:\real` | <pur>`\real`</pur> | `KaTex:\text{\AE}` | <pur>`\text{\AE}`</pur> |
`KaTex:\eth` | <pur>`\eth`</pur> | `KaTex:\hslash` | <pur>`\hslash`</pur> | `KaTex:\reals` | <pur>`\reals`</pur> | `KaTex:\text{\oe}` | <pur>`\text{\oe}`</pur> |
<!--rehype:className=left-align-->
### 字母和 Unicode
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\Alpha` | <pur>`\Alpha`</pur> | `KaTex:\Beta` | <pur>`\Beta`</pur> | `KaTex:\Gamma` | <pur>`\Gamma`</pur> | `KaTex:\Delta` | <pur>`\Delta`</pur>
`KaTex:\Epsilon` | <pur>`\Epsilon`</pur> | `KaTex:\Zeta` | <pur>`\Zeta`</pur> | `KaTex:\Eta` | <pur>`\Eta`</pur> | `KaTex:\Theta` | <pur>`\Theta`</pur>
`KaTex:\Iota` | <pur>`\Iota`</pur> | `KaTex:\Kappa` | <pur>`\Kappa`</pur> | `KaTex:\Lambda` | <pur>`\Lambda`</pur> | `KaTex:\Mu` | <pur>`\Mu`</pur>
`KaTex:\Nu` | <pur>`\Nu`</pur> | `KaTex:\Xi` | <pur>`\Xi`</pur> | `KaTex:\Omicron` | <pur>`\Omicron`</pur> | `KaTex:\Pi` | <pur>`\Pi`</pur>
`KaTex:\Rho` | <pur>`\Rho`</pur> | `KaTex:\Sigma` | <pur>`\Sigma`</pur> | `KaTex:\Tau` | <pur>`\Tau`</pur> | `KaTex:\Upsilon` | <pur>`\Upsilon`</pur>
`KaTex:\Phi` | <pur>`\Phi`</pur> | `KaTex:\Chi` | <pur>`\Chi`</pur> | `KaTex:\Psi` | <pur>`\Psi`</pur> | `KaTex:\Omega` | <pur>`\Omega`</pur>
`KaTex:\varGamma` | <pur>`\varGamma`</pur> | `KaTex:\varDelta` | <pur>`\varDelta`</pur> | `KaTex:\varTheta` | <pur>`\varTheta`</pur> | `KaTex:\varLambda` | <pur>`\varLambda`</pur>
`KaTex:\varXi` | <pur>`\varXi`</pur> | `KaTex:\varPi` | <pur>`\varPi`</pur> | `KaTex:\varSigma` | <pur>`\varSigma`</pur> | `KaTex:\varUpsilon` | <pur>`\varUpsilon`</pur>
`KaTex:\varPhi` | <pur>`\varPhi`</pur> | `KaTex:\varPsi` | <pur>`\varPsi`</pur> | `KaTex:\varOmega` | <pur>`\varOmega`</pur> |
`KaTex:\alpha` | <pur>`\alpha`</pur> | `KaTex:\beta` | <pur>`\beta`</pur> | `KaTex:\gamma` | <pur>`\gamma`</pur> | `KaTex:\delta` | <pur>`\delta`</pur>
`KaTex:\epsilon` | <pur>`\epsilon`</pur> | `KaTex:\zeta` | <pur>`\zeta`</pur> | `KaTex:\eta` | <pur>`\eta`</pur> | `KaTex:\theta` | <pur>`\theta`</pur>
`KaTex:\iota` | <pur>`\iota`</pur> | `KaTex:\kappa` | <pur>`\kappa`</pur> | `KaTex:\lambda` | <pur>`\lambda`</pur> | `KaTex:\mu` | <pur>`\mu`</pur>
`KaTex:\nu` | <pur>`\nu`</pur> | `KaTex:\xi` | <pur>`\xi`</pur> | `KaTex:\omicron` | <pur>`\omicron`</pur> | `KaTex:\pi` | <pur>`\pi`</pur>
`KaTex:\rho` | <pur>`\rho`</pur> | `KaTex:\sigma` | <pur>`\sigma`</pur> | `KaTex:\tau` | <pur>`\tau`</pur> | `KaTex:\upsilon` | <pur>`\upsilon`</pur>
`KaTex:\phi` | <pur>`\phi`</pur> | `KaTex:\chi` | <pur>`\chi`</pur> | `KaTex:\psi` | <pur>`\psi`</pur> | `KaTex:\omega` | <pur>`\omega`</pur>
`KaTex:\varepsilon` | <pur>`\varepsilon`</pur> | `KaTex:\varkappa` | <pur>`\varkappa`</pur> | `KaTex:\vartheta` | <pur>`\vartheta`</pur> | `KaTex:\thetasym` | <pur>`\thetasym`</pur>
`KaTex:\varpi` | <pur>`\varpi`</pur> | `KaTex:\varrho` | <pur>`\varrho`</pur> | `KaTex:\varsigma` | <pur>`\varsigma`</pur> | `KaTex:\varphi` | <pur>`\varphi`</pur>
`KaTex:\digamma` | <pur>`\digamma`</pur>
<!--rehype:className=show-header left-align-->
### 注解
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :-
:- | :- | :- | :- | :-
`KaTex:\cancel{5}` | <pur>`\cancel{5}`</pur> | `KaTex:\overbrace{a+b+c}^{\text{note}}` | <pur>`\overbrace{a+b+c}^{\text{note}}`</pur>
`KaTex:\bcancel{5}` | <pur>`\bcancel{5}`</pur> | `KaTex:\underbrace{a+b+c}_{\text{note}}` | <pur>`\underbrace{a+b+c}_{\text{note}}`</pur>
`KaTex:\xcancel{ABC}` | <pur>`\xcancel{ABC}`</pur> | `KaTex:\not =` | <pur>`\not =`</pur>
`KaTex:\sout{abc}` | <pur>`\sout{abc}`</pur> | `KaTex:\boxed{\pi=\frac c d}` | <pur>`\boxed{\pi=\frac c d}`</pur>
`KaTex:\$a_{\angl n}` _<red>MD语法冲突</red>_ | <pur>`$a_{\angl n}`</pur> | `KaTex:a_\angln` | <pur>`a_\angln`</pur>
`KaTex:\phase{-78^\circ}` | <pur>`\phase{-78^\circ}`</pur>
<pur>\tag{hi} x+y^{2x}</pur>
```KaTex
\tag{hi} x+y^{2x}
```
<pur>\tag*{hi} x+y^{2x}</pur>
```KaTex
\tag*{hi} x+y^{2x}
```
### 垂直布局
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:x_n` | <pur>`x_n`</pur> | `KaTex:\stackrel{!}{=}` | <pur>`\stackrel{!}{=}`</pur> | `KaTex:a \atop b` | `a \atop b`
`KaTex:e^x` | <pur>`e^x`</pur> | `KaTex:\overset{!}{=}` | <pur>`\overset{!}{=}`</pur> | `KaTex:a\raisebox{0.25em}{$b$}c` | `a\raisebox{0.25em}{$b$}c`
`KaTex:_u^o` | <pur>`_u^o`</pur> | `KaTex:\underset{!}{=}` | <pur>`\underset{!}{=}`</pur> | `KaTex:a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)` | `a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)`
`KaTex:\sum_{\substack{0<i<m\\0<j<n}}` | <pur>`\sum_{\substack{0<i<m\\0<j<n}}`</pur>
### 重叠和间距
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:{=}\mathllap{/\,}` <pur>{=}\mathllap{/\,}</pur> | `KaTex:\left(x^{\smash{2}}\right)` | <pur>\left(x^{\smash{2}}\right)</pur>
`KaTex:\mathrlap{\,/}{=}` <pur>\mathrlap{\,/}{=}</pur> | `KaTex:\sqrt{\smash[b]{y}}` | <pur>\sqrt{\smash[b]{y}}</pur>
`\sum_{\mathclap{1\le i\le j\le n}} x_{ij}`
```KaTex
\sum_{\mathclap{1\le i\le j\le n}} x_{ij}
```
### `KaTex:\LaTeX` math constructs
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :-
| `KaTex:\frac{abc}{xyz}` | <pur>`\frac{abc}{xyz}`</pur> | `KaTex:\overline{abc}` | <pur>`\overline{abc}`</pur> | `KaTex:\overrightarrow{abc}` | <pur>`\overrightarrow{abc}`</pur> |
| `KaTex:f'` | <pur>`f'`</pur> | `KaTex:\underline{abc}` | <pur>`\underline{abc}`</pur> | `KaTex:\overleftarrow{abc}` | <pur>`\overleftarrow{abc}`</pur> |
| `KaTex:\sqrt{abc}` | <pur>`\sqrt{abc}`</pur> | `KaTex:\widehat{abc}` | <pur>`\widehat{abc}`</pur> | `KaTex:\overbrace{abc}` | <pur>`\overbrace{abc}`</pur> |
| `KaTex:\sqrt[n]{abc}` | <pur>`\sqrt[n]{abc}`</pur> | `KaTex:\widetilde{abc}` | <pur>`\widetilde{abc}`</pur> | `KaTex:\underbrace{abc}` | <pur>`\underbrace{abc}`</pur> |
### 分隔符 Delimiters
<!--rehype:wrap-class=col-span-3-->
@ -120,6 +218,335 @@ Supported Functions
| `KaTeX:\lang` `KaTeX:\rang` | <pur>`\lang` `\rang`<pur> | `KaTeX:\lt \gt` | <pur>`\lt \gt`</pur> | `KaTex:⟦ ⟧` | <pur>`⟦ ⟧`</pur> | `KaTex:\llbracket \rrbracket` | <pur>`\llbracket` `\rrbracket`</pur> | `KaTex:\lBrace \rBrace` | <pur>`\lBrace \rBrace`</pur> |
<!--rehype:className=show-header left-align-->
可以使用一对表达式 `\left` `KaTeX:s_1``\right` `KaTeX:s_2` 来将分隔符 `KaTeX:s_1``KaTeX:s_2` 的高度与其内容的高度进行匹配,例如:
:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\left\|` | `KaTeX:expr` | `KaTeX:\right\|` | | `KaTeX:\left\{` |`KaTeX:expr` | `KaTeX:\right\}` | | `KaTeX:\left\Vert`| `KaTeX:expr` | `KaTeX:\right.` |
### 可变大小的符号
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\sum` | <pur>`\sum`</pur> | `KaTeX:\int` | <pur>`\int`</pur> | `KaTeX:\biguplus` | <pur>`\biguplus`</pur> | `KaTeX:\bigoplus` | <pur>`\bigoplus`</pur> | `KaTeX:\bigvee` | <pur>`\bigvee`</pur> |
| `KaTeX:\prod` | <pur>`\prod`</pur> | `KaTeX:\oint` | <pur>`\oint`</pur> | `KaTeX:\bigcap` | <pur>`\bigcap`</pur> | `KaTeX:\bigotimes` | <pur>`\bigotimes`</pur> | `KaTeX:\bigwedge` | <pur>`\bigwedge`</pur> |
| `KaTeX:\coprod` | <pur>`\coprod`</pur> | `KaTeX:\iint` | <pur>`\iint`</pur> | `KaTeX:\bigcup` | <pur>`\bigcup`</pur> | `KaTeX:\bigodot` | <pur>`\bigodot`</pur> | `KaTeX:\bigodot` | <pur>`\bigodot`</pur> |
<!--rehype:className=show-header left-align-->
### 标准函数名称
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法
:- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\arccos` | <pur>`\arccos`</pur> | `KaTeX:\arcsin` | <pur>`\arcsin`</pur> | `KaTeX:\arcsin` | <pur>`\arcsin`</pur> | `KaTeX:\arg` | <pur>`\arg`</pur> |
| `KaTeX:\cos` | <pur>`\cos`</pur> | `KaTeX:\cosh` | <pur>`\cosh`</pur> | `KaTeX:\cot` | <pur>`\cot`</pur> | `KaTeX:\coth` | <pur>`\coth`</pur> |
| `KaTeX:\csc` | <pur>`\csc`</pur> | `KaTeX:\deg` | <pur>`\deg`</pur> | `KaTeX:\det` | <pur>`\det`</pur> | `KaTeX:\dim` | <pur>`\dim`</pur> |
| `KaTeX:\exp` | <pur>`\exp`</pur> | `KaTeX:\gcd` | <pur>`\gcd`</pur> | `KaTeX:\hom` | <pur>`\hom`</pur> | `KaTeX:\inf` | <pur>`\inf`</pur> |
| `KaTeX:\ker` | <pur>`\ker`</pur> | `KaTeX:\lg` | <pur>`\lg`</pur> | `KaTeX:\lim` | <pur>`\lim`</pur> | `KaTeX:\liminf` | <pur>`\liminf`</pur> |
| `KaTeX:\limsup` | <pur>`\limsup`</pur> | `KaTeX:\ln` | <pur>`\ln`</pur> | `KaTeX:\log` | <pur>`\log`</pur> | `KaTeX:\max` | <pur>`\max`</pur> |
| `KaTeX:\min` | <pur>`\min`</pur> | `KaTeX:\Pr` | <pur>`\Pr`</pur> | `KaTeX:\sec` | <pur>`\sec`</pur> | `KaTeX:\sin` | <pur>`\sin`</pur> |
| `KaTeX:\sinh` | <pur>`\sinh`</pur> | `KaTeX:\sup` | <pur>`\sup`</pur> | `KaTeX:\tan` | <pur>`\tan`</pur> | `KaTeX:\tanh` | <pur>`\tanh`</pur> |
<!--rehype:className=show-header left-align-->
函数名应该用罗马字体,而不是斜体,例如:
:- | :- | :- | :-
:- | :- | :- | :-
| Correct: | <pur>`\tan(at-n\pi)`</pur> | `KaTeX:\rightarrow` | `KaTeX:\tan(at-n\pi)`|
| Incorrect: | <pur>`tan(at-n\pi)`</pur> | `katex:\rightarrow` | `KaTeX:tan(at-n\pi)` |
<!--rehype:className=left-align-->
### 逻辑与集合论
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTeX:\forall` | <pur>`\forall`</pur> | `KaTeX:\complement` | <pur>`\complement`</pur> | `KaTeX:\therefore` | <pur>`\therefore`</pur> | `KaTeX:\emptyset` | <pur>`\emptyset`</pur>
`KaTeX:\exists` | <pur>`\exists`</pur> | `KaTeX:\subset` | <pur>`\subset`</pur> | `KaTeX:\because` | <pur>`\because`</pur> | `KaTeX:\empty` | <pur>`\empty`</pur>
`KaTeX:\exist` | <pur>`\exist`</pur> | `KaTeX:\supset` | <pur>`\supset`</pur> | `KaTeX:\mapsto` | <pur>`\mapsto`</pur> | `KaTeX:\varnothing` | <pur>`\varnothing`</pur>
`KaTeX:\nexists` | <pur>`\nexists`</pur> | `KaTeX:\mid` | <pur>`\mid`</pur> | `KaTeX:\to` | <pur>`\to`</pur> | `KaTeX:\implies` | <pur>`\implies`</pur>
`KaTeX:\in` | <pur>`\in`</pur> | `KaTeX:\land` | <pur>`\land`</pur> | `KaTeX:\gets` | <pur>`\gets`</pur> | `KaTeX:\impliedby` | <pur>`\impliedby`</pur>
`KaTeX:\isin` | <pur>`\isin`</pur> | `KaTeX:\lor` | <pur>`\lor`</pur> | `KaTeX:\leftrightarrow` | <pur>`\leftrightarrow`</pur> | `KaTeX:\iff` | <pur>`\iff`</pur>
`KaTeX:\notin` | <pur>`\notin`</pur> | `KaTeX:\ni` | <pur>`\ni`</pur> | `KaTeX:\notni` | <pur>`\notni`</pur> | `KaTeX:\neg` `KaTeX:\lnot` | <pur>`\neg`</pur><pur>`\lnot`</pur>
<!--rehype:className=left-align-->
---
:- | :- | :- | :-
:- | :- | :- | :-
`KaTeX:\Set{ x \| x<\frac 1 2 }` | <pur>\Set{ x \| x<\frac 1 2 }</pur> | `KaTeX:\set{x\|x<5}` | <pur>\set{x\|x<5}</pur>
### 宏指令
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTeX:\def\foo{x^2} \foo + \foo` | <pur>\def\foo{x^2} \foo + \foo</pur> | `KaTeX:\gdef\bar#1{#1^2} \bar{y} + \bar{y}` | <pur>\gdef\bar#1{#1^2} \bar{y} + \bar{y}</pur>
<!--rehype:className=left-align-->
### 特殊符号
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTeX:\bra{\phi}` | <pur>\bra{\phi}</pur> | `KaTeX:\ket{\psi}` | <pur>\ket{\psi}</pur> | `KaTeX:\braket{\phi\|\psi}` | <pur>`\braket{\phi\|\psi}`</pur>
`KaTeX:\Bra{\phi}` | <pur>\Bra{\phi}</pur> | `KaTeX:\Ket{\psi}` | <pur>\Ket{\psi}</pur> | `KaTeX:\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }` | <pur>`\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }`</pur>
<!--rehype:className=left-align-->
运算符
---
### 数学运算符
<!--rehype:wrap-class=col-span-3 row-span-2-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\arcsin` | <pur>`\arcsin`</pur> | `KaTex:\cosec` | <pur>`\cosec`</pur> | `KaTex:\deg` | <pur>`\deg`</pur> | `KaTex:\sec` | <pur>`\sec`</pur>
`KaTex:\arccos` | <pur>`\arccos`</pur> | `KaTex:\cosh` | <pur>`\cosh`</pur> | `KaTex:\dim` | <pur>`\dim`</pur> | `KaTex:\sin` | <pur>`\sin`</pur>
`KaTex:\arctan` | <pur>`\arctan`</pur> | `KaTex:\cot` | <pur>`\cot`</pur> | `KaTex:\exp` | <pur>`\exp`</pur> | `KaTex:\sinh` | <pur>`\sinh`</pur>
`KaTex:\arctg` | <pur>`\arctg`</pur> | `KaTex:\cotg` | <pur>`\cotg`</pur> | `KaTex:\hom` | <pur>`\hom`</pur> | `KaTex:\sh` | <pur>`\sh`</pur>
`KaTex:\arcctg` | <pur>`\arcctg`</pur> | `KaTex:\coth` | <pur>`\coth`</pur> | `KaTex:\ker` | <pur>`\ker`</pur> | `KaTex:\tan` | <pur>`\tan`</pur>
`KaTex:\arg` | <pur>`\arg`</pur> | `KaTex:\csc` | <pur>`\csc`</pur> | `KaTex:\lg` | <pur>`\lg`</pur> | `KaTex:\tanh` | <pur>`\tanh`</pur>
`KaTex:\ch` | <pur>`\ch`</pur> | `KaTex:\ctg` | <pur>`\ctg`</pur> | `KaTex:\ln` | <pur>`\ln`</pur> | `KaTex:\tg` | <pur>`\tg`</pur>
`KaTex:\cos` | <pur>`\cos`</pur> | `KaTex:\cth` | <pur>`\cth`</pur> | `KaTex:\log` | <pur>`\log`</pur> | `KaTex:\th` | <pur>`\th`</pur>
`KaTex:\operatorname{f}` | <pur>`\operatorname{f}`</pur> |
`KaTex:\argmax` | <pur>`\argmax`</pur> | `KaTex:\injlim` | <pur>`\injlim`</pur> | `KaTex:\min` | <pur>`\min`</pur> | `KaTex:\varinjlim` | <pur>`\varinjlim`</pur>
`KaTex:\argmin` | <pur>`\argmin`</pur> | `KaTex:\lim` | <pur>`\lim`</pur> | `KaTex:\plim` | <pur>`\plim`</pur> | `KaTex:\varliminf` | <pur>`\varliminf`</pur>
`KaTex:\det` | <pur>`\det`</pur> | `KaTex:\liminf` | <pur>`\liminf`</pur> | `KaTex:\Pr` | <pur>`\Pr`</pur> | `KaTex:\varlimsup` | <pur>`\varlimsup`</pur>
`KaTex:\gcd` | <pur>`\gcd`</pur> | `KaTex:\limsup` | <pur>`\limsup`</pur> | `KaTex:\projlim` | <pur>`\projlim`</pur> | `KaTex:\varprojlim` | <pur>`\varprojlim`</pur>
`KaTex:\inf` | <pur>`\inf`</pur> | `KaTex:\max` | <pur>`\max`</pur> | `KaTex:\sup` | <pur>`\sup`</pur> | `KaTex:\operatorname*{f}` | <pur>`\operatorname*{f}`</pur>
`KaTex:\operatornamewithlimits{f}` | <pur>`\operatornamewithlimits{f}`</pur> |
<!--rehype:className=left-align-->
### 大运算符
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\sum` | <pur>`\sum`</pur> | `KaTex:\prod` | <pur>`\prod`</pur> | `KaTex:\bigotimes` | <pur>`\bigotimes`</pur> | `KaTex:\bigvee` | <pur>`\bigvee`</pur>
`KaTex:\int` | <pur>`\int`</pur> | `KaTex:\coprod` | <pur>`\coprod`</pur> | `KaTex:\bigoplus` | <pur>`\bigoplus`</pur> | `KaTex:\bigwedge` | <pur>`\bigwedge`</pur>
`KaTex:\iint` | <pur>`\iint`</pur> | `KaTex:\intop` | <pur>`\intop`</pur> | `KaTex:\bigodot` | <pur>`\bigodot`</pur> | `KaTex:\bigcap` | <pur>`\bigcap`</pur>
`KaTex:\iiint` | <pur>`\iiint`</pur> | `KaTex:\smallint` | <pur>`\smallint`</pur> | `KaTex:\biguplus` | <pur>`\biguplus`</pur> | `KaTex:\bigcup` | <pur>`\bigcup`</pur>
`KaTex:\oint` | <pur>`\oint`</pur> | `KaTex:\oiint` | <pur>`\oiint`</pur> | `KaTex:\oiiint` | <pur>`\oiiint`</pur> | `KaTex:\bigsqcup` | <pur>`\bigsqcup`</pur>
<!--rehype:className=left-align-->
### 分数和二项式
<!--rehype:wrap-class=row-span-2-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\frac{a}{b}` | <pur>`\frac{a}{b}`</pur> | `KaTex:\tfrac{a}{b}` | <pur>`\tfrac{a}{b}`</pur>
`KaTex:{a \over b}` | <pur>`{a \over b}`</pur> | `KaTex:\dfrac{a}{b}` | <pur>`\dfrac{a}{b}`</pur>
`KaTex:\genfrac ( ] {2pt}{1}a{a+1}` | <pur>`\genfrac ( ] {2pt}{1}a{a+1}`</pur> | `KaTex:{a \above{2pt} b+1}` | <pur>`{a \above{2pt} b+1}`</pur>
`KaTex:a/b` | <pur>`a/b`</pur> | `KaTex:\cfrac{a}{1 + \cfrac{1}{b}}` | <pur>`\cfrac{a}{1 + \cfrac{1}{b}}`</pur>
<!--rehype:className=left-align-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\binom{n}{k}` | <pur>`\binom{n}{k}`</pur> | `KaTex:\dbinom{n}{k}` | <pur>`\dbinom{n}{k}`</pur>
`KaTex:{n\brace k}` | <pur>`{n\brace k}`</pur> | `KaTex:{n \choose k}` | <pur>`{n \choose k}`</pur>
`KaTex:\tbinom{n}{k}` | <pur>`\tbinom{n}{k}`</pur> | `KaTex:{n\brack k}` | <pur>`{n\brack k}`</pur>
<!--rehype:className=left-align-->
### \sqrt
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\sqrt{x}` | <pur>`\sqrt{x}`</pur> | `KaTex:\sqrt[3]{x}` | <pur>`\sqrt[3]{x}`</pur>
<!--rehype:className=left-align-->
### 二元运算符
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:+` | <pur>`+`</pur> | `KaTex:\cdot` | <pur>`\cdot`</pur> | `KaTex:\gtrdot` | <pur>`\gtrdot`</pur> | `KaTex:x \pmod a` | <pur>`x \pmod a`</pur>
`KaTex:-` | <pur>`-`</pur> | `KaTex:\cdotp` | <pur>`\cdotp`</pur> | `KaTex:\intercal` | <pur>`\intercal`</pur> | `KaTex:x \pod a` | <pur>`x \pod a`</pur>
`KaTex:/` | <pur>`/`</pur> | `KaTex:\centerdot` | <pur>`\centerdot`</pur> | `KaTex:\land` | <pur>`\land`</pur> | `KaTex:\rhd` | <pur>`\rhd`</pur>
`KaTex:*` | <pur>`*`</pur> | `KaTex:\circ` | <pur>`\circ`</pur> | `KaTex:\leftthreetimes` | <pur>`\leftthreetimes`</pur> | `KaTex:\rightthreetimes` | <pur>`\rightthreetimes`</pur>
`KaTex:\amalg` | <pur>`\amalg`</pur> | `KaTex:\circledast` | <pur>`\circledast`</pur> | `KaTex:\ldotp` | <pur>`\ldotp`</pur> | `KaTex:\rtimes` | <pur>`\rtimes`</pur>
`KaTex:\And` | <pur>`\And`</pur> | `KaTex:\circledcirc` | <pur>`\circledcirc`</pur> | `KaTex:\lor` | <pur>`\lor`</pur> | `KaTex:\setminus` | <pur>`\setminus`</pur>
`KaTex:\ast` | <pur>`\ast`</pur> | `KaTex:\circleddash` | <pur>`\circleddash`</pur> | `KaTex:\lessdot` | <pur>`\lessdot`</pur> | `KaTex:\smallsetminus` | <pur>`\smallsetminus`</pur>
`KaTex:\barwedge` | <pur>`\barwedge`</pur> | `KaTex:\Cup` | <pur>`\Cup`</pur> | `KaTex:\lhd` | <pur>`\lhd`</pur> | `KaTex:\sqcap` | <pur>`\sqcap`</pur>
`KaTex:\bigcirc` | <pur>`\bigcirc`</pur> | `KaTex:\cup` | <pur>`\cup`</pur> | `KaTex:\ltimes` | <pur>`\ltimes`</pur> | `KaTex:\sqcup` | <pur>`\sqcup`</pur>
`KaTex:\bmod` | <pur>`\bmod`</pur> | `KaTex:\curlyvee` | <pur>`\curlyvee`</pur> | `KaTex:x\mod a` | <pur>`x\mod a`</pur> | `KaTex:\times` | <pur>`\times`</pur>
`KaTex:\boxdot` | <pur>`\boxdot`</pur> | `KaTex:\curlywedge` | <pur>`\curlywedge`</pur> | `KaTex:\mp` | <pur>`\mp`</pur> | `KaTex:\unlhd` | <pur>`\unlhd`</pur> |
`KaTex:\boxminus` | <pur>`\boxminus`</pur> | `KaTex:\div` | <pur>`\div`</pur> | `KaTex:\odot` | <pur>`\odot`</pur> | `KaTex:\unrhd` | <pur>`\unrhd`</pur>
`KaTex:\boxplus` | <pur>`\boxplus`</pur> | `KaTex:\divideontimes` | <pur>`\divideontimes`</pur> | `KaTex:\ominus` | <pur>`\ominus`</pur> | `KaTex:\uplus` | <pur>`\uplus`</pur>
`KaTex:\boxtimes` | <pur>`\boxtimes`</pur> | `KaTex:\dotplus` | <pur>`\dotplus`</pur> | `KaTex:\oplus` | <pur>`\oplus`</pur> | `KaTex:\vee` | <pur>`\vee`</pur>
`KaTex:\bullet` | <pur>`\bullet`</pur> | `KaTex:\doublebarwedge` | <pur>`\doublebarwedge`</pur> | `KaTex:\otimes` | <pur>`\otimes`</pur> | `KaTex:\veebar` | <pur>`\veebar`</pur>
`KaTex:\Cap` | <pur>`\Cap`</pur> | `KaTex:\doublecap` | <pur>`\doublecap`</pur> | `KaTex:\oslash` | <pur>`\oslash`</pur> | `KaTex:\wedge` | <pur>`\wedge`</pur>
`KaTex:\cap` | <pur>`\cap`</pur> | `KaTex:\doublecup` | <pur>`\doublecup`</pur> | `KaTex:\pm` | <pur>`\pm`</pur> | `KaTex:\plusmn` | <pur>`\plusmn`</pur>
`KaTex:\wr` | <pur>`\wr`</pur>` |
<!--rehype:className=left-align-->
关系
---
### 关系
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:=` | <pur>`=`</pur> | `KaTex:\doteqdot` | <pur>`\doteqdot`</pur> | `KaTex:\lessapprox` | <pur>`\lessapprox`</pur> | `KaTex:\smile` | <pur>`\smile`</pur>
`KaTex:<` | <pur>`<`</pur> | `KaTex:\eqcirc` | <pur>`\eqcirc`</pur> | `KaTex:\lesseqgtr` | <pur>`\lesseqgtr`</pur> | `KaTex:\sqsubset` | <pur>`\sqsubset`</pur>
`KaTex:>` | <pur>`>`</pur> | `KaTex:\eqcolon` | <pur>`\eqcolon`</pur> 或 <pur>`\minuscolon`</pur> | `KaTex:\lesseqqgtr` | <pur>`\lesseqqgtr`</pur> | `KaTex:\sqsubseteq` | <pur>`\sqsubseteq`</pur>
`KaTex::` | <pur>`:`</pur> | `KaTex:\Eqcolon` | <pur>`\Eqcolon`</pur> 或 <pur>`\minuscoloncolon`</pur> | `KaTex:\lessgtr` | <pur>`\lessgtr`</pur> | `KaTex:\sqsupset` | <pur>`\sqsupset`</pur>
`KaTex:\approx` | <pur>`\approx`</pur> | `KaTex:\eqqcolon` | <pur>`\eqqcolon`</pur> 或 <pur>`\equalscolon`</pur> | `KaTex:\lesssim` | <pur>`\lesssim`</pur> | `KaTex:\sqsupseteq` | <pur>`\sqsupseteq`</pur>
`KaTex:\approxcolon` | <pur>`\approxcolon`</pur> | `KaTex:\Eqqcolon` | <pur>`\Eqqcolon`</pur> 或 <pur>`\equalscoloncolon`</pur> | `KaTex:\ll` | <pur>`\ll`</pur> | `KaTex:\Subset` | <pur>`\Subset`</pur>
`KaTex:\approxcoloncolon` | <pur>`\approxcoloncolon`</pur> | `KaTex:\eqsim` | <pur>`\eqsim`</pur> | `KaTex:\lll` | <pur>`\lll`</pur> | `KaTex:\subset` | <pur>`\subset`</pur> 或 <pur>`\sub`</pur>
`KaTex:\approxeq` | <pur>`\approxeq`</pur> | `KaTex:\eqslantgtr` | <pur>`\eqslantgtr`</pur> | `KaTex:\llless` | <pur>`\llless`</pur> | `KaTex:\subseteq` | <pur>`\subseteq`</pur> 或 <pur>`\sube`</pur>
`KaTex:\asymp` | <pur>`\asymp`</pur> | `KaTex:\eqslantless` | <pur>`\eqslantless`</pur> | `KaTex:\lt` | <pur>`\lt`</pur> | `KaTex:\subseteqq` | <pur>`\subseteqq`</pur>
`KaTex:\backepsilon` | <pur>`\backepsilon`</pur> | `KaTex:\equiv` | <pur>`\equiv`</pur> | `KaTex:\mid` | <pur>`\mid`</pur> | `KaTex:\succ` | <pur>`\succ`</pur>
`KaTex:\backsim` | <pur>`\backsim`</pur> | `KaTex:\fallingdotseq` | <pur>`\fallingdotseq`</pur> | `KaTex:\models` | <pur>`\models`</pur> | `KaTex:\succapprox` | <pur>`\succapprox`</pur>
`KaTex:\backsimeq` | <pur>`\backsimeq`</pur> | `KaTex:\frown` | <pur>`\frown`</pur> | `KaTex:\multimap` | <pur>`\multimap`</pur> | `KaTex:\succcurlyeq` | <pur>`\succcurlyeq`</pur>
`KaTex:\between` | <pur>`\between`</pur> | `KaTex:\ge` | <pur>`\ge`</pur> | `KaTex:\origof` | <pur>`\origof`</pur> | `KaTex:\succeq` | <pur>`\succeq`</pur>
`KaTex:\bowtie` | <pur>`\bowtie`</pur> | `KaTex:\geq` | <pur>`\geq`</pur> | `KaTex:\owns` | <pur>`\owns`</pur> | `KaTex:\succsim` | <pur>`\succsim`</pur>
`KaTex:\bumpeq` | <pur>`\bumpeq`</pur> | `KaTex:\geqq` | <pur>`\geqq`</pur> | `KaTex:\parallel` | <pur>`\parallel`</pur> | `KaTex:\Supset` | <pur>`\Supset`</pur>
`KaTex:\Bumpeq` | <pur>`\Bumpeq`</pur> | `KaTex:\geqslant` | <pur>`\geqslant`</pur> | `KaTex:\perp` | <pur>`\perp`</pur> | `KaTex:\supset` | <pur>`\supset`</pur>
`KaTex:\circeq` | <pur>`\circeq`</pur> | `KaTex:\gg` | <pur>`\gg`</pur> | `KaTex:\pitchfork` | <pur>`\pitchfork`</pur> | `KaTex:\supseteq` | <pur>`\supseteq`</pur> 或 <pur>`\supe`</pur>
`KaTex:\colonapprox` | <pur>`\colonapprox`</pur> | `KaTex:\ggg` | <pur>`\ggg`</pur> | `KaTex:\prec` | <pur>`\prec`</pur> | `KaTex:\supseteqq` | <pur>`\supseteqq`</pur>
`KaTex:\Colonapprox` | <pur>`\Colonapprox`</pur> 或 <pur>`\coloncolonapprox`</pur> | `KaTex:\gggtr` | <pur>`\gggtr`</pur> | `KaTex:\precapprox` | <pur>`\precapprox`</pur> | `KaTex:\thickapprox` | <pur>`\thickapprox`</pur>
`KaTex:\coloneq` | <pur>`\coloneq`</pur> 或 <pur>`\colonminus`</pur> | `KaTex:\gt` | <pur>`\gt`</pur> | `KaTex:\preccurlyeq` | <pur>`\preccurlyeq`</pur> | `KaTex:\thicksim` | <pur>`\thicksim`</pur>
`KaTex:\Coloneq` | <pur>`\Coloneq`</pur> 或 <pur>`\coloncolonminus`</pur> | `KaTex:\gtrapprox` | <pur>`\gtrapprox`</pur> | `KaTex:\preceq` | <pur>`\preceq`</pur> | `KaTex:\trianglelefteq` | <pur>`\trianglelefteq`</pur>
`KaTex:\coloneqq` | <pur>`\coloneqq`</pur> 或 <pur>`\colonequals`</pur> | `KaTex:\gtreqless` | <pur>`\gtreqless`</pur> | `KaTex:\precsim` | <pur>`\precsim`</pur> | `KaTex:\triangleq` | <pur>`\triangleq`</pur>
`KaTex:\Coloneqq` | <pur>`\Coloneqq`</pur> 或 <pur>`\coloncolonequals`</pur> | `KaTex:\gtreqqless` | <pur>`\gtreqqless`</pur> | `KaTex:\propto` | <pur>`\propto`</pur> | `KaTex:\trianglerighteq` | <pur>`\trianglerighteq`</pur>
`KaTex:\colonsim` | <pur>`\colonsim`</pur> | `KaTex:\gtrless` | <pur>`\gtrless`</pur> | `KaTex:\risingdotseq` | <pur>`\risingdotseq`</pur> | `KaTex:\varpropto` | <pur>`\varpropto`</pur>
`KaTex:\Colonsim` | <pur>`\Colonsim`</pur> 或 <pur>`\coloncolonsim`</pur> | `KaTex:\gtrsim` | <pur>`\gtrsim`</pur> | `KaTex:\shortmid` | <pur>`\shortmid`</pur> | `KaTex:\vartriangle` | <pur>`\vartriangle`</pur>
`KaTex:\cong` | <pur>`\cong`</pur> | `KaTex:\imageof` | <pur>`\imageof`</pur> | `KaTex:\shortparallel` | <pur>`\shortparallel`</pur> | `KaTex:\vartriangleleft` | <pur>`\vartriangleleft`</pur>
`KaTex:\curlyeqprec` | <pur>`\curlyeqprec`</pur> | `KaTex:\in` | <pur>`\in`</pur> 或 <pur>`\isin`</pur> | `KaTex:\sim` | <pur>`\sim`</pur> | `KaTex:\vartriangleright` | <pur>`\vartriangleright`</pur>
`KaTex:\curlyeqsucc` | <pur>`\curlyeqsucc`</pur> | `KaTex:\Join` | <pur>`\Join`</pur> | `KaTex:\simcolon` | <pur>`\simcolon`</pur> | `KaTex:\vcentcolon` | <pur>`\vcentcolon`</pur> 或 <pur>`\ratio`</pur>
`KaTex:\dashv` | <pur>`\dashv`</pur> | `KaTex:\le` | <pur>`\le`</pur> | `KaTex:\simcoloncolon` | <pur>`\simcoloncolon`</pur> | `KaTex:\vdash` | <pur>`\vdash`</pur>
`KaTex:\dblcolon` | <pur>`\dblcolon`</pur> 或 <pur>`\coloncolon`</pur> | `KaTex:\leq` | <pur>`\leq`</pur> | `KaTex:\simeq` | <pur>`\simeq`</pur> | `KaTex:\vDash` | <pur>`\vDash`</pur>
`KaTex:\doteq` | <pur>`\doteq`</pur> | `KaTex:\leqq` | <pur>`\leqq`</pur> | `KaTex:\smallfrown` | <pur>`\smallfrown`</pur> | `KaTex:\Vdash` | <pur>`\Vdash`</pur>
`KaTex:\Doteq` | <pur>`\Doteq`</pur> | `KaTex:\leqslant` | <pur>`\leqslant`</pur> | `KaTex:\smallsmile` | <pur>`\smallsmile`</pur> | `KaTex:\Vvdash` | <pur>`\Vvdash`</pur>
<!--rehype:className=left-align-->
### 否定关系
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\gnapprox` | <pur>`\gnapprox`</pur> | `KaTex:\ngeqslant` | <pur>`\ngeqslant`</pur> | `KaTex:\nsubseteq` | <pur>`\nsubseteq`</pur> | `KaTex:\precneqq` | <pur>`\precneqq`</pur>
`KaTex:\gneq` | <pur>`\gneq`</pur> | `KaTex:\ngtr` | <pur>`\ngtr`</pur> | `KaTex:\nsubseteqq` | <pur>`\nsubseteqq`</pur> | `KaTex:\precnsim` | <pur>`\precnsim`</pur>
`KaTex:\gneqq` | <pur>`\gneqq`</pur> | `KaTex:\nleq` | <pur>`\nleq`</pur> | `KaTex:\nsucc` | <pur>`\nsucc`</pur> | `KaTex:\subsetneq` | <pur>`\subsetneq`</pur>
`KaTex:\gnsim` | <pur>`\gnsim`</pur> | `KaTex:\nleqq` | <pur>`\nleqq`</pur> | `KaTex:\nsucceq` | <pur>`\nsucceq`</pur> | `KaTex:\subsetneqq` | <pur>`\subsetneqq`</pur>
`KaTex:\gvertneqq` | <pur>`\gvertneqq`</pur> | `KaTex:\nleqslant` | <pur>`\nleqslant`</pur> | `KaTex:\nsupseteq` | <pur>`\nsupseteq`</pur> | `KaTex:\succnapprox` | <pur>`\succnapprox`</pur>
`KaTex:\lnapprox` | <pur>`\lnapprox`</pur> | `KaTex:\nless` | <pur>`\nless`</pur> | `KaTex:\nsupseteqq` | <pur>`\nsupseteqq`</pur> | `KaTex:\succneqq` | <pur>`\succneqq`</pur>
`KaTex:\lneq` | <pur>`\lneq`</pur> | `KaTex:\nmid` | <pur>`\nmid`</pur> | `KaTex:\ntriangleleft` | <pur>`\ntriangleleft`</pur> | `KaTex:\succnsim` | <pur>`\succnsim`</pur>
`KaTex:\lneqq` | <pur>`\lneqq`</pur> | `KaTex:\notin` | <pur>`\notin`</pur> | `KaTex:\ntrianglelefteq` | <pur>`\ntrianglelefteq`</pur> | `KaTex:\supsetneq` | <pur>`\supsetneq`</pur>
`KaTex:\lnsim` | <pur>`\lnsim`</pur> | `KaTex:\notni` | <pur>`\notni`</pur> | `KaTex:\ntriangleright` | <pur>`\ntriangleright`</pur> | `KaTex:\supsetneqq` | <pur>`\supsetneqq`</pur>
`KaTex:\lvertneqq` | <pur>`\lvertneqq`</pur> | `KaTex:\nparallel` | <pur>`\nparallel`</pur> | `KaTex:\ntrianglerighteq` | <pur>`\ntrianglerighteq`</pur> | `KaTex:\varsubsetneq` | <pur>`\varsubsetneq`</pur>
`KaTex:\ncong` | <pur>`\ncong`</pur> | `KaTex:\nprec` | <pur>`\nprec`</pur> | `KaTex:\nvdash` | <pur>`\nvdash`</pur> | `KaTex:\varsubsetneqq` | <pur>`\varsubsetneqq`</pur>
`KaTex:\ne` | <pur>`\ne`</pur> | `KaTex:\npreceq` | <pur>`\npreceq`</pur> | `KaTex:\nvDash` | <pur>`\nvDash`</pur> | `KaTex:\varsupsetneq` | <pur>`\varsupsetneq`</pur>
`KaTex:\neq` | <pur>`\neq`</pur> | `KaTex:\nshortmid` | <pur>`\nshortmid`</pur> | `KaTex:\nVDash` | <pur>`\nVDash`</pur> | `KaTex:\varsupsetneqq` | <pur>`\varsupsetneqq`</pur>
`KaTex:\ngeq` | <pur>`\ngeq`</pur> | `KaTex:\nshortparallel` | <pur>`\nshortparallel`</pur> | `KaTex:\nVdash` | <pur>`\nVdash`</pur>
`KaTex:\ngeqq` | <pur>`\ngeqq`</pur> | `KaTex:\nsim` | <pur>`\nsim`</pur> | `KaTex:\precnapprox` | <pur>`\precnapprox`</pur>
`KaTex:\not =` <pur>`\not =`</pur>
### 箭头
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\circlearrowleft` | <pur>`\circlearrowleft`</pur> | `KaTex:\leftharpoonup` | <pur>`\leftharpoonup`</pur> | `KaTex:\rArr` | <pur>`\rArr`</pur>
`KaTex:\circlearrowright` | <pur>`\circlearrowright`</pur> | `KaTex:\leftleftarrows` | <pur>`\leftleftarrows`</pur> | `KaTex:\rarr` | <pur>`\rarr`</pur>
`KaTex:\curvearrowleft` | <pur>`\curvearrowleft`</pur> | `KaTex:\leftrightarrow` | <pur>`\leftrightarrow`</pur> | `KaTex:\restriction` | <pur>`\restriction`</pur>
`KaTex:\curvearrowright` | <pur>`\curvearrowright`</pur> | `KaTex:\Leftrightarrow` | <pur>`\Leftrightarrow`</pur> | `KaTex:\rightarrow` | <pur>`\rightarrow`</pur>
`KaTex:\Darr` | <pur>`\Darr`</pur> | `KaTex:\leftrightarrows` | <pur>`\leftrightarrows`</pur> | `KaTex:\Rightarrow` | <pur>`\Rightarrow`</pur>
`KaTex:\dArr` | <pur>`\dArr`</pur> | `KaTex:\leftrightharpoons` | <pur>`\leftrightharpoons`</pur> | `KaTex:\rightarrowtail` | <pur>`\rightarrowtail`</pur>
`KaTex:\darr` | <pur>`\darr`</pur> | `KaTex:\leftrightsquigarrow` | <pur>`\leftrightsquigarrow`</pur> | `KaTex:\rightharpoondown` | <pur>`\rightharpoondown`</pur>
`KaTex:\dashleftarrow` | <pur>`\dashleftarrow`</pur> | `KaTex:\Lleftarrow` | <pur>`\Lleftarrow`</pur> | `KaTex:\rightharpoonup` | <pur>`\rightharpoonup`</pur>
`KaTex:\dashrightarrow` | <pur>`\dashrightarrow`</pur> | `KaTex:\longleftarrow` | <pur>`\longleftarrow`</pur> | `KaTex:\rightleftarrows` | <pur>`\rightleftarrows`</pur>
`KaTex:\downarrow` | <pur>`\downarrow`</pur> | `KaTex:\Longleftarrow` | <pur>`\Longleftarrow`</pur> | `KaTex:\rightleftharpoons` | <pur>`\rightleftharpoons`</pur>
`KaTex:\Downarrow` | <pur>`\Downarrow`</pur> | `KaTex:\longleftrightarrow` | <pur>`\longleftrightarrow`</pur> | `KaTex:\rightrightarrows` | <pur>`\rightrightarrows`</pur>
`KaTex:\downdownarrows` | <pur>`\downdownarrows`</pur> | `KaTex:\Longleftrightarrow` | <pur>`\Longleftrightarrow`</pur> | `KaTex:\rightsquigarrow` | <pur>`\rightsquigarrow`</pur>
`KaTex:\downharpoonleft` | <pur>`\downharpoonleft`</pur> | `KaTex:\longmapsto` | <pur>`\longmapsto`</pur> | `KaTex:\Rrightarrow` | <pur>`\Rrightarrow`</pur>
`KaTex:\downharpoonright` | <pur>`\downharpoonright`</pur> | `KaTex:\longrightarrow` | <pur>`\longrightarrow`</pur> | `KaTex:\Rsh` | <pur>`\Rsh`</pur>
`KaTex:\gets` | <pur>`\gets`</pur> | `KaTex:\Longrightarrow` | <pur>`\Longrightarrow`</pur> | `KaTex:\searrow` | <pur>`\searrow`</pur>
`KaTex:\Harr` | <pur>`\Harr`</pur> | `KaTex:\looparrowleft` | <pur>`\looparrowleft`</pur> | `KaTex:\swarrow` | <pur>`\swarrow`</pur>
`KaTex:\hArr` | <pur>`\hArr`</pur> | `KaTex:\looparrowright` | <pur>`\looparrowright`</pur> | `KaTex:\to` | <pur>`\to`</pur>
`KaTex:\harr` | <pur>`\harr`</pur> | `KaTex:\Lrarr` | <pur>`\Lrarr`</pur> | `KaTex:\twoheadleftarrow` | <pur>`\twoheadleftarrow`</pur>
`KaTex:\hookleftarrow` | <pur>`\hookleftarrow`</pur> | `KaTex:\lrArr` | <pur>`\lrArr`</pur> | `KaTex:\twoheadrightarrow` | <pur>`\twoheadrightarrow`</pur>
`KaTex:\hookrightarrow` | <pur>`\hookrightarrow`</pur> | `KaTex:\lrarr` | <pur>`\lrarr`</pur> | `KaTex:\Uarr` | <pur>`\Uarr`</pur>
`KaTex:\iff` | <pur>`\iff`</pur> | `KaTex:\Lsh` | <pur>`\Lsh`</pur> | `KaTex:\uArr` | <pur>`\uArr`</pur>
`KaTex:\impliedby` | <pur>`\impliedby`</pur> | `KaTex:\mapsto` | <pur>`\mapsto`</pur> | `KaTex:\uarr` | <pur>`\uarr`</pur>
`KaTex:\implies` | <pur>`\implies`</pur> | `KaTex:\nearrow` | <pur>`\nearrow`</pur> | `KaTex:\uparrow` | <pur>`\uparrow`</pur>
`KaTex:\Larr` | <pur>`\Larr`</pur> | `KaTex:\nleftarrow` | <pur>`\nleftarrow`</pur> | `KaTex:\Uparrow` | <pur>`\Uparrow`</pur>
`KaTex:\lArr` | <pur>`\lArr`</pur> | `KaTex:\nLeftarrow` | <pur>`\nLeftarrow`</pur> | `KaTex:\updownarrow` | <pur>`\updownarrow`</pur>
`KaTex:\larr` | <pur>`\larr`</pur> | `KaTex:\nleftrightarrow` | <pur>`\nleftrightarrow`</pur> | `KaTex:\Updownarrow` | <pur>`\Updownarrow`</pur>
`KaTex:\leadsto` | <pur>`\leadsto`</pur> | `KaTex:\nLeftrightarrow` | <pur>`\nLeftrightarrow`</pur> | `KaTex:\upharpoonleft` | <pur>`\upharpoonleft`</pur>
`KaTex:\leftarrow` | <pur>`\leftarrow`</pur> | `KaTex:\nrightarrow` | <pur>`\nrightarrow`</pur> | `KaTex:\upharpoonright` | <pur>`\upharpoonright`</pur>
`KaTex:\Leftarrow` | <pur>`\Leftarrow`</pur> | `KaTex:\nRightarrow` | <pur>`\nRightarrow`</pur> | `KaTex:\upuparrows` | <pur>`\upuparrows`</pur>
`KaTex:\leftarrowtail` | <pur>`\leftarrowtail`</pur> | `KaTex:\nwarrow` | <pur>`\nwarrow`</pur>
`KaTex:\leftharpoondown` | <pur>`\leftharpoondown`</pur> | `KaTex:\Rarr` | <pur>`\Rarr`</pur>
<!--rehype:className=left-align-->
### 可扩展箭头
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\xleftarrow{abc}` | <pur>`\xleftarrow{abc}`</pur> | `KaTex:\xrightarrow[under]{over}` | <pur>`\xrightarrow[under]{over}`</pur> |
`KaTex:\xLeftarrow{abc}` | <pur>`\xLeftarrow{abc}`</pur> | `KaTex:\xRightarrow{abc}` | <pur>`\xRightarrow{abc}`</pur> |
`KaTex:\xleftrightarrow{abc}` | <pur>`\xleftrightarrow{abc}`</pur> | `KaTex:\xLeftrightarrow{abc}` | <pur>`\xLeftrightarrow{abc}`</pur> |
`KaTex:\xhookleftarrow{abc}` | <pur>`\xhookleftarrow{abc}`</pur> | `KaTex:\xhookrightarrow{abc}` | <pur>`\xhookrightarrow{abc}`</pur> |
`KaTex:\xtwoheadleftarrow{abc}` | <pur>`\xtwoheadleftarrow{abc}`</pur> | `KaTex:\xtwoheadrightarrow{abc}` | <pur>`\xtwoheadrightarrow{abc}`</pur> |
`KaTex:\xleftharpoonup{abc}` | <pur>`\xleftharpoonup{abc}`</pur> | `KaTex:\xrightharpoonup{abc}` | <pur>`\xrightharpoonup{abc}`</pur> |
`KaTex:\xleftharpoondown{abc}` | <pur>`\xleftharpoondown{abc}`</pur> | `KaTex:\xrightharpoondown{abc}` | <pur>`\xrightharpoondown{abc}`</pur> |
`KaTex:\xleftrightharpoons{abc}` | <pur>`\xleftrightharpoons{abc}`</pur> | `KaTex:\xrightleftharpoons{abc}` | <pur>`\xrightleftharpoons{abc}`</pur> |
`KaTex:\xtofrom{abc}` | <pur>`\xtofrom{abc}`</pur> | `KaTex:\xmapsto{abc}` | <pur>`\xmapsto{abc}`</pur> |
`KaTex:\xlongequal{abc}` | <pur>`\xlongequal{abc}`</pur> |
符号和标点符号
---
### 符号和标点符号
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:% comment` | <pur>`% comment`</pur> | `KaTex:\dots` | <pur>`\dots`</pur> | `KaTex:\KaTeX` | <pur>`\KaTeX`</pur> |
`KaTex:\%` | <pur>`\%`</pur> | `KaTex:\cdots` | <pur>`\cdots`</pur> | `KaTex:\LaTeX` | <pur>`\LaTeX`</pur> |
`KaTex:\#` | <pur>`\#`</pur> | `KaTex:\ddots` | <pur>`\ddots`</pur> | `KaTex:\TeX` | <pur>`\TeX`</pur> |
`KaTex:\&` | <pur>`\&`</pur> | `KaTex:\ldots` | <pur>`\ldots`</pur> | `KaTex:\nabla` | <pur>`\nabla`</pur> |
`KaTex:\_` | <pur>`\_`</pur> | `KaTex:\vdots` | <pur>`\vdots`</pur> | `KaTex:\infty` | <pur>`\infty`</pur> |
`KaTex:\text{\textunderscore}` | <pur>`\text{\textunderscore}`</pur> | `KaTex:\dotsb` | <pur>`\dotsb`</pur> | `KaTex:\infin` | <pur>`\infin`</pur> |
`KaTex:\text{--}` | <pur>`\text{--}`</pur> | `KaTex:\dotsc` | <pur>`\dotsc`</pur> | `KaTex:\checkmark` | <pur>`\checkmark`</pur> |
`KaTex:\text{\textendash}` | <pur>`\text{\textendash}`</pur> | `KaTex:\dotsi` | <pur>`\dotsi`</pur> | `KaTex:\dag` | <pur>`\dag`</pur> |
`KaTex:\text{---}` | <pur>`\text{---}`</pur> | `KaTex:\dotsm` | <pur>`\dotsm`</pur> | `KaTex:\dagger` | <pur>`\dagger`</pur> |
`KaTex:\text{\textemdash}` | <pur>`\text{\textemdash}`</pur> | `KaTex:\dotso` | <pur>`\dotso`</pur> | `KaTex:\text{\textdagger}` | <pur>`\text{\textdagger}`</pur> |
`KaTex:\text{\textasciitilde}` | <pur>`\text{\textasciitilde}`</pur> | `KaTex:\sdot` | <pur>`\sdot`</pur> | `KaTex:\ddag` | <pur>`\ddag`</pur> |
`KaTex:\text{\textasciicircum}` | <pur>`\text{\textasciicircum}`</pur> | `KaTex:\mathellipsis` | <pur>`\mathellipsis`</pur> | `KaTex:\ddagger` | <pur>`\ddagger`</pur> |
| <code>KaTex:\`</code> | <pur>\`</pur> | `KaTex:\text{\textellipsis}` | <pur>`\text{\textellipsis}`</pur> | `KaTex:\text{\textdaggerdbl}` | <pur>`\text{\textdaggerdbl}`</pur> |
`KaTex:\text{\textquoteleft}` | <pur>`text{\textquoteleft}`</pur> | `KaTex:\Box` | <pur>`\Box`</pur> | `KaTex:\Dagger` | <pur>`\Dagger`</pur> |
`KaTex:\lq` | <pur>`\lq`</pur> | `KaTex:\square` | <pur>`\square`</pur> | `KaTex:\angle` | <pur>`\angle`</pur> |
`KaTex:\text{\textquoteright}` | <pur>`\text{\textquoteright}`</pur> | `KaTex:\blacksquare` | <pur>`\blacksquare`</pur> | `KaTex:\measuredangle` | <pur>`\measuredangle`</pur> |
`KaTex:\rq` | <pur>`\rq`</pur> | `KaTex:\triangle` | <pur>`\triangle`</pur> | `KaTex:\sphericalangle` | <pur>`\sphericalangle`</pur> |
`KaTex:\text{\textquotedblleft}` | <pur>`\text{\textquotedblleft}`</pur> | `KaTex:\triangledown` | <pur>`\triangledown`</pur> | `KaTex:\top` | <pur>`\top`</pur> |
`KaTex:"` | <pur>`"`</pur> | `KaTex:\triangleleft` | <pur>`\triangleleft`</pur> | `KaTex:\bot` | <pur>`\bot`</pur> |
`KaTex:\text{\textquotedblright}` | <pur>`\text{\textquotedblright}`</pur> | `KaTex:\triangleright` | <pur>`\triangleright`</pur> | `KaTex:\$` | <pur>`\$`</pur> |
`KaTex:\colon` | <pur>`\colon`</pur> | `KaTex:\bigtriangledown` | <pur>`\bigtriangledown`</pur> | `KaTex:\text{\textdollar}` | <pur>`\text{\textdollar}`</pur> |
`KaTex:\backprime` | <pur>`\backprime`</pur> | `KaTex:\bigtriangleup` | <pur>`\bigtriangleup`</pur> | `KaTex:\pounds` | <pur>`\pounds`</pur> |
`KaTex:\prime` | <pur>`\prime`</pur> | `KaTex:\blacktriangle` | <pur>`\blacktriangle`</pur> | `KaTex:\mathsterling` | <pur>`\mathsterling`</pur> |
`KaTex:\text{\textless}` | <pur>`\text{\textless}`</pur> | `KaTex:\blacktriangledown` | <pur>`\blacktriangledown`</pur> | `KaTex:\text{\textsterling}` | <pur>`\text{\textsterling}`</pur> |
`KaTex:\text{\textgreater}` | <pur>`\text{\textgreater}`</pur> | `KaTex:\blacktriangleleft` | <pur>`\blacktriangleleft`</pur> | `KaTex:\yen` | <pur>`\yen`</pur> |
`KaTex:\text{\textbar}` | <pur>`\text{\textbar}`</pur> | `KaTex:\blacktriangleright` | <pur>`\blacktriangleright`</pur> | `KaTex:\surd` | <pur>`\surd`</pur> |
`KaTex:\text{\textbardbl}` | <pur>`\text{\textbardbl}`</pur> | `KaTex:\diamond` | <pur>`\diamond`</pur> | `KaTex:\degree` | <pur>`\degree`</pur> |
`KaTex:\text{\textbraceleft}` | <pur>`\text{\textbraceleft}`</pur> | `KaTex:\Diamond` | <pur>`\Diamond`</pur> | `KaTex:\text{\textdegree}` | <pur>`\text{\textdegree}`</pur> |
`KaTex:\text{\textbraceright}` | <pur>`\text{\textbraceright}`</pur> | `KaTex:\lozenge` | <pur>`\lozenge`</pur> | `KaTex:\mho` | <pur>`\mho`</pur> |
`KaTex:\text{\textbackslash}` | <pur>`\text{\textbackslash}`</pur> | `KaTex:\blacklozenge` | <pur>`\blacklozenge`</pur> | `KaTex:\diagdown` | <pur>`\diagdown`</pur> |
`KaTex:\text{\P}` | <pur>`\text{\P}`</pur><pur>`\P`</pur> | `KaTex:\star` | <pur>`\star`</pur> | `KaTex:\diagup` | <pur>`\diagup`</pur> |
`KaTex:\text{\S}` | <pur>`\text{\S}`</pur><pur>`\S`</pur> | `KaTex:\bigstar` | <pur>`\bigstar`</pur> | `KaTex:\flat` | <pur>`\flat`</pur> |
`KaTex:\text{\sect}` | <pur>`\text{\sect}`</pur> | `KaTex:\clubsuit` | <pur>`\clubsuit`</pur> | `KaTex:\natural` | <pur>`\natural`</pur> |
`KaTex:\copyright` | <pur>`\copyright`</pur> | `KaTex:\clubs` | <pur>`\clubs`</pur> | `KaTex:\sharp` | <pur>`\sharp`</pur> |
`KaTex:\circledR` | <pur>`\circledR`</pur> | `KaTex:\diamondsuit` | <pur>`\diamondsuit`</pur> | `KaTex:\heartsuit` | <pur>`\heartsuit`</pur> |
`KaTex:\text{\textregistered}` | <pur>`\text{\textregistered}`</pur> | `KaTex:\diamonds` | <pur>`\diamonds`</pur> | `KaTex:\hearts` | <pur>`\hearts`</pur> |
`KaTex:\circledS` | <pur>`\circledS`</pur> | `KaTex:\spadesuit` | <pur>`\spadesuit`</pur> | `KaTex:\spades` | <pur>`\spades`</pur> |
`KaTex:\text{\textcircled a}` | <pur>`\text{\textcircled a}`</pur> | `KaTex:\maltese` | <pur>`\maltese`</pur> | `KaTex:\minuso` | <pur>`\minuso`</pur> |
Environments
---
@ -441,8 +868,43 @@ x = \begin{cases}
\end{CD}
```
样式、颜色、大小和字体
---
### Color 颜色
:- | :-
:- | :-
`KaTex:\color{blue} F=ma` | <pur>`\color{blue} F=ma`</pur>
`KaTex:\textcolor{blue}{F=ma}` | <pur>`\textcolor{blue}{F=ma}`</pur>
`KaTex:\textcolor{#228B22}{F=ma}` | <pur>`\textcolor{#228B22}{F=ma}`</pur>
`KaTex:\colorbox{aqua}{$F=ma$}` | <pur>`\colorbox{aqua}{$F=ma$}`</pur>
`KaTex:\fcolorbox{red}{aqua}{$F=ma$}` | <pur>`\fcolorbox{red}{aqua}{$F=ma$}`</pur>
### Font 字体
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\Huge AB` | <pur>`\Huge AB`</pur> | `KaTex:\normalsize AB` | <pur>`\normalsize AB`</pur> | `KaTex:\normalsize AB` | <pur>\normalsize AB</pur>
`KaTex:\huge AB` | <pur>`\huge AB`</pur> | `KaTex:\huge AB` | <pur>`\huge AB`</pur> | `KaTex:\small AB` | <pur>\small AB</pur>
`KaTex:\LARGE AB` | <pur>`\LARGE AB`</pur> | `KaTex:\LARGE AB` | <pur>`\LARGE AB`</pur> | `KaTex:\footnotesize AB` | <pur>\footnotesize AB</pur>
`KaTex:\Large AB` | <pur>`\Large AB`</pur> | `KaTex:\Large AB` | <pur>`\Large AB`</pur> | `KaTex:\scriptsize AB` | <pur>\scriptsize AB</pur>
`KaTex:\large AB` | <pur>`\large AB`</pur> | `KaTex:\large AB` | <pur>`\large AB`</pur> | `KaTex:\tiny AB` | <pur>\tiny AB</pur>
### Style 样式
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\displaystyle\sum_{i=1}^n` | <pur>\displaystyle\sum_{i=1}^n</pur> | `KaTex:\textstyle\sum_{i=1}^n` | <pur>\textstyle\sum_{i=1}^n</pur>
`KaTex:\scriptstyle x` | <pur>\scriptstyle x</pur> | `KaTex:\scriptscriptstyle x` | <pur>\scriptscriptstyle x</pur>
`KaTex:\lim\limits_x` | <pur>\lim\limits_x</pur> | `KaTex:\lim\nolimits_x` | <pur>\lim\nolimits_x</pur>
`KaTex:\verb!x^2!` | <pur>\verb!x^2!</pur>
另见
----
- [LaTeX 官网](https://www.latex-project.org/) _(latex-project.org)_
- [KaTeX 官网](https://katex.org/) _(katex.org)_
- [symbols.pdf](https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf) _(cmor-faculty.rice.edu)_

View File

@ -427,6 +427,441 @@ repeat
until (num > 20)
```
函数
---
### 初始化
像变量一样,如果加上 `local` 那么就是局部函数
```lua
local function main()
print("这是一个局部函数")
end
```
---
你也可以将函数赋值给一个变量
```lua
local main = function()
print("这是一个局部函数")
end
```
### 返回值
```lua
local function min(a, b)
if (a < b) then
return a
else
return b
end
end
print(min(1, 2))
```
### 参数
```lua
local p = function(res)
print("打印自己的风格", res)
end
local function main(a, b, p)
p(a + b)
end
main(1, 2, p)
```
### 多个返回值
```lua
local function min(a)
local sum = 0
local factorial = 1
for i, v in pairs(a) do
sum = sum + v
factorial = factorial * v
end
return sum, factorial
end
local a, b = min({ 1, 2, 3, 4 })
print(a, b)
```
### 可变参数(`...`)
```lua
local function average(...)
local result = 0
local arg = { ... }
for i, v in ipairs(arg) do
result = result + v
end
return result / #arg
end
print("平均值为", average(1, 3, 5, 7, 9, 11))
```
字符串
---
### 字符串方法
<!--rehype:wrap-class=col-span-2-->
```lua
-- 全部转换为大写
string.upper("str") -- STR
-- 全部转换为小写
string.lower("STR") -- str
-- 指定替换的字符串个数, 最后一个参数可选,默认是全部替换
string.gsub("aaaa", "a", "b", 3) -- bbba 3
string.gsub("Today is 29/01/2019", "%d%d/%d%d/%d%d%d%d", "good day.")
-- Today is a good day. 1
-- 查找第一个匹配的字符串,第三个参数可以提供开始查找的位置,默认从 1 开始
-- 如果未找到,则返回 nil
string.find("referference", "fer") -- 3 5
string.find("Today is 29/01/2021", "%d%d/%d%d/%d%d%d%d") -- 10 19
-- 字符串反转
string.reverse("fw") -- wf
-- 格式化字符串
string.format("value:%c", 1) -- value:a
-- 转换字符并拼接
string.char(97,98,99,100) -- abcd
-- 将字符转化为整数值。 int 用来指定某个字符,默认第一个字符
string.byte("ABCD",4) -- 68
-- 计算字符串长度
string.len("abc") -- 3
-- 返回字符串的 n 个拷贝
string.rep("fw", n) -- fwfw
-- 剪切字符串,第三个参数可选,默认是字符串长度
string.sub("referference", 5, 6) -- rf
```
### 正则匹配
:- | :-
:- | :-
`%a` | 与任何字母配对
`%c` | 与任何控制符配对(例如\n)
`%d` | 与任何数字配对
`%l` | 与任何小写字母配对
`%p` | 与任何标点(punctuation)配对
`%s` | 与空白字符配对
`%u` | 与任何大写字母配对
`%w` | 与任何字母/数字配对
`%x` | 与任何十六进制数配对
`%z` | 与任何代表0的字符配对
<!--rehype:className=left-align-->
#### match
第三个参数可选,默认从 1 开始。如果没有捕获组返回整个字符串,匹配失败返回 nil
```lua
string.match(
"I have 2 questions for you.",
"(%d+) (%a+) "
) -- 2 questions
```
#### gmatch
返回一个迭代器函数,每次调用迭代器函数,如果参数 pattern 描述的字符串没有找到迭代函数返回nil
```lua
for world in string.gmatch("I have 2 questions for you.", "%a+") do
print(world)
end
-- I
-- have
-- questions
-- for
-- you
```
<!--rehype:className=style-round wrap-text-->
数学方法
---
### 常用方法
```lua
-- 一个比任何数字都大的浮点数
math.huge
-- 最小值的整数
math.mininteger
local a = math.abs(-1) -- 1
-- 返回不小于该数到最小整数
local b = math.ceil(1.2) -- 2
-- 返回不大于该数到最大整数
local c = math.floor(1.2) -- 1
-- 取余
local d = math.fmod(9.9, 9) -- 0.9
-- 返回最大值
local g = math.max(1, 2, 3) -- 3
-- 返回最小值
local h = math.min(1, 2, 3) -- 1
-- 返回参数的平方根
local r = math.sqrt(3) -- 9
```
### 工具方法
```lua
-- 返回数字的类型,
local l = math.type(1.2) -- float
local m = math.type(3) -- integer
local n = math.type("") -- nil
-- 返回以指定底底对数
local e = math.log(4, 2) -- 2
-- 返回以 e 为底的自然对数
local f = math.exp(2) -- 7.3890560989307
-- 返回 [0,1) 区间内一致分布的浮点伪随机数
math.random()
-- 返回 [1, n] 区间内一致分布的整数伪随机数
math.random(10)
-- 返回 [n, m] 区间内一致分布的整数伪随机数
math.random(10, 100)
-- 无符号整数比较,参数一 小于 参数二 则返回 true否则返回 false
local o = math.ult(1, 10)
-- 如果参数可以转换为一个整数,则返回该整数,否则返回 nil
local p = math.tointeger("3") -- 3
local q = math.tointeger(0.32) -- nil
-- 返回整数和小数部分
local i, j = math.modf(3.14) -- 3 0.14
```
### 其它方法
```lua
-- 圆周率
math.pi -- 3.1415926535898
-- 正弦方法(以下皆是以弧度表示)
math.sin(math.pi / 2) -- 1.0
-- 余弦方法
math.cos(math.pi) -- -1.0
-- 正切方法
math.tan(math.pi / 4) -- 1.0
-- 反正弦方法(以下皆是以弧度表示)
math.acos(1.0) -- 0.0
-- 反余弦方法
math.acos(1.0) -- 1.5707963267949
-- 反正弦方法
math.atan(1.0) -- 0.78539816339745
-- 角度转换为弧度
math.rad(90) -- 1.5707963267949
-- 弧度转换为角度
math.deg(math.pi) -- 180.0
```
table
---
### 初始化数组
初始化一个空数组
```lua
local array = {}
```
---
默认的数组索引从 1 开始
```lua
local array = { "a", "b", "c", "d" }
array[5] = "e"
for i = 1, 5 do
print(array[i])
end
```
### 多维数组
```lua
local array = {
{ "a", "b", "c" },
{ "d", "e", "f" }
}
for i = 1, #array do
for j = 1, #array[i] do
print(array[i][j])
end
end
```
### 初始化 table
```lua
local table = {}
table.name = "fw"
table.age = "18"
table["sex"] = "boy"
-- 获取 table 的长度
print(#table) -- 3
-- 如果想要删除一个 table那么可以使用 nil 赋值
table = nil
print(table)
```
### table 方法
<!--rehype:wrap-class=col-span-2-->
```lua
-- 用于连接 table 中指定的元素
-- table.concat(table [, sep [, start [, end]]])
local a = { "apple", "orange", "peach" }
print(table.concat(a, "->", 2, 3)) -- orange->peach
-- 用于向指定闻之插入元素。默认数组末尾
-- table.insert(table, [pos,] value)
local a = { "apple", "orange", "peach" }
table.insert(a, 1, "pear")
print(a[1]) -- pear
-- table.move(a1,f,e,t[,a2])
-- 表a1a1下标开始位置fa1下标结束位置et选择移动到的开始位置(如果没有a2默认a1的下标)
local array = { "a", "b", "c" }
for i,v in pairs(table.move(array, 1, 3, 2)) do
print(v)
end -- a a b c
-- table.sort (table [, comp])
-- 排序,默认是升序
local array = { "a", "c", "b" }
local f = function(a, b)
return string.byte(a) - string.byte(b) > 0
end
table.sort(array, f)
for i, v in pairs(array) do
print(v)
end -- c b a
```
### 迭代器
#### 无状态的迭代器
```lua
function square(d,n)
if n < d
then
n = n + 1
return n, n*n
end
end
for i,n in square,5,0
do
print(i,n)
end
```
#### for 循环迭代器
```lua
for i, n in pairs({ 1, 2, 3, 4 }) do
print(i, n)
end
```
模块
---
### 定义模块
```lua
-- a.lua
local mod = {}
mod.cool = "this is a mod"
function mod.test()
print("this is a function")
end
return mod
```
### 导入模块
一般我们可以直接使用 `require` 导入
```lua
-- b.lua
-- local mod = require("a")
-- 使用 pcall 确保 require 函数导入成功,失败则返回一个 false 状态
local status, mod = pcall(require, "a")
if not status then
return
end
mod.test()
print(mod.cool)
```
### 私有函数
```lua
local mod = {}
local function private()
print("private")
end
function mod.public()
private()
end
return mod
```
另见
----

1222
docs/openssl.md Normal file

File diff suppressed because it is too large Load Diff

482
docs/sysdig.md Normal file
View File

@ -0,0 +1,482 @@
Sysdig 备忘清单
===
该备忘单提供了使用 [Sysdig](https://sysdig.com/) 的常用命令参数和使用案例清单
入门
----
### 命令安装
<!--rehype:wrap-class=col-span-2-->
```shell
sudo rpm --import https://download.sysdig.com/DRAIOS-GPG-KEY.public
sudo curl -s -o /etc/yum.repos.d/draios.repo https://download.sysdig.com/stable/rpm/draios.repo
sudo yum -y install sysdig
```
<!--rehype:className=wrap-text-->
### 常用参数
<!--rehype:wrap-class=row-span-2-->
参数 | 说明
:--|:---
`-C 5` | 每个文件不超过5M
`-W 10` | 保留不超过10个文件
`-G 60` | 每个文件只保留一分钟内的系统活动
`-w dump.pcap` | 保存到文件
`-e 1000` | 每个文件只有1000个事件
`-z` | 参数对保存的内容进行压缩
`-A --print-ascii` | 把buffer中数据按照ASCII格式打印方便阅读
`-x --print-hex` | 把buffer中数据按照十六进制打印
`-X --printhex-ascii` | 把buffer中数据同时按照ASCII格式和十六进制打印
`-s 1024` | 捕获buffer的数据大小默认为80设置过大文件会很大
`-N` | 不用把端口号转成可读名字
`-r` | 从文件读取
<!--rehype:className=show-header-->
### 输出含义
事件 | 说明
:--|:---
`evt.num` | 递增的事件号
`evt.time` | 事件发生的时间
`evt.cpu` | 事件被捕获时所在cpu
`proc.name` | 生成事件的进程名字
`thread.tid` | 线程id单线程则为进程id
`evt.dir` | 事件方向(direction), > 代表进入事件, < 代表退出事件
`evt.type` | 事件的名称比如openstat等一般为系统调用
`evt.args` | 事件的参数如果为系统调用则对应系统调用的参数
<!--rehype:className=show-header-->
### chisels常用工具
事件 | 说明
:--|:---
`httplog` | 输出所有的http请求
`topprocs_cpu` | 输出按照cpu使用率排序
`topprocs_net` | 按照网络使用情况对进程排序
`fdcount_by` | 按照建立连接书对进程排序
`echo_fds` | 输出进程读写数据
`netsata` | 列出网络连接情况
`spy_file` | 输出文件的读写数据,可以提供某个文件名作为参数
`spy_ip` | 抓取给定ip的数据交换
`spy_port` | 抓取给定端口的数据交换
<!--rehype:className=show-header-->
### 命令帮助
```shell
sysdig -l #事件类型
sysdig -cl #chisels工具类型
```
### 捕获每个系统事件并将其写入标准输出
```shell
$ sysdig
```
### 自定义输出
<!--rehype:wrap-class=row-span-2-->
```shell
$ sysdig -p"user:%user.name dir:%evt.arg.path" evt.type=chdir
user:ubuntu dir:/root
user:ubuntu dir:/root/tmp
user:ubuntu dir:/root/Download
```
<!--rehype:className=wrap-text-->
字段必须用 `%` 作为前缀,所有 `sysdig -l` 列出来的字段都可以使用
如果某个字段在时间中不存在,默认这个事件会过滤掉,在这个字符串最前面加上 `*` 符号,会打印所有事件,不存在的字段会变成 `<NA>`
```shell
$ sysdig -p"*%evt.type %evt.dir %evt.arg.name" evt.type=open
open > <NA>
open < /proc/1285/task/1399/stat
open > <NA>
open < /proc/1285/task/1400/io
open > <NA>
open < /proc/1285/task/1400/statm
open > <NA>
```
<!--rehype:className=wrap-text -->
### 抓取 `kubernetes pod` 客户端 `ip` 的 `udp` 请求
<!--rehype:wrap-class=col-span-2-->
```shell
# 列出容器监听端口
$ sudo sysdig -pc -A -c netstat container.name=aaa
# 抓取kubernetes pod 的客户端ip为172.119.100.163000端口的的请求内容
$ sudo sysdig -A -c echo_fds k8s.pod.name contains datacenter-web-dev and fd.port=3000 and evt.type=read and fd.cip=172.119.100.16 fd.proto=UDP
# 按照建立连接数量对进程排序 并保存到sysdig.pcap文件中
$ sysdig -c fdcount_by fd.sport "evt.type=accept" -w sysdig.pcap
```
<!--rehype:className=wrap-text -->
抓取 `kubernetes pod` 客户端 `ip``172.119.100.16``udp` 请求
### io案例
<!--rehype:wrap-class=row-span-3-->
查看 io 错误最多的进程
```shell
$ sysdig -c topprocs_errors
```
查看io错误最多的文件
```shell
$ sysdig -c topfiles_errors
```
查看磁盘io失败的调用
```shell
$ sysdig fd.type=file and evt.failed=true
```
查看httpd打开失败的文件
```shell
$ sysdig "proc.name=httpd and evt.type=open and evt.failed=true"
```
<!--rehype:className=wrap-text -->
查看最花费时间的系统调用
```shell
$ sysdig -c topscalls_time
```
查看系统调用失败返回最多的系统调用
```shell
$ sysdig -c topscalls "evt.failed=true"
```
查看打开文件失败
```shell
$ sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open and evt.failed=true
```
<!--rehype:className=wrap-text -->
打印延迟大于1ms的文件I/O调用
```shell
$ sysdig -c fileslower 1
```
查看使用硬盘带宽最多的进程
```shell
$ sysdig -c topprocs_file
```
列出大量使用文件描述符的进程
```shell
$ sysdig -c fdcount_by proc.name "fd.type=file"
```
<!--rehype:className=wrap-text -->
查看读写bytes最多的文件
```shell
$ sysdig -c topfiles_bytes
```
打印httpd进程已经读取中和写入中的文件
```shell
$ sysdig -c topfiles_bytes proc.name=httpd
```
基本 opensnoop:snoop 文件在发生时打开
```shell
$ sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open
```
<!--rehype:className=wrap-text -->
查看活跃中的读和写最多的目录
```shell
sysdig -c fdbytes_by fd.directory "fd.type=file"
```
<!--rehype:className=wrap-text -->
查看目录/tmp活跃中的读写最多的文件
```shell
sysdig -c fdbytes_by fd.filename "fd.directory=/tmp/"
```
<!--rehype:className=wrap-text -->
查看所有文件名为passwd的i/O活动
```shell
sysdig -A -c echo_fds "fd.filename=passwd"
```
展示FD类型的活跃I/O
```shell
sysdig -c fdbytes_by fd.type
```
<!--rehype:className=wrap-text -->
### 网络
抓取 `kubernetes pod` 的客户端 `ip``172.119.100.17``3000` 端口的的请求内容
```shell
$ sudo sysdig -A -c echo_fds k8s.pod.name contains datacenter-web-dev and fd.port=3000 and evt.type=read and fd.cip=172.119.100.17 fd.proto=UDP
```
<!--rehype:className=wrap-text -->
查看占用网络带宽最多的进程
```shell
$ sysdig -c topprocs_net
#显示主机192.168.0.1的网络传输数据
#作为二进制:
$ sysdig -s2000 -X -c echo_fds fd.cip=192.168.0.1
#作为 ASCII
$ sysdig -s2000 -A -c echo_fds fd.cip=192.168.0.1
```
<!--rehype:className=wrap-text -->
查看连接最多的服务器端口
```shell
#在已建立的连接方面:
$ sysdig -c fdcount_by fd.sport "evt.type=accept"
#就总字节数而言:
$ sysdig -c fdbytes_by fd.sport
```
<!--rehype:className=wrap-text -->
查看客户端连接最多的ip
```shell
#在已建立的联系方面
$ sysdig -c fdcount_by fd.cip "evt.type=accept"
#就总字节数而言
$ sysdig -c fdbytes_by fd.cip
```
<!--rehype:className=wrap-text -->
列出所有不是访问apache服务的访问连接
```shell
$ sysdig -p"%proc.name %fd.name" "evt.type=accept and proc.name!=httpd"
```
<!--rehype:className=wrap-text -->
显示 wordpress1 容器在端口 80 上发送和接收的数据:
```shell
$ sysdig -A -cecho_fds container.name=wordpress1 and fd.port=80
```
<!--rehype:className=wrap-text -->
实时打印 `mysql` 容器接收的所有新连接
```shell
$ sysdig -p"%fd.name" container.name=mysql and evt.type=accept
```
<!--rehype:className=wrap-text -->
### 进程
查看哪些文件花费时间做多
```shell
$ sysdig -c topfiles_time
```
查看httpd进程哪些文件花费最多时间
```shell
$ sysdig -c topfiles_time proc.name=httpd
```
查看io错误最多的进程
```shell
$ sysdig -c topprocs_errors
```
查看io错误最多的文件
```shell
$ sysdig -c topfiles_errors
```
查看磁盘io失败的调用
```shell
$ sysdig fd.type=file and evt.failed=true
```
查看httpd打开失败的文件
```shell
$ sysdig "proc.name=httpd and evt.type=open and evt.failed=true"
```
<!--rehype:className=wrap-text -->
查看最花费时间的系统调用
```shell
$ sysdig -c topscalls_time
```
查看系统调用失败返回最多的系统调用
```shell
$ sysdig -c topscalls "evt.failed=true"
```
查看打开文件失败
```shell
$ sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open and evt.failed=true
```
<!--rehype:className=wrap-text -->
打印延迟大于1ms的文件I/O调用
```shell
$ sysdig -c fileslower 1
```
<!--rehype:className=wrap-text -->
### 基本用法
<!--rehype:wrap-class=row-span-2-->
将事件捕获到跟踪文件以供以后分析
```shell
$ sysdig w myfile.scap
```
从跟踪文件中读取事件
```shell
$ sysdig r myfile.scap
```
根据特定字段过滤事件
```shell
$ sysdig proc.name=httpd and evt.type!=open
```
运行凿子以获得高级功能
```shell
$ sysdig -c topprocs_cpu
```
列出所有可用字段
```shell
$ sysdig -l
```
列出所有可用的凿子
```shell
$ sysdig -cl
```
### 容器
查看具有容器上下文的进程列表
```shell
$ sysdig -pc
```
查看 `wordpress1` 容器中运行的进程的CPU使用率
```shell
$ sysdig -pc -c topprocs_cpu container.name=wordpress1
```
<!--rehype:className=wrap-text -->
查看对基于 `Kubernetes``mySQL` 服务发出的热门 `HTTP` 请求
```shell
$ sysdig -k http://127.0.0.1:8080 -c httptop k8s.svc.name=mysql
```
<!--rehype:className=wrap-text -->
### 文件系统
列出使用最多文件数的进程
```shell
$ sysdig -c fdcount_by proc.name "fd.type=file"
```
<!--rehype:className=wrap-text -->
观察名为“passwd”的所有文件的 I/O 活动
```shell
$ sysdig -A -c echo_fds "fd.filename=passwd"
```
<!--rehype:className=wrap-text -->
### 安全
显示 `root` 访问的目录
```shell
$ sysdig -p "%evt.arg.path" "evt.type=chdir and user.name=root"
```
<!--rehype:className=wrap-text -->
观察 `ssh` 活动
```shell
$ sysdig -A -c echo_fds fd.name=/dev/ptmx and proc.name=sshd
```
<!--rehype:className=wrap-text -->
### 日志
显示来自 python 的所有系统日志消息
```shell
$ sysdig -c spy_syslog proc.name=python
```
超尾系统中的所有日志文件
```shell
$ sysdig -c spy_logs
```
### CSysdig
```shell
$ csysdig -m http://127.0.0.1:8080
```
使用 Mesos 元数据运行 CsysdigSysdig 基于 curses 的 UI
另见
----------
- [sysdig wiki](https://github.com/draios/sysdig/wiki) _(github.com)_
- [sysdig 官网](https://sysdig.com/) _(sysdig.com)_
- [Linux 故障排除速查表strace、htop、lsof、tcpdump、iftop 和 sysdig](https://sysdig.com/blog/linux-troubleshooting-cheatsheet/) _(sysdig.com)_

View File

@ -1278,7 +1278,7 @@ type Capitalize<T extends string> = T extends `${infer U}${infer V}`
type capitalized = Capitalize<"hello world"> // Hello World
```
- 也可以在 infer 中使用条件约束(`extends`
也可以在 infer 中使用条件约束(`extends`
```ts
type SomeBigInt = "100" extends `${infer U extends bigint}` ? U : never;
@ -1351,7 +1351,7 @@ TSConfig Ref
```
### 类型检查(compilerOptions)
<!--rehype:wrap-class=row-span-3-->
<!--rehype:wrap-class=row-span-4-->
:- | --
:- | --
@ -1396,33 +1396,34 @@ TSConfig Ref
<!--rehype:className=style-list-arrow-->
### Emit(compilerOptions)
<!--rehype:wrap-class=row-span-2-->
<!--rehype:wrap-class=row-span-6-->
:- | --
:- | --
`declaration` [#](https://www.typescriptlang.org/zh/tsconfig#declaration) |
`declarationDir` [#](https://www.typescriptlang.org/zh/tsconfig#declarationDir) |
`declarationMap` [#](https://www.typescriptlang.org/zh/tsconfig#declarationMap) |
`downlevelIteration` [#](https://www.typescriptlang.org/zh/tsconfig#downlevelIteration) |
`emitBOM` [#](https://www.typescriptlang.org/zh/tsconfig#emitBOM) |
`emitDeclarationOnly` [#](https://www.typescriptlang.org/zh/tsconfig#emitDeclarationOnly) |
`importHelpers` [#](https://www.typescriptlang.org/zh/tsconfig#importHelpers) |
`importsNotUsedAsValues` [#](https://www.typescriptlang.org/zh/tsconfig#importsNotUsedAsValues) |
`inlineSourceMap` [#](https://www.typescriptlang.org/zh/tsconfig#inlineSourceMap) |
`inlineSources` [#](https://www.typescriptlang.org/zh/tsconfig#inlineSources) |
`mapRoot` [#](https://www.typescriptlang.org/zh/tsconfig#mapRoot) |
`newLine` [#](https://www.typescriptlang.org/zh/tsconfig#newLine) |
`noEmit` [#](https://www.typescriptlang.org/zh/tsconfig#noEmit) |
`noEmitHelpers` [#](https://www.typescriptlang.org/zh/tsconfig#noEmitHelpers) |
`noEmitOnError` [#](https://www.typescriptlang.org/zh/tsconfig#noEmitOnError) |
`outDir` [#](https://www.typescriptlang.org/zh/tsconfig#outDir) |
`outFile` [#](https://www.typescriptlang.org/zh/tsconfig#outFile) |
`preserveConstEnums` [#](https://www.typescriptlang.org/zh/tsconfig#preserveConstEnums) |
`preserveValueImports` [#](https://www.typescriptlang.org/zh/tsconfig#preserveValueImports) |
`removeComments` [#](https://www.typescriptlang.org/zh/tsconfig#removeComments) |
`sourceMap` [#](https://www.typescriptlang.org/zh/tsconfig#sourceMap) |
`sourceRoot` [#](https://www.typescriptlang.org/zh/tsconfig#sourceRoot) |
`stripInternal` [#](https://www.typescriptlang.org/zh/tsconfig#stripInternal) |
`declaration` [#](https://www.typescriptlang.org/zh/tsconfig#declaration) | 为项目中的每个 TypeScript 或 JavaScript 文件生成 .d.ts 文件
`declarationDir` [#](https://www.typescriptlang.org/zh/tsconfig#declarationDir) | 提供一种配置发出声明文件的根目录的方法
`declarationMap` [#](https://www.typescriptlang.org/zh/tsconfig#declarationMap) | 为映射回原始 .ts 源文件的 .d.ts 文件生成源映射
`downlevelIteration` [#](https://www.typescriptlang.org/zh/tsconfig#downlevelIteration) | 降级是 TypeScript 的术语,用于转译到旧版本的 JavaScript
`emitBOM` [#](https://www.typescriptlang.org/zh/tsconfig#emitBOM) | 控制 TypeScript 在写入输出文件时是否会发出字节顺序标记 (BOM)
`emitDeclarationOnly` [#](https://www.typescriptlang.org/zh/tsconfig#emitDeclarationOnly) | 只发出 .d.ts 文件;不要发出 .js 文件
`importHelpers` [#](https://www.typescriptlang.org/zh/tsconfig#importHelpers) | 对于某些降级操作TypeScript 使用一些辅助代码来执行扩展类、展开数组或对象以及异步操作等操作
`importsNotUsedAsValues` [#](https://www.typescriptlang.org/zh/tsconfig#importsNotUsedAsValues) | 此标志控制导入的工作方式,有 3 个不同的选项: `remove`, `preserve`, `error`
`inlineSourceMap` [#](https://www.typescriptlang.org/zh/tsconfig#inlineSourceMap) | 设置后TypeScript 不会写出 .js.map 文件来提供源映射,而是将源映射内容嵌入到 .js 文件中
`inlineSources` [#](https://www.typescriptlang.org/zh/tsconfig#inlineSources) | 设置后TypeScript 会将 .ts 文件的原始内容作为嵌入字符串包含在源映射中(使用源映射的 sourcesContent 属性)
`mapRoot` [#](https://www.typescriptlang.org/zh/tsconfig#mapRoot) | 指定调试器应该定位映射文件而不是生成位置的位置
`newLine` [#](https://www.typescriptlang.org/zh/tsconfig#newLine) | 指定发出文件时要使用的行尾顺序“CRLF”dos或“LF”unix
`noEmit` [#](https://www.typescriptlang.org/zh/tsconfig#noEmit) | 不要发出编译器输出文件,如 JavaScript 源代码、源映射或声明
`noEmitHelpers` [#](https://www.typescriptlang.org/zh/tsconfig#noEmitHelpers) | 您可以在全局范围内为您使用的助手提供实现,并完全关闭助手函数的发出,而不是使用 importHelpers 导入助手
`noEmitOnError` [#](https://www.typescriptlang.org/zh/tsconfig#noEmitOnError) | 如果报告了任何错误,请不要发出编译器输出文件,如 JavaScript 源代码、源映射或声明
`outDir` [#](https://www.typescriptlang.org/zh/tsconfig#outDir) | 如果指定,.js以及 .d.ts、.js.map 等)文件将被发送到此目录中
`outFile` [#](https://www.typescriptlang.org/zh/tsconfig#outFile) | 如果指定,所有全局(非模块)文件将连接到指定的单个输出文件中
`preserveConstEnums` [#](https://www.typescriptlang.org/zh/tsconfig#preserveConstEnums) | 不要删除生成的代码中的 const enum 声明
`preserveValueImports` [#](https://www.typescriptlang.org/zh/tsconfig#preserveValueImports) | 在某些情况下TypeScript 无法检测到您正在使用导入
`removeComments` [#](https://www.typescriptlang.org/zh/tsconfig#removeComments) | 转换为 JavaScript 时从 TypeScript 文件中删除所有注释
`sourceMap` [#](https://www.typescriptlang.org/zh/tsconfig#sourceMap) | 启用源映射文件的生成
`sourceRoot` [#](https://www.typescriptlang.org/zh/tsconfig#sourceRoot) | 指定调试器应定位 TypeScript 文件的位置,而不是相对源位置
`stripInternal` [#](https://www.typescriptlang.org/zh/tsconfig#stripInternal) | 不要为在其 JSDoc 注释中具有 @internal 注释的代码发出声明
<!--rehype:className=style-list-arrow-->
### JavaScript 支持(compilerOptions)
@ -1445,89 +1446,98 @@ TSConfig Ref
:- | --
:- | --
`allowSyntheticDefaultImports` [#](https://www.typescriptlang.org/zh/tsconfig#allowSyntheticDefaultImports) |
`esModuleInterop` [#](https://www.typescriptlang.org/zh/tsconfig#esModuleInterop) |
`forceConsistentCasingInFileNames` [#](https://www.typescriptlang.org/zh/tsconfig#forceConsistentCasingInFileNames) |
`isolatedModules` [#](https://www.typescriptlang.org/zh/tsconfig#isolatedModules) |
`preserveSymlinks` [#](https://www.typescriptlang.org/zh/tsconfig#preserveSymlinks) |
`allowSyntheticDefaultImports` [#](https://www.typescriptlang.org/zh/tsconfig#allowSyntheticDefaultImports) | 允许合成默认导入
`esModuleInterop` [#](https://www.typescriptlang.org/zh/tsconfig#esModuleInterop) | ES 模块互操作
`forceConsistentCasingInFileNames` [#](https://www.typescriptlang.org/zh/tsconfig#forceConsistentCasingInFileNames) | 在文件名中强制使用一致的大小写
`isolatedModules` [#](https://www.typescriptlang.org/zh/tsconfig#isolatedModules) | 隔离模块
`preserveSymlinks` [#](https://www.typescriptlang.org/zh/tsconfig#preserveSymlinks) | 保留符号链接
<!--rehype:className=style-list-arrow-->
### 向后兼容性(compilerOptions)
<!--rehype:wrap-class=row-span-2-->
:- | --
:- | --
`charset` [#](https://www.typescriptlang.org/zh/tsconfig#charset) |
`keyofStringsOnly` [#](https://www.typescriptlang.org/zh/tsconfig#keyofStringsOnly) |
`noImplicitUseStrict` [#](https://www.typescriptlang.org/zh/tsconfig#noImplicitUseStrict) |
`noStrictGenericChecks` [#](https://www.typescriptlang.org/zh/tsconfig#noStrictGenericChecks) |
`out` [#](https://www.typescriptlang.org/zh/tsconfig#out) |
`suppressExcessPropertyErrors` [#](https://www.typescriptlang.org/zh/tsconfig#suppressExcessPropertyErrors) |
`suppressImplicitAnyIndexErrors` [#](https://www.typescriptlang.org/zh/tsconfig#suppressImplicitAnyIndexErrors) |
### 语言与环境(compilerOptions)
:- | --
:- | --
`emitDecoratorMetadata` [#](https://www.typescriptlang.org/zh/tsconfig#emitDecoratorMetadata) |
`experimentalDecorators` [#](https://www.typescriptlang.org/zh/tsconfig#experimentalDecorators) |
`jsx` [#](https://www.typescriptlang.org/zh/tsconfig#jsx) |
`jsxFactory` [#](https://www.typescriptlang.org/zh/tsconfig#jsxFactory) |
`jsxFragmentFactory` [#](https://www.typescriptlang.org/zh/tsconfig#jsxFragmentFactory) |
`jsxImportSource` [#](https://www.typescriptlang.org/zh/tsconfig#jsxImportSource) |
`lib` [#](https://www.typescriptlang.org/zh/tsconfig#lib) |
`moduleDetection` [#](https://www.typescriptlang.org/zh/tsconfig#moduleDetection) |
`noLib` [#](https://www.typescriptlang.org/zh/tsconfig#noLib) |
`reactNamespace` [#](https://www.typescriptlang.org/zh/tsconfig#reactNamespace) |
`target` [#](https://www.typescriptlang.org/zh/tsconfig#target) |
`useDefineForClassFields` [#](https://www.typescriptlang.org/zh/tsconfig#useDefineForClassFields) |
### 编译器诊断(compilerOptions)
:- | --
:- | --
`diagnostics` [#](https://www.typescriptlang.org/zh/tsconfig#diagnostics) |
`explainFiles` [#](https://www.typescriptlang.org/zh/tsconfig#explainFiles) |
`extendedDiagnostics` [#](https://www.typescriptlang.org/zh/tsconfig#extendedDiagnostics) |
`generateCpuProfile` [#](https://www.typescriptlang.org/zh/tsconfig#generateCpuProfile) |
`listEmittedFiles` [#](https://www.typescriptlang.org/zh/tsconfig#listEmittedFiles) |
`listFiles` [#](https://www.typescriptlang.org/zh/tsconfig#listFiles) |
`traceResolution` [#](https://www.typescriptlang.org/zh/tsconfig#traceResolution) |
### 项目(compilerOptions)
:- | --
:- | --
`composite` [#](https://www.typescriptlang.org/zh/tsconfig#composite) |
`disableReferencedProjectLoad` [#](https://www.typescriptlang.org/zh/tsconfig#disableReferencedProjectLoad) |
`disableSolutionSearching` [#](https://www.typescriptlang.org/zh/tsconfig#disableSolutionSearching) |
`disableSourceOfProjectReferenceRedirect` [#](https://www.typescriptlang.org/zh/tsconfig#disableSourceOfProjectReferenceRedirect) |
`incremental` [#](https://www.typescriptlang.org/zh/tsconfig#incremental) |
`tsBuildInfoFile` [#](https://www.typescriptlang.org/zh/tsconfig#tsBuildInfoFile) |
### 输出格式(compilerOptions)
:- | --
:- | --
`noErrorTruncation` [#](https://www.typescriptlang.org/zh/tsconfig#noErrorTruncation) |
`preserveWatchOutput` [#](https://www.typescriptlang.org/zh/tsconfig#preserveWatchOutput) |
`pretty` [#](https://www.typescriptlang.org/zh/tsconfig#pretty) |
`charset` [#](https://www.typescriptlang.org/zh/tsconfig#charset) | 在早期版本的 TypeScript 中,这控制了从磁盘读取文本文件时使用的编码
`keyofStringsOnly` [#](https://www.typescriptlang.org/zh/tsconfig#keyofStringsOnly) | 此标志将 `keyof` 类型运算符更改为返回 `string` 而不是 `string | number` 当应用于具有字符串索引签名的类型时
`noImplicitUseStrict` [#](https://www.typescriptlang.org/zh/tsconfig#noImplicitUseStrict) | 默认情况下,当向非 ES6 目标发出模块文件时TypeScript 发出`"use strict"`;文件顶部的序言。此设置禁用序言
`noStrictGenericChecks` [#](https://www.typescriptlang.org/zh/tsconfig#noStrictGenericChecks) | TypeScript 在比较两个泛型函数时会统一类型参数
`out` [#](https://www.typescriptlang.org/zh/tsconfig#out) | 请改用 `outFile`
`suppressExcessPropertyErrors` [#](https://www.typescriptlang.org/zh/tsconfig#suppressExcessPropertyErrors) | 抑制过多的属性错误
`suppressImplicitAnyIndexErrors` [#](https://www.typescriptlang.org/zh/tsconfig#suppressImplicitAnyIndexErrors) | 抑制隐式任何索引错误
<!--rehype:className=style-list-arrow-->
### 完整性(compilerOptions)
:- | --
:- | --
`skipDefaultLibCheck` [#](https://www.typescriptlang.org/zh/tsconfig#skipDefaultLibCheck) |
`skipLibCheck` [#](https://www.typescriptlang.org/zh/tsconfig#skipLibCheck) |
`skipDefaultLibCheck` [#](https://www.typescriptlang.org/zh/tsconfig#skipDefaultLibCheck) | 请改用 `skipLibCheck`
`skipLibCheck` [#](https://www.typescriptlang.org/zh/tsconfig#skipLibCheck) | 跳过声明文件的类型检查
### 语言与环境(compilerOptions)
<!--rehype:wrap-class=row-span-2-->
:- | --
:- | --
`emitDecoratorMetadata` [#](https://www.typescriptlang.org/zh/tsconfig#emitDecoratorMetadata) | 发射装饰器元数据
`experimentalDecorators` [#](https://www.typescriptlang.org/zh/tsconfig#experimentalDecorators) | 实验装饰器
`jsx` [#](https://www.typescriptlang.org/zh/tsconfig#jsx) | 控制 JSX 在 JavaScript 文件中的输出方式
`jsxFactory` [#](https://www.typescriptlang.org/zh/tsconfig#jsxFactory) | 使用经典 JSX 运行时编译 JSX 元素时更改在 .js 文件中调用的函数
`jsxFragmentFactory` [#](https://www.typescriptlang.org/zh/tsconfig#jsxFragmentFactory) | 指定在使用 jsxFactory 编译器选项指定 react JSX emit 时要使用的 JSX 片段工厂函数,例如 `Fragment`
`jsxImportSource` [#](https://www.typescriptlang.org/zh/tsconfig#jsxImportSource) | 声明模块说明符用于在将 jsx 用作 TypeScript 4.1 中引入的“react-jsx”或“react-jsxdev”时导入 jsx 和 jsxs 工厂函数
`lib` [#](https://www.typescriptlang.org/zh/tsconfig#lib) | TypeScript 包括一组默认的内建 JS 接口(例如 Math的类型定义以及在浏览器环境中存在的对象的类型定义例如 document
`moduleDetection` [#](https://www.typescriptlang.org/zh/tsconfig#moduleDetection) | 模块检测
`noLib` [#](https://www.typescriptlang.org/zh/tsconfig#noLib) | 禁用自动包含任何库文件
`reactNamespace` [#](https://www.typescriptlang.org/zh/tsconfig#reactNamespace) | 请改用 jsxFactory
`target` [#](https://www.typescriptlang.org/zh/tsconfig#target) | 现代浏览器支持全部 ES6 的功能,所以 ES6 是一个不错的选择
`useDefineForClassFields` [#](https://www.typescriptlang.org/zh/tsconfig#useDefineForClassFields) | 为类字段使用定义
<!--rehype:className=style-list-arrow-->
### 输出格式(compilerOptions)
:- | --
:- | --
`noErrorTruncation` [#](https://www.typescriptlang.org/zh/tsconfig#noErrorTruncation) | 不要截断错误消息
`preserveWatchOutput` [#](https://www.typescriptlang.org/zh/tsconfig#preserveWatchOutput) | 保留监视输出
`pretty` [#](https://www.typescriptlang.org/zh/tsconfig#pretty) | 使用颜色和上下文对错误和消息进行样式化,默认情况下启用
<!--rehype:className=style-list-arrow-->
### 项目(compilerOptions)
:- | --
:- | --
`composite` [#](https://www.typescriptlang.org/zh/tsconfig#composite) | composite 选项会强制执行某些约束,使得构建工具(包括 在 --build 模式下的 TypeScript 本身)可以快速确定一个工程是否已经建立
`disableReferencedProjectLoad` [#](https://www.typescriptlang.org/zh/tsconfig#disableReferencedProjectLoad) | 禁用引用项目加载
`disableSolutionSearching` [#](https://www.typescriptlang.org/zh/tsconfig#disableSolutionSearching) | 禁用解决方案搜索
`disableSourceOfProjectReferenceRedirect` [#](https://www.typescriptlang.org/zh/tsconfig#disableSourceOfProjectReferenceRedirect) | 禁用源项目引用重定向
`incremental` [#](https://www.typescriptlang.org/zh/tsconfig#incremental) | 使 TypeScript 将上次编译的工程图信息保存到磁盘上的文件中
`tsBuildInfoFile` [#](https://www.typescriptlang.org/zh/tsconfig#tsBuildInfoFile) | 这个选项可以让您指定一个文件来存储增量编译信息,以作为复合工程的一部分,从而可以更快的构建更大的 TypeScript 代码库
<!--rehype:className=style-list-arrow-->
### 编译器诊断(compilerOptions)
:- | --
:- | --
`diagnostics` [#](https://www.typescriptlang.org/zh/tsconfig#diagnostics) | 用于输出调试信息
`explainFiles` [#](https://www.typescriptlang.org/zh/tsconfig#explainFiles) | 打印 TypeScript 视为项目一部分的文件的名称以及它们是编译一部分的原因
`extendedDiagnostics` [#](https://www.typescriptlang.org/zh/tsconfig#extendedDiagnostics) | 您可以使用此标志来发现 TypeScript 在编译时将时间花在哪里
`generateCpuProfile` [#](https://www.typescriptlang.org/zh/tsconfig#generateCpuProfile) | 此选项使您有机会让 TypeScript 在编译器运行期间发出 v8 CPU 配置文件
`listEmittedFiles` [#](https://www.typescriptlang.org/zh/tsconfig#listEmittedFiles) | 将编译过程中生成的文件的名称打印到终端
`listFiles` [#](https://www.typescriptlang.org/zh/tsconfig#listFiles) | 打印编译部分文件的名称
`traceResolution` [#](https://www.typescriptlang.org/zh/tsconfig#traceResolution) | 当您尝试调试未包含模块的原因时
<!--rehype:className=style-list-arrow-->
### 监听选项(watchOptions)
:- | --
:- | --
`watchFile` [#](https://www.typescriptlang.org/zh/tsconfig#watch-watchFile) |
`watchDirectory` [#](https://www.typescriptlang.org/zh/tsconfig#watch-watchDirectory) |
`fallbackPolling` [#](https://www.typescriptlang.org/zh/tsconfig#watch-fallbackPolling) |
`synchronousWatchDirectory` [#](https://www.typescriptlang.org/zh/tsconfig#watch-synchronousWatchDirectory) |
`excludeDirectories` [#](https://www.typescriptlang.org/zh/tsconfig#watch-excludeDirectories) |
`excludeFiles` [#](https://www.typescriptlang.org/zh/tsconfig#watch-excludeFiles) |
`watchFile` [#](https://www.typescriptlang.org/zh/tsconfig#watch-watchFile) | 如何监视单个文件的策略
`watchDirectory` [#](https://www.typescriptlang.org/zh/tsconfig#watch-watchDirectory) | 在缺乏递归文件监视功能的系统下监视整个目录树的策略
`fallbackPolling` [#](https://www.typescriptlang.org/zh/tsconfig#watch-fallbackPolling) | 使用文件系统事件时,此选项指定当系统用完本机文件观察器和/或不支持本机文件观察器时使用的轮询策略
`synchronousWatchDirectory` [#](https://www.typescriptlang.org/zh/tsconfig#watch-synchronousWatchDirectory) | 在本机不支持递归监视的平台上同步调用回调并更新目录监视程序的状态
`excludeDirectories` [#](https://www.typescriptlang.org/zh/tsconfig#watch-excludeDirectories) | 您可以使用 excludeFiles 来大幅减少在 --watch 期间监视的文件数量
`excludeFiles` [#](https://www.typescriptlang.org/zh/tsconfig#watch-excludeFiles) | 您可以使用 excludeFiles 从监视的文件中删除一组特定文件
<!--rehype:className=style-list-arrow-->
---
@ -1543,10 +1553,11 @@ TSConfig Ref
:- | --
:- | --
`enable` [#](https://www.typescriptlang.org/zh/tsconfig#type-enable) |
`include` [#](https://www.typescriptlang.org/zh/tsconfig#type-include) |
`exclude` [#](https://www.typescriptlang.org/zh/tsconfig#type-exclude) |
`disableFilenameBasedTypeAcquisition` [#](https://www.typescriptlang.org/zh/tsconfig#type-disableFilenameBasedTypeAcquisition) |
`enable` [#](https://www.typescriptlang.org/zh/tsconfig#type-enable) | 提供用于在 JavaScript 项目中禁用类型获取的配置
`include` [#](https://www.typescriptlang.org/zh/tsconfig#type-include) | 如果您有一个 JavaScript 项目,其中 TypeScript 需要额外的指导来理解全局依赖关系,或者已通过 disableFilenameBasedTypeAcquisition 禁用了内置推理
`exclude` [#](https://www.typescriptlang.org/zh/tsconfig#type-exclude) | 提供用于禁用 JavaScript 项目中特定模块的类型获取的配置
`disableFilenameBasedTypeAcquisition` [#](https://www.typescriptlang.org/zh/tsconfig#type-disableFilenameBasedTypeAcquisition) | TypeScript 的类型获取可以根据项目中的文件名推断出应该添加哪些类型
<!--rehype:className=style-list-arrow-->
---

View File

@ -616,6 +616,46 @@ const onSearch = function(){
父组件调用子组件的方法
### Provide / Inject
```ts
// types
import type { InjectionKey, Ref } from 'vue'
export const ProvideKey = Symbol() as InjectionKey<Ref<string>>
```
```ts
<script setup lang="ts">
import { provide, ref } from 'vue'
import { ProvideKey } from './types'
const text = ref<string>('123')
provide(ProvideKey, text)
</script>
<template>
<input v-model="text" />
</template>
```
父组件为后代组件提供数据
```ts
<script setup lang="ts">
import { inject } from 'vue'
import { ProvideKey } from './types'
const value = inject(ProvideKey)
</script>
<template>
<h4>{{value}}</h4>
</template>
```
后代组件注入父组件提供的数据
<!--rehype:className=wrap-text -->
API 参考

View File

@ -1,6 +1,6 @@
{
"name": "@wcj/reference",
"version": "1.23.0",
"version": "1.24.0",
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
"author": "jaywcjlove",
"license": "MIT",
@ -23,7 +23,7 @@
"keywords": [],
"devDependencies": {
"@uiw/formatter": "^1.3.3",
"@wcj/markdown-to-html": "^2.1.2",
"@wcj/markdown-to-html": "^2.2.0",
"chokidar": "^3.5.3",
"fs-extra": "^10.1.0",
"husky": "^8.0.1",

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 64 37"><path fill="currentColor" d="M16.365,3.888 C12.8963333,3.888 10.1373333,5.18133333 8.088,7.768 C6.05466667,10.3533333 5.038,13.8766667 5.038,18.338 C5.038,22.7846667 6.05466667,26.3003333 8.088,28.885 C10.1373333,31.4716667 12.8963333,32.765 16.365,32.765 C19.8336667,32.765 22.577,31.4716667 24.595,28.885 C26.6283333,26.2996667 27.645,22.784 27.645,18.338 C27.645,13.876 26.6283333,10.3526667 24.595,7.768 C22.577,5.18133333 19.8336667,3.888 16.365,3.888 Z M16.365,0.01 C21.3156667,0.01 25.273,1.67666667 28.237,5.01 C31.201,8.32066667 32.683,12.7666667 32.683,18.348 C32.683,23.9133333 31.201,28.3593333 28.237,31.686 C25.273,34.9966667 21.3156667,36.652 16.365,36.652 C11.3983333,36.652 7.425,34.9966667 4.445,31.686 C1.48166667,28.368 0,23.9186667 0,18.338 C0,12.7566667 1.482,8.31066667 4.446,5 C7.426,1.66666667 11.3993333,0 16.366,0 L16.365,0.01 Z M61.682,1.76 L61.682,9.233 C59.742,8.36633333 57.85,7.712 56.006,7.27 C54.1613333,6.82866667 52.4193333,6.608 50.78,6.608 C48.604,6.608 46.996,6.908 45.956,7.508 C44.916,8.108 44.396,9.038 44.396,10.298 C44.396,11.2446667 44.7426667,11.9856667 45.436,12.521 C46.1453333,13.041 47.422,13.4903333 49.266,13.869 L53.144,14.649 C57.0706667,15.4376667 59.8613333,16.636 61.516,18.244 C63.172,19.852 64,22.1376667 64,25.101 C64,28.9943333 62.8413333,31.8953333 60.524,33.804 C58.222,35.696 54.6986667,36.642 49.954,36.642 C47.7153333,36.642 45.4686667,36.4286667 43.214,36.002 C40.9593333,35.5766667 38.7046667,34.946 36.45,34.11 L36.45,26.436 C38.7046667,27.634 40.8803333,28.5406667 42.977,29.156 C45.0903333,29.756 47.1236667,30.056 49.077,30.056 C51.0636667,30.056 52.585,29.725 53.641,29.063 C54.697,28.401 55.225,27.455 55.225,26.225 C55.225,25.1216667 54.8623333,24.2703333 54.137,23.671 C53.4276667,23.071 52.001,22.535 49.857,22.063 L46.333,21.283 C42.8016667,20.5263333 40.216,19.3203333 38.576,17.665 C36.952,16.0096667 36.14,13.7786667 36.14,10.972 C36.14,7.456 37.275,4.752 39.545,2.86 C41.815,0.968 45.0783333,0.022 49.335,0.022 C51.275,0.022 53.2693333,0.172 55.318,0.472 C57.3673333,0.756 59.488,1.18933333 61.68,1.772 L61.682,1.76 Z" transform="translate(0 .164)"/></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 723 B

View File

@ -0,0 +1,3 @@
<svg viewBox="0 0 256 317" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="M198.814 98.655a10.349 10.349 0 0 1 8.975 5.244l35.586 61.635c25.367 43.937 11.463 104.796-32.341 141.562a10.331 10.331 0 0 1-3.116 1.8 128.641 128.641 0 0 1-43.96 7.784c-39.453 0-76.278-18.462-94.807-50.556l-42.35-73.35a10.348 10.348 0 0 1 3.788-14.136l28.846-16.655a10.349 10.349 0 1 1 10.349 17.924L49.9 191.387l37.175 64.388c20.152 34.905 68.066 49.46 112.043 34.282 35.13-30.495 46.485-79.27 26.334-114.174l-35.586-61.635a10.349 10.349 0 0 1 8.948-15.593Zm-108.74 96.59c.12.216 6.66 11.866 12.895 22.894l.583 1.032c3.298 5.832 6.45 11.381 8.448 14.842 14.574 25.244 41.265 34.887 71.401 25.778 5.472-1.653 11.247 1.443 12.9 6.914 1.652 5.472-1.444 11.247-6.915 12.9a95.73 95.73 0 0 1-27.672 4.247 76.222 76.222 0 0 1-67.639-39.49 2209.073 2209.073 0 0 1-8.391-14.737l-.576-1.018-.577-1.022-.579-1.023-.578-1.023-.576-1.02a7893.27 7893.27 0 0 1-10.805-19.202c-2.782-4.993-.989-11.296 4.004-14.077 4.993-2.781 11.295-.988 14.077 4.005ZM19.272 5.105l122.265 211.771c3.335 5.774 12.789 15.683 24.682 11.845 5.44-1.754 11.272 1.235 13.025 6.675 1.753 5.44-1.236 11.272-6.676 13.025a38.083 38.083 0 0 1-11.719 1.875c-16.345 0-30.2-10.884-37.236-23.07L1.348 15.454C-1.455 10.51.253 4.23 5.176 1.388 10.098-1.454 16.39.206 19.272 5.106Zm89.756 60.963 29.135 50.463 18.53-10.7c4.945-2.812 11.234-1.105 14.078 3.821 2.845 4.927 1.18 11.226-3.729 14.103L139.55 139.63a10.35 10.35 0 0 1-4.812 1.381l-.364.006-.324-.005a10.35 10.35 0 0 1-8.637-5.169L91.104 76.417c-2.803-4.945-1.095-11.225 3.828-14.067 4.922-2.842 11.215-1.182 14.096 3.718Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -7,13 +7,13 @@ import { getCodeString } from 'rehype-rewrite';
import rehypeSlug from 'rehype-slug';
import { htmlTagAddAttri } from './nodes/htmlTagAddAttri.mjs';
import { footer } from './nodes/footer.mjs';
import { search } from './nodes/search.mjs';
import { header } from './nodes/header.mjs';
import { rehypeUrls } from './utils/rehypeUrls.mjs';
import { tooltips } from './utils/tooltips.mjs';
import { homeCardIcons } from './utils/homeCardIcons.mjs';
import { getTocsTree, getTocsTitleNode, getTocsTitleNodeWarpper, addTocsInWarp } from './utils/getTocsTree.mjs';
import { rehypeTitle } from './utils/rehypeTitle.mjs';
import { anchorPoint } from './utils/anchorPoint.mjs';
import { rehypePreviewHTML } from './utils/rehypePreviewHTML.mjs';
const favicon = `data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23c9d1d9%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3C%2Fsvg%3E`;
@ -38,6 +38,9 @@ export function create(str = '', options = {}) {
const mdOptions = {
showLineNumbers: false,
hastNode: false,
katexOptions: {
strict: false,
},
remarkPlugins: [remarkGemoji],
rehypePlugins: [
rehypeSlug,
@ -89,6 +92,7 @@ export function create(str = '', options = {}) {
if (!options.isHome) {
const tocsMenus = getTocsTitleNode([...tocsData]);
node.children = addTocsInWarp([...tocsData], getTocsTitleNodeWarpper(tocsMenus));
// 生成搜索数据
tocsMenus.forEach((menu, idx) => {
const level = menu?.properties['data-num'];
if (idx + 1 === tocsMenus.length && level === 2) {
@ -107,7 +111,8 @@ export function create(str = '', options = {}) {
}
node.children.unshift(header(options));
node.children.push(footer(options));
node.children.push(anchorPoint());
// node.children.push(search(options));
node.children = node.children.concat(search(options));
}
}
},

View File

@ -7,6 +7,7 @@ export const OUTOUT = path.resolve(process.cwd(), 'dist');
export const DOCS = path.resolve(process.cwd(), 'docs');
/** 搜索数据路径 */
export const SEARCH_DATA = path.resolve(OUTOUT, 'data.json');
export const SEARCH_DATA_JS = path.resolve(OUTOUT, 'data.js');
export const SEARCH_DATA_CACHE = path.resolve(process.cwd(), 'node_modules/.cache/reference/data.json');
export async function createHTML(files = [], num = 0) {
@ -49,12 +50,21 @@ export async function createHTML(files = [], num = 0) {
.map((name) => searchData[name])
.filter((item) => typeof item !== 'string');
await fs.writeJSON(SEARCH_DATA, resultSearchData);
await fs.writeFile(SEARCH_DATA_JS, `const REFS_DATA = ${JSON.stringify(resultSearchData)}`);
}
await fs.writeFile(outputHTMLPath, html);
console.log(`♻️ \x1b[32;1m ${path.relative(OUTOUT, outputHTMLPath)} \x1b[0m`);
createHTML(files, num);
}
export async function copyCSSFile() {
await fs.copy(path.resolve(process.cwd(), 'scripts/style'), path.resolve(OUTOUT, 'style'));
}
export async function copyJSFile() {
await fs.copy(path.resolve(process.cwd(), 'scripts/js'), path.resolve(OUTOUT, 'js'));
}
export async function run() {
try {
await fs.ensureDir(OUTOUT);
@ -63,7 +73,8 @@ export async function run() {
await fs.ensureFile(SEARCH_DATA_CACHE);
await fs.writeFile(SEARCH_DATA_CACHE, '{}');
await fs.writeFile(SEARCH_DATA, '[]');
await fs.copy(path.resolve(process.cwd(), 'scripts/style'), path.resolve(OUTOUT, 'style'));
await copyCSSFile();
await copyJSFile();
const files = await recursiveReaddirFiles(process.cwd(), {
ignored: /\/(node_modules|\.git)/,
exclude: /(\.json|\.mjs|CONTRIBUTING\.md)$/,

12
scripts/js/dark.js Normal file
View File

@ -0,0 +1,12 @@
const LOCAL_NANE = '_dark_mode_theme_'
const rememberedValue = localStorage.getItem(LOCAL_NANE);
if (rememberedValue && ['light', 'dark'].includes(rememberedValue)) {
document.documentElement.setAttribute('data-color-mode', rememberedValue);
}
const button = document.querySelector('#darkMode');
button.onclick = () => {
const theme = document.documentElement.dataset.colorMode;
const mode = theme === 'light' ? 'dark' : 'light';
document.documentElement.setAttribute('data-color-mode', mode);
localStorage.setItem(LOCAL_NANE, mode);
}

9
scripts/js/fuse.min.js vendored Normal file

File diff suppressed because one or more lines are too long

140
scripts/js/main.js Normal file
View File

@ -0,0 +1,140 @@
/** ==========anchor============== */
if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
window.onhashchange = function () {
anchorPoint()
updateAnchor()
};
}
function anchorPoint() {
const hash = window.location.hash?.replace(/^#/, '') || '';
const elm = document.getElementById(decodeURIComponent(hash));
Array.from(document.querySelectorAll('.h2wrap-body .wrap')).forEach((elm) => elm.classList.remove('active'))
if (elm?.tagName === 'H3') {
elm?.parentElement?.parentElement?.classList.add('active');
}
}
anchorPoint();
function updateAnchor(element) {
const anchorContainer = document.querySelectorAll('.menu-tocs .menu-modal a.tocs-link');
anchorContainer.forEach((tocanchor) => {
tocanchor.classList.remove('is-active-link');
});
const anchor = element || document.querySelector(`a.tocs-link[href='${decodeURIComponent(window.location.hash)}']`);
if (anchor) {
anchor.classList.add('is-active-link');
}
}
// toc 定位
updateAnchor()
const anchorAll = document.querySelectorAll('.menu-tocs .menu-modal a.tocs-link');
anchorAll.forEach((item) => {
item.addEventListener('click', (e) => {
updateAnchor()
})
})
/** ==========search============== */
const fuse = new Fuse(REFS_DATA, {
includeScore: !1,
shouldSort: !0,
includeMatches: !0,
matchEmptyQuery: !0,
threshold: .1,
keys: [
{ name: "title", weight: 12 },
{ name: 'intro', weight: 2 },
{ name: 'sections.t', weight: 5 }
],
});
const searchBtn = document.getElementById('searchbtn');
const searchBox = document.getElementById('mysearch');
const searchInput = document.getElementById('mysearch-input');
const closeBtn = document.getElementById('mysearch-close');
const searchMenu = document.getElementById('mysearch-menu');
const searchContent = document.getElementById('mysearch-content');
const isHome = document.body.classList.contains('home');
searchBtn.addEventListener('click', (ev) => {
ev.preventDefault();
showSearch();
});
closeBtn.addEventListener('click', hideSearch);
searchBox.addEventListener('click', hideSearch);
searchBox.firstChild.addEventListener('click', (ev) => ev.stopPropagation());
searchInput.addEventListener('input', (evn) => searchResult(evn.target.value));
document.addEventListener('keydown', (ev) => {
if (ev.metaKey && ev.key.toLocaleLowerCase() === 'k') {
searchBox.classList.contains('show') ? hideSearch() : showSearch();
}
});
function showSearch() {
document.body.classList.add('search');
searchBox.classList.add('show');
searchInput.focus();
}
function hideSearch() {
document.body.classList.remove('search');
searchBox.classList.remove('show');
}
let result = []
let inputValue = '';
function searchResult(value) {
inputValue = value;
result = fuse.search(value);
let menuHTML = '';
result.forEach((item, idx) => {
const label = item.item.title.replace(new RegExp(value, 'ig'), (txt) => {
return `<mark>${txt}</mark>`
})
const href = isHome ? item.item.path : item.item.path.replace('docs/', '');
if (idx === 0) {
menuHTML += `<a href="${href}" class="active">${label}</a>`;
} else {
menuHTML += `<a href="${href}">${label}</a>`;
}
});
searchMenu.innerHTML = menuHTML;
searchSectionsResult();
const data = Array.from(searchMenu.children)
data.forEach((anchor, idx) => {
anchor.onmouseenter = (evn) => {
data.forEach(item => item.classList.remove('active'));
evn.target.classList.add('active');
searchSectionsResult(idx);
}
});
const anchorData = searchContent.querySelectorAll('a');
Array.from(anchorData).forEach((item) => {
item.addEventListener('click', hideSearch);
})
}
function searchSectionsResult(idx = 0) {
const data = result[idx] || [];
const title = (data.item?.intro || '').replace(new RegExp(inputValue, 'ig'), (txt) => {
return `<mark>${txt}</mark>`
});
let sectionHTML = `<h3>${title}</h3><ol>`;
if (data && data.item && data.item.sections) {
data.item.sections.forEach((item, idx) => {
const label = item.t.replace(new RegExp(inputValue, 'ig'), (txt) => {
return `<mark>${txt}</mark>`
})
const href = isHome ? data.item.path : data.item.path.replace('docs/', '');
if (item.l < 3) {
sectionHTML += `<li><a href="${href + item.a}">${label}</a><div>`
} else {
sectionHTML += `<a href="${href + item.a}">${label}</a>`
}
if (data.item.sections.length === idx + 1) {
sectionHTML += `</div></li>`
}
})
}
searchContent.innerHTML = sectionHTML;
}

View File

@ -1,8 +1,8 @@
import formatter from '@uiw/formatter';
export function footer(options = {}) {
export function footer({ isHome } = {}) {
let footerText = '© 2022 Kenny Wang.';
if (options.isHome) {
if (isHome) {
const now = new Date();
const utc = now.getTime() + now.getTimezoneOffset() * 60000;
const cst = new Date(utc + 3600000 * 8);

View File

@ -4,9 +4,45 @@ import { getSVGNode } from '../utils/getSVGNode.mjs';
import { darkMode } from '../utils/darkMode.mjs';
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets/quickreference.svg');
export function header({ homePath, githubURL = '' }) {
const ICONS_SEARCH_PATH = path.resolve(process.cwd(), 'scripts/assets/search.svg');
export function header({ homePath, githubURL = '', isHome } = {}) {
const svgNode = getSVGNode(ICONS_PATH);
const svgSearchNode = getSVGNode(ICONS_SEARCH_PATH);
const data = [
{
menu: true,
href: 'javascript:void(0);',
class: ['searchbtn'],
id: 'searchbtn',
children: [
...svgSearchNode,
{
type: 'element',
tagName: 'span',
children: [
{
type: 'text',
value: '搜索',
},
],
},
{
type: 'element',
tagName: 'span',
children: [
{
type: 'text',
value: '⌘',
},
{
type: 'text',
value: 'K',
},
],
},
],
},
{
menu: true,
href: githubURL,
@ -14,7 +50,7 @@ export function header({ homePath, githubURL = '' }) {
label: '编辑',
children: [editor],
},
...darkMode(),
...darkMode({ homePath, isHome }),
{
menu: true,
href: 'https://github.com/jaywcjlove/reference',

107
scripts/nodes/search.mjs Normal file
View File

@ -0,0 +1,107 @@
import path from 'path';
import { getSVGNode } from '../utils/getSVGNode.mjs';
const ICONS_SEARCH_PATH = path.resolve(process.cwd(), 'scripts/assets/search.svg');
export function search({ homePath = '', isHome } = {}) {
const relativePath = homePath.replace(/\/?index.html$/, isHome ? '' : '/');
const fuseJSUrl = relativePath + 'js/fuse.min.js';
const manJSUrl = relativePath + 'js/main.js';
const dataJSUrl = relativePath + 'data.js';
const svgSearchNode = getSVGNode(ICONS_SEARCH_PATH);
return [
{
type: 'element',
tagName: 'script',
properties: {
src: dataJSUrl,
defer: true,
},
},
{
type: 'element',
tagName: 'script',
properties: {
src: fuseJSUrl,
defer: true,
},
},
{
type: 'element',
tagName: 'script',
properties: {
src: manJSUrl,
defer: true,
},
},
{
type: 'element',
tagName: 'div',
properties: {
id: 'mysearch',
},
children: [
{
type: 'element',
tagName: 'div',
properties: {
class: ['mysearch-box'],
},
children: [
{
type: 'element',
tagName: 'div',
properties: { class: ['mysearch-input'] },
children: [
{
type: 'element',
tagName: 'div',
properties: {},
children: [
...svgSearchNode,
{
type: 'element',
tagName: 'input',
properties: { id: ['mysearch-input'], type: 'search' },
children: [],
},
{
type: 'element',
tagName: 'div',
properties: { class: ['mysearch-clear'] },
},
],
},
{
type: 'element',
tagName: 'button',
properties: { id: ['mysearch-close'], type: 'button' },
children: [{ type: 'text', value: '取消' }],
},
],
},
{
type: 'element',
tagName: 'div',
properties: { class: ['mysearch-result'] },
children: [
{
type: 'element',
tagName: 'div',
properties: { id: 'mysearch-menu' },
children: [],
},
{
type: 'element',
tagName: 'div',
properties: { id: 'mysearch-content' },
children: [],
},
],
},
],
},
],
},
];
}

File diff suppressed because it is too large Load Diff

View File

@ -80,6 +80,7 @@ body {
--color-attention-subtle: #fff8c5;
--color-danger-fg: #cf222e;
--box-shadow: 109 109 109;
--primary-color: #228e6c;
}
[data-color-mode*='dark'],
@ -128,6 +129,7 @@ body {
--color-attention-subtle: rgba(187, 128, 9, 0.15);
--color-danger-fg: #f85149;
--box-shadow: 0 0 0;
--primary-color: #228e6c;
}
body {
@ -540,6 +542,21 @@ a.text-grey {
.header-nav .menu a > span {
font-size: 0.9rem;
}
.header-nav .menu .searchbtn {
text-decoration-color: transparent;
gap: 0.75rem;
}
.header-nav .menu .searchbtn span:last-child {
transition: all 0.3s;
border: 1px solid var(--color-border-default);
border-radius: 3px;
padding: 1px 1px 1px 3px;
letter-spacing: 3px;
}
.header-nav .menu .searchbtn:hover span:last-child {
border-color: var(--primary-color);
color: var(--primary-color);
}
.header-nav .menu button {
font-family: inherit;
font-size: 100%;
@ -1199,6 +1216,158 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
font-size: 0.75rem;
}
body.search {
overflow: hidden;
}
#mysearch {
transition: all 0.3s;
display: none;
}
#mysearch.show .mysearch-box {
background-color: var(--color-canvas-default);
box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 35px 60px -15px rgba(0, 0, 0, 0.3);
border-radius: 0.5rem;
display: flex;
flex-direction: column;
max-width: 1024px;
width: 100%;
height: 100%;
}
#mysearch.show .mysearch-result > * {
width: 50%;
overflow-y: auto;
padding: 0.6rem;
}
#mysearch.show .mysearch-result > :last-child {
background-color: var(--color-neutral-muted);
border-bottom-right-radius: 0.5rem;
}
#mysearch.show .mysearch-result {
display: flex;
flex: 1;
height: calc(100% - 3.5rem);
}
#mysearch.show {
background-color: var(--color-neutral-muted);
height: 100vh;
left: 0;
position: fixed;
top: 0;
width: 100vw;
z-index: 200;
display: flex;
align-items: center;
justify-content: center;
}
.mysearch-input {
height: 3.5rem;
display: flex;
flex-direction: row;
border-bottom: 1px solid var(--color-neutral-muted);
}
.mysearch-input > :first-child {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
}
.mysearch-input > :first-child svg {
margin-left: 1rem;
font-size: 1.3rem;
position: absolute;
color: var(--primary-color);
}
.mysearch-input > :first-child input {
flex: 1;
height: 100%;
padding-left: 2.9rem;
font-size: 1.6rem;
color: var(--color-fg-default);
border: 0;
font-weight: 800;
background: transparent;
outline: 0;
}
#mysearch-close:hover {
color: var(--primary-color);
}
#mysearch-close {
background-color: transparent;
color: var(--color-fg-default);
border: 0;
padding: 0 1.6rem;
cursor: pointer;
font-size: 1.1rem;
transition: all 0.3s;
}
#mysearch-menu a + a {
margin: 0.2rem 0;
}
#mysearch-menu a {
display: flex;
padding-top: 0.625rem;
padding-bottom: 0.625rem;
padding-left: 0.875rem;
padding-right: 0.875rem;
transition: all 0.3s;
white-space: pre-wrap;
text-decoration: none;
color: var(--color-fg-default);
}
#mysearch-menu a:hover,
#mysearch-menu a.active {
background-color: var(--color-neutral-muted);
border-radius: 0.5rem;
}
#mysearch-content ol li div a:hover {
background-color: var(--primary-color);
color: #fff;
}
#mysearch-content ol li div a {
padding: 0.125rem 0.5rem;
border-radius: 100px;
margin: 0.1rem 0.2rem;
color: var(--color-fg-subtle);
}
#mysearch-content ol li div {
margin-left: -1.54rem;
padding-top: 0.82rem;
}
#mysearch-content ol li > a:hover {
text-decoration: underline;
}
#mysearch-content ol li > a {
font-weight: bold;
}
#mysearch-content ol li a {
font-size: 0.85rem;
white-space: nowrap;
display: inline-block;
text-decoration: none;
color: var(--color-fg-default);
transition: all 0.3s;
}
#mysearch-content ol li {
word-break: break-all;
white-space: pre-wrap;
padding-bottom: 1.56rem;
}
#mysearch-content ol {
list-style: auto;
padding-left: 1.75rem;
}
#mysearch-content h3 {
padding-bottom: 1.3rem;
text-align: center;
padding-top: 1.5rem;
color: var(--color-fg-subtle);
max-width: 23rem;
margin: 0 auto;
font-size: 0.85rem;
}
@media (min-width: 1024px) {
.h2wrap-body {
display: grid;
@ -1207,6 +1376,10 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
.h2wrap-body > .wrap {
margin-bottom: 0;
}
#mysearch.show {
padding-bottom: 5rem;
padding-top: 4rem;
}
}
@media (375px <= width <= 1024px) {
.header-nav .title {

View File

@ -1,49 +0,0 @@
const scripts = `
if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
window.onhashchange = function () {
anchorPoint()
updateAnchor()
};
}
function anchorPoint() {
const hash = window.location.hash?.replace(/^#/, '') || '';
const elm = document.getElementById(decodeURIComponent(hash));
Array.from(document.querySelectorAll('.h2wrap-body .wrap')).forEach((elm) => elm.classList.remove('active'))
if (elm?.tagName === 'H3') {
elm?.parentElement?.parentElement?.classList.add('active');
}
}
anchorPoint();
function updateAnchor(element) {
const anchorContainer = document.querySelectorAll('.menu-tocs .menu-modal a.tocs-link');
anchorContainer.forEach((tocanchor) => {
tocanchor.classList.remove('is-active-link');
});
const anchor = element || document.querySelector(\`a.tocs-link[href='\${decodeURIComponent(window.location.hash)}']\`);
if (anchor) {
anchor.classList.add('is-active-link');
}
}
// toc 定位
updateAnchor()
const anchor = document.querySelectorAll('.menu-tocs .menu-modal a.tocs-link');
anchor.forEach((item) => {
item.addEventListener('click', (e) => {
updateAnchor()
})
})
`;
export function anchorPoint() {
return {
type: 'element',
tagName: 'script',
children: [
{
type: 'text',
value: scripts,
},
],
};
}

View File

@ -1,28 +1,15 @@
import path from 'path';
import { getSVGNode } from './getSVGNode.mjs';
const scripts = `
const LOCAL_NANE = '_dark_mode_theme_'
const rememberedValue = localStorage.getItem(LOCAL_NANE);
if (rememberedValue && ['light', 'dark'].includes(rememberedValue)) {
document.documentElement.setAttribute('data-color-mode', rememberedValue);
}
const button = document.querySelector('#darkMode');
button.onclick = () => {
const theme = document.documentElement.dataset.colorMode;
const mode = theme === 'light' ? 'dark' : 'light';
document.documentElement.setAttribute('data-color-mode', mode);
localStorage.setItem(LOCAL_NANE, mode);
}
`;
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets');
export function darkMode() {
export function darkMode({ homePath = '', isHome } = {}) {
const relativePath = homePath.replace(/\/?index.html$/, isHome ? '' : '/');
const iconSunPath = path.resolve(ICONS_PATH, `sun.svg`);
const iconMoonPath = path.resolve(ICONS_PATH, `moon.svg`);
const sunNode = getSVGNode(iconSunPath);
const moonNode = getSVGNode(iconMoonPath);
const darkJSUrl = relativePath + 'js/dark.js';
return [
{
type: 'element',
@ -36,12 +23,9 @@ export function darkMode() {
{
type: 'element',
tagName: 'script',
children: [
{
type: 'text',
value: scripts,
},
],
properties: {
src: darkJSUrl,
},
},
];
}

View File

@ -1,20 +1,32 @@
import path from 'path';
import chokidar from 'chokidar';
import { getStat } from 'recursive-readdir-files';
import { run, DOCS, createHTML } from './index.mjs';
import { run, DOCS, createHTML, copyCSSFile, copyJSFile } from './index.mjs';
(async () => {
await run();
const homeMdPath = path.relative(process.cwd(), 'README.md');
const watcher = chokidar.watch([DOCS, homeMdPath], {
const cssDirPath = path.relative(process.cwd(), 'scripts/style');
const jsDirPath = path.relative(process.cwd(), 'scripts/js');
const watcher = chokidar.watch([DOCS, homeMdPath, cssDirPath, jsDirPath], {
ignored: /(^|[\/\\])\../, // ignore dotfiles
persistent: true,
});
watcher
.on('change', async (path) => {
const stats = await getStat(path);
createHTML([stats]);
.on('change', async (filepath) => {
if (filepath.endsWith('.md')) {
const stats = await getStat(filepath);
createHTML([stats]);
}
if (filepath.endsWith('.css')) {
copyCSSFile(filepath);
console.log(`♻️ \x1b[32;1m ${path.relative(cssDirPath, filepath)} \x1b[0m`);
}
if (filepath.endsWith('.js')) {
copyJSFile(filepath);
console.log(`♻️ \x1b[32;1m ${path.relative(jsDirPath, filepath)} \x1b[0m`);
}
})
.on('error', (error) => console.log(`Watcher error: ${error}`));
})();