Skip to content

Commit

Permalink
add plugin for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wenerme committed Apr 11, 2024
1 parent f144349 commit d827056
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 65 deletions.
157 changes: 95 additions & 62 deletions notes/languages/markdown/markdown-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ tags:

# Markdown 语法参考


## 基本语法

* 块元素
* 段落和换行
* 标题
* 引用
* 列表
* 代码块
* 分隔线
* Span 元素
* 链接
* 强调
* 代码
* 图片
* 杂项
* 转义
* 自动链接
- 块元素
- 段落和换行
- 标题
- 引用
- 列表
- 代码块
- 分隔线
- Span 元素
- 链接
- 强调
- 代码
- 图片
- 杂项
- 转义
- 自动链接

### 段落和换行

原始 Markdown 中通过在换行结尾添加两个空格来表示换行, 但因为这样不好辨识,建议使用`<br>`来强制换行. Github 流的 Markdown 会将段落中的换行当做真实换行. 通过在两行之间添加一个空行来表示段落.

```
Expand All @@ -39,6 +39,7 @@ tags:
```

### 标题

```
# 一级标题
## 二级标题
Expand All @@ -55,18 +56,23 @@ tags:
```

### 引用

```
> 这是一级引用
>> 这是二级引用
>>> 这是三级引用
```

> 这是一级引用
>> 这是二级引用
>>> 这是三级引用
>
> > 这是二级引用
> >
> > > 这是三级引用
### 列表

列表分为有序列表和无序列表, 列表可嵌套使用.

```
* 无序列表
1. 有序列表
Expand All @@ -87,24 +93,22 @@ tags:
2. 有序列表
```

* 无序列表
1. 有序列表
换行书写更多的内容
* 无序列表
1. 有序列表
* 无序列表
- 无序列表
1. 有序列表
换行书写更多的内容
- 无序列表
1. 有序列表
- 无序列表

----
---

0. 有序列表
1. 有序列表
0. 序号会自动增加
1. 序号无法修改
* 无序列表
3. 有序列表
* 无序列表
2. 有序列表

1. 有序列表
1. 序号会自动增加
2. 序号无法修改
- 无序列表 3. 有序列表
- 无序列表
3. 有序列表

### 代码块

Expand All @@ -123,19 +127,22 @@ class Obj{
```

### 分隔线

```
这是
---
分隔线
```

这是

---
分隔线

分隔线

### 链接

```
[显示的内容](链接的地址)
[显示的内容][定义的链接名]
Expand All @@ -149,8 +156,7 @@ class Obj{
[Wener](https://github.com/wenerme)
[Wenerme][网站地址]

[网站地址]: https://github.com/wenerme

[网站地址]: https://github.com/wenerme

### 强调

Expand All @@ -159,10 +165,11 @@ class Obj{
可*互*换**使**用.
```

中_二_病____.
******.
****使**用.

### 代码

用于在段落中引用代码

```
Expand All @@ -172,6 +179,7 @@ class Obj{
在命令行输入 `echo Hello world` 会看到 `Hello world`

### 图片

```
![图片描述](图片地址)
![图片描述][定义的链接名]
Expand All @@ -188,56 +196,61 @@ class Obj{

![我的头像][头像地址]

[头像地址]: https://avatars1.githubusercontent.com/u/1777211?v=3&s=40
[头像地址]: https://avatars1.githubusercontent.com/u/1777211?v=3&s=40

<!-- 可点击打开网页的图片 -->

[![我的头像][头像地址]](https://github.com/wenerme)

### 转义

```
这个是星号 *\**
HTML 转义的单引号 &#96;
```
这个是星号 *\**

这个是星号 \*\*\*
HTML 转义的单引号 &#96;

### 自动连接

所有的连接都会转换为可点击的连接

```
http://github.com/wenerme
```
http://github.com/wenerme

## 扩展语法

* 表格
* 指定代码块语法
* 注解
* Stackedit 支持
* 数学表达式
* Stackedit 支持
* Gitbook 可通过插件支持
* 定义标签 ID
* 数据定义
* Stackedit 支持
* 目录
* Stackedit 支持
* Github 引用
http://github.com/wenerme

## 扩展语法 {#extended}

- 表格
- 指定代码块语法
- 注解
- Stackedit 支持
- 数学表达式
- Stackedit 支持
- Gitbook 可通过插件支持
- 定义标签 ID
- 数据定义
- Stackedit 支持
- 目录
- Stackedit 支持
- Github 引用

### 表格

```
列|列|左对齐列|右对齐列|居中对齐列
----|----|:----|----:|:----:
行|行|行|行|行
行|行|行|行<br/>换行|行<br/>换行<br/>换行
```

列|列|左对齐列|右对齐列|居中对齐列
----|----|:----|----:|:----:
行|行|行|行|行
行|行|行|行<br/>换行|行<br/>换行<br/>换行
||| 左对齐列 | 右对齐列 | 居中对齐列 |
| --- | --- | :------- | ----------: | :------------------: |
||||||
|||| 行<br/>换行 | 行<br/>换行<br/>换行 |

### 指定代码块语法

Expand Down Expand Up @@ -268,9 +281,8 @@ class Obj{

传统 SQL[^sql] 数据库均支持 ACID[^acid] 属性.

[^sql]: 结构化查询语言

[^acid]: 结构化查询语言
[^sql]: 结构化查询语言
[^acid]: 结构化查询语言

### 数学表达式

Expand Down Expand Up @@ -305,3 +317,24 @@ $$
| (1x3) | (2x2) | < | (2x2) | < |
| ^ | ^ | < | Cell | Cell |
| ^ | (3x1) | < | < | Cell |

## 脚注 {#footnote}

```md
这是一个脚注[^1]

[^1]: 这是一个脚注
```

## 缩写 {#abbr}

```md
_[HTML]: Hyper Text Markup Language
_[W3C]: World Wide Web Consortium
The HTML specification
is maintained by the W3C.
```

## 参考

- https://shd101wyy.github.io/markdown-preview-enhanced/
10 changes: 7 additions & 3 deletions site/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ const config = {
showLastUpdateTime: true,
showLastUpdateAuthor: true,

remarkPlugins: [math, deflist],
// https://katex.org/docs/options.html
rehypePlugins: [[katex, { strict: (code) => (code === 'unicodeTextInMathMode' ? 'ignore' : 'error') }]],
remarkPlugins: [math, deflist],
rehypePlugins: [
[rehypeExtendedTable, {}],
[katex, { strict: (code) => (code === 'unicodeTextInMathMode' ? 'ignore' : 'error') }],
],

sidebarItemsGenerator: async ({ defaultSidebarItemsGenerator, ...args }) => {
const items = await defaultSidebarItemsGenerator(args);
Expand Down Expand Up @@ -96,7 +99,8 @@ const config = {
truncateMarker: /<!--\s*more\s*-->/,
editUrl: 'https://github.com/wenerme/wener/edit/master/story/',

remarkPlugins: [math],
// https://katex.org/docs/options.html
remarkPlugins: [math, deflist],
rehypePlugins: [
[rehypeExtendedTable, {}],
[katex, { strict: (code) => (code === 'unicodeTextInMathMode' ? 'ignore' : 'error') }],
Expand Down

0 comments on commit d827056

Please sign in to comment.