website: Support math formula display. (#21)

This commit is contained in:
jaywcjlove 2022-11-04 13:01:39 +08:00
parent f683ca5294
commit 009c50760c
69 changed files with 1119 additions and 13 deletions

View File

@ -1116,7 +1116,7 @@ grid-row-gap: length;
### minmax() 函数
<!--rehype:wrap-class=col-span-2-->
```css {.wrap}
```css
.grid {
display: grid;
grid-template-columns: 100px minmax(100px, 500px) 100px;

View File

@ -74,7 +74,7 @@ a{Click me}
p>{Click }+a{here}+{ 继续}
```html {.wrap}
```html
<p>Click <a href="">here</a> 继续</p>
```

View File

@ -192,7 +192,7 @@ $ cat video.avi | nc -l 8000
客户端 Client
```shell {.wrap}
```shell
$ nc 192.168.1.9 8000 | mplayer -vo x11 -cache 3000 -
```

View File

@ -260,6 +260,22 @@ const school = <div>学校</div>;
上面的 `markdown` 代码在 `meta` 位置添加 `preview` 标识HTML 代码将被执行预览
### KaTeX 数学渲染
```KaTeX
c = \pm\sqrt{a^2 + b^2}
L = \frac{1}{2} \rho v^2 S C_L
```
上面示例 `Markdown` 代码源码
```markdown {1}
```KaTeX
c = \pm\sqrt{a^2 + b^2}
L = \frac{1}{2} \rho v^2 S C_L
```
还可以单行展示 `KaTeX:c = \pm\sqrt{a^2 + b^2}`,需要标记 \`KaTeX:数学公式\` 将被显示成数学公式,这是基于 [KaTeX](https://katex.org/) 生成
布局
---

View File

@ -855,7 +855,7 @@ console.log(array[1]);
### replace()
```javascript {.wrap}
```javascript
let text = 'Do you like aPPles?';
let regex = /apples/i
@ -1091,7 +1091,7 @@ MySQL中的正则表达式
### REGEXP
```sql {.wrap}
```sql
expr REGEXP pat
```
@ -1164,7 +1164,7 @@ mysql> SELECT regexp_like('a\nb\nc', '^b$', 'm');
### REGEXP_INSTR
``` {.wrap}
```
REGEXP_INSTR(expr, pat[, pos[, occurrence[, return_option[, match_type]]]])
```

View File

@ -57,7 +57,7 @@ other_thing: *VAR_NAME
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"some_thing": "foobar",
"other_thing": "foobar"
@ -84,7 +84,7 @@ description: |
#### ↓ 等效的 JSON
```json {.wrap}
```json
{"description": "hello\nworld\n"}
```
@ -102,7 +102,7 @@ child:
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"parent": {
"a": 2,
@ -129,7 +129,7 @@ other_values:
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"values": [
"Will be",
@ -154,7 +154,7 @@ description: >
#### ↓ 等效的 JSON
```json {.wrap}
```json
{"description": "hello world\n"}
```

View File

@ -33,7 +33,10 @@ export async function createHTML(files = [], num = 0) {
isHome: /README.md$/.test(path.relative(process.cwd(), dataFile.path)),
githubURL,
homePath: path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'index.html')),
css: [path.relative(path.dirname(outputHTMLPath), CSS_OUTPUT_PATH)],
css: [
path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'style/style.css')),
path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'style/katex.css')),
],
});
await fs.writeFile(outputHTMLPath, html);
console.log(`♻️ \x1b[32;1m ${path.relative(OUTOUT, outputHTMLPath)} \x1b[0m`);
@ -44,7 +47,8 @@ export async function run() {
await fs.ensureDir(OUTOUT);
await fs.emptyDir(OUTOUT);
await fs.ensureDir(path.dirname(CSS_OUTPUT_PATH));
await fs.copyFile(CSSPATH, CSS_OUTPUT_PATH);
await fs.copy(path.resolve(process.cwd(), 'scripts/style'), path.resolve(OUTOUT, 'style'));
// await fs.copyFile(CSSPATH, CSS_OUTPUT_PATH);
const files = await recursiveReaddirFiles(process.cwd(), {
ignored: /\/(node_modules|\.git)/,
exclude: /(\.json|\.mjs|CONTRIBUTING\.md)$/,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1086
scripts/style/katex.css Normal file

File diff suppressed because it is too large Load Diff