Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: 升级到 Docusaurus V3 #2956

Merged
merged 40 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e9f708e
:arrow_up: bump dependencies
StarHeartHunt Sep 15, 2024
b78a4b8
:memo: :recycle: bump to docusaurus v3
StarHeartHunt Sep 15, 2024
2297e86
:wrench: update typescript config
StarHeartHunt Sep 15, 2024
f64fd63
:memo: fix mdx v3 warnings
StarHeartHunt Sep 15, 2024
6125d68
:memo: fix warning of [https://github.com/facebook/docusaurus/pull/93…
StarHeartHunt Sep 15, 2024
a9e1d5e
:memo: try fixing mdx parse
StarHeartHunt Sep 15, 2024
8db6b6d
:memo: enable mdx1 explicit headingId compat
StarHeartHunt Sep 15, 2024
0350a14
:memo: fix mdx v3 compat
StarHeartHunt Sep 16, 2024
bb64a85
:memo: :recycle: changelog split
StarHeartHunt Sep 16, 2024
212cbf1
:bug: fix changelog path
StarHeartHunt Sep 16, 2024
4343d9b
:see_no_evil: add gitignore
StarHeartHunt Sep 16, 2024
63b6f7a
:memo: :bug: fix foreground color
StarHeartHunt Sep 16, 2024
c99abc8
:arrow_up: bump dependencies
StarHeartHunt Sep 16, 2024
5ad96d4
:memo: add frontmatter to use md
StarHeartHunt Sep 16, 2024
f7028a7
:bug: add missing typography plugin config
StarHeartHunt Sep 16, 2024
ec0a578
:arrow_up: bump dependencies
StarHeartHunt Sep 18, 2024
e76a7aa
:arrow_up: bump dependencies
StarHeartHunt Sep 18, 2024
aeaecf5
:memo: fix links format
StarHeartHunt Sep 18, 2024
ee203c1
:memo: fix link format
StarHeartHunt Sep 18, 2024
745b742
:arrow_up: bump dependencies
StarHeartHunt Sep 22, 2024
328889a
:memo: :bug: fix store sidebar
StarHeartHunt Oct 8, 2024
72e1d72
:arrow_up: bump dependencies
StarHeartHunt Oct 8, 2024
efaa469
:arrow_up: bump dependencies
StarHeartHunt Oct 13, 2024
9be2182
:arrow_up: bump dependencies
StarHeartHunt Oct 13, 2024
f044c6a
:sparkles: changelog sidebar
StarHeartHunt Oct 13, 2024
658db75
:memo: fix admonition usage
StarHeartHunt Oct 13, 2024
6ef4054
:memo: fix broken links
StarHeartHunt Oct 13, 2024
de58069
:memo: fix funding link
StarHeartHunt Oct 13, 2024
379f536
:building_construction: tidy folder structure
StarHeartHunt Oct 13, 2024
fcd6902
:bug: disable default media query dark theme
StarHeartHunt Oct 15, 2024
583ce42
:arrow_up: bump dependencies
StarHeartHunt Oct 15, 2024
3105552
:bug: disable daisyui base inject
StarHeartHunt Oct 15, 2024
f8117d2
:arrow_up: bump dependencies
StarHeartHunt Oct 19, 2024
5e45c44
:see_no_evil: move changelog to pages
StarHeartHunt Oct 19, 2024
7a198b8
chore(deps): bump dependencies
StarHeartHunt Oct 19, 2024
72ed746
:bug: update config due to upstream change
StarHeartHunt Oct 19, 2024
c1e238c
:wrench: add changelog sidebar config
StarHeartHunt Oct 19, 2024
3f82b87
:art: reformat
StarHeartHunt Oct 19, 2024
8d965a9
:wrench: update default version sidebar config
StarHeartHunt Oct 21, 2024
91ffc88
:memo: update links
StarHeartHunt Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Update Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master
with:
changelog_file: website/src/pages/changelog.md
changelog_file: website/src/changelog/changelog.md
latest_changes_position: '# 更新日志\n\n'
latest_changes_title: "## 最近更新"
replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Archive Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master
with:
changelog_file: website/src/pages/changelog.md
changelog_file: website/src/changelog/changelog.md
archive_regex: '(?<=## )最近更新(?=\n)'
archive_title: ${{ env.TAG_NAME }}
commit_and_push: false
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ docs_build/_build
!tests/.env
.docusaurus
website/docs/api/**/*.md
website/src/pages/changelog/**/*

# Created by https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,visualstudiocode,jetbrains,macos,windows,linux
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

See [changelog.md](./website/src/pages/changelog.md) or <https://nonebot.dev/changelog>
See [changelog.md](./website/src/changelog/changelog.md) or <https://nonebot.dev/changelog>
2 changes: 2 additions & 0 deletions nonebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
- `require` => {ref}``require` <nonebot.plugin.load.require>`

FrontMatter:
mdx:
format: md
sidebar_position: 0
description: nonebot 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
使用 {ref}`nonebot.drivers.Driver.register_adapter` 注册适配器。

FrontMatter:
mdx:
format: md
sidebar_position: 0
description: nonebot.adapters 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
为兼容 Pydantic V1 与 V2 版本,定义了一系列兼容函数与类供使用。

FrontMatter:
mdx:
format: md
sidebar_position: 16
description: nonebot.compat 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
详情见 [`pydantic Field Type`](https://pydantic-docs.helpmanual.io/usage/types/) 文档。

FrontMatter:
mdx:
format: md
sidebar_position: 1
description: nonebot.config 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/consts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块包含了 NoneBot 事件处理过程中使用到的常量。

FrontMatter:
mdx:
format: md
sidebar_position: 9
description: nonebot.consts 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/dependencies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块模块实现了依赖注入的定义与处理。

FrontMatter:
mdx:
format: md
sidebar_position: 0
description: nonebot.dependencies 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/dependencies/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""
FrontMatter:
mdx:
format: md
sidebar_position: 1
description: nonebot.dependencies.utils 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
各驱动请继承以下基类。

FrontMatter:
mdx:
format: md
sidebar_position: 0
description: nonebot.drivers 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 2
description: nonebot.drivers.aiohttp 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 1
description: nonebot.drivers.fastapi 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 3
description: nonebot.drivers.httpx 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/none.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 6
description: nonebot.drivers.none 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 5
description: nonebot.drivers.quart 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/drivers/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:::

FrontMatter:
mdx:
format: md
sidebar_position: 4
description: nonebot.drivers.websockets 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
```

FrontMatter:
mdx:
format: md
sidebar_position: 10
description: nonebot.exception 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
[loguru]: https://github.com/Delgan/loguru

FrontMatter:
mdx:
format: md
sidebar_position: 7
description: nonebot.log 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/matcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块实现事件响应器的创建与运行,并提供一些快捷方法来帮助用户更好的与机器人进行对话。

FrontMatter:
mdx:
format: md
sidebar_position: 3
description: nonebot.matcher 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供了多个插槽以进行事件的预处理等。

FrontMatter:
mdx:
format: md
sidebar_position: 2
description: nonebot.message 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/params.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块定义了依赖注入的各类参数。

FrontMatter:
mdx:
format: md
sidebar_position: 4
description: nonebot.params 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
只要有一个 `PermissionChecker` 检查结果为 `True` 时就会继续运行。

FrontMatter:
mdx:
format: md
sidebar_position: 6
description: nonebot.permission 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
- `PluginMetadata` => {ref}``PluginMetadata` <nonebot.plugin.model.PluginMetadata>`

FrontMatter:
mdx:
format: md
sidebar_position: 0
description: nonebot.plugin 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/plugin/load.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块定义插件加载接口。

FrontMatter:
mdx:
format: md
sidebar_position: 1
description: nonebot.plugin.load 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/plugin/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
参考: [import hooks](https://docs.python.org/3/reference/import.html#import-hooks), [PEP302](https://www.python.org/dev/peps/pep-0302/)

FrontMatter:
mdx:
format: md
sidebar_position: 5
description: nonebot.plugin.manager 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/plugin/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块定义插件相关信息。

FrontMatter:
mdx:
format: md
sidebar_position: 3
description: nonebot.plugin.model 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/plugin/on.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块定义事件响应器便携定义函数。

FrontMatter:
mdx:
format: md
sidebar_position: 2
description: nonebot.plugin.on 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
只有当所有 `RuleChecker` 检查结果为 `True` 时继续运行。

FrontMatter:
mdx:
format: md
sidebar_position: 5
description: nonebot.rule 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[`typing`](https://docs.python.org/3/library/typing.html)。

FrontMatter:
mdx:
format: md
sidebar_position: 11
description: nonebot.typing 模块
"""
Expand Down
2 changes: 2 additions & 0 deletions nonebot/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""本模块包含了 NoneBot 的一些工具函数

FrontMatter:
mdx:
format: md
sidebar_position: 8
description: nonebot.utils 模块
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include = ["nonebot/py.typed"]
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/nonebot/nonebot2/issues"
"Changelog" = "https://nonebot.dev/changelog"
"Funding" = "https://afdian.net/@nonebot"
"Funding" = "https://afdian.com/@nonebot"

[tool.poetry.dependencies]
python = "^3.9"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/appendices/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ COMMON_CONFIG=common config # 这个配置项在任何环境中都会被加载
在生产环境中,可以通过设置环境变量 `ENVIRONMENT=prod` 来确保 NoneBot 读取正确的环境配置。
:::

#### .env.{ENVIRONMENT} 文件
#### .env.\{ENVIRONMENT\} 文件

`.env.{ENVIRONMENT}` 文件类似于预设,可以让我们在多套不同的配置方案中灵活切换,默认 NoneBot 会读取 `.env.prod` 配置。如果你使用了 `nb-cli` 创建 `simple` 项目,那么将含有两套预设配置:`.env.dev` 和 `.env.prod`。

Expand Down
14 changes: 7 additions & 7 deletions website/docs/best-practice/alconna/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ alc = Alconna(".rd{roll:int}")
assert alc.parse(".rd123").header["roll"] == 123
```

Bracket Header 类似 python 里的 f-string 写法,通过 "{}" 声明匹配类型
Bracket Header 类似 python 里的 f-string 写法,通过 `"{}"` 声明匹配类型

"{}" 中的内容为 "name:type or pat":
`"{}"` 中的内容为 "name:type or pat":

- "{}", "{:}" ⇔ "(.+)", 占位符
- "{foo}" ⇔ "(?P&lt;foo&gt;.+)"
- "{:\d+}" ⇔ "(\d+)"
- "{foo:int}" ⇔ "(?P&lt;foo&gt;\d+)",其中 "int" 部分若能转为 `BasePattern` 则读取里面的表达式
- `"{}"`, `"{:}"``"(.+)"`, 占位符
- `"{foo}"``"(?P&lt;foo&gt;.+)"`
- `"{:\d+}"``"(\d+)"`
- `"{foo:int}"``"(?P&lt;foo&gt;\d+)"`,其中 `"int"` 部分若能转为 `BasePattern` 则读取里面的表达式

## 参数声明(Args)

Expand Down Expand Up @@ -321,7 +321,7 @@ opt2 = Option("--foo", default=OptionResult(value=False, args={"bar": 1}))
- `keep_crlf`: 命令解析时是否保留换行字符
- `compact`: 命令是否允许第一个参数紧随头部
- `strict`: 命令是否严格匹配,若为 False 则未知参数将作为名为 $extra 的参数
- `context_style`: 命令上下文插值的风格,None 为关闭,bracket 为 {...},parentheses 为 $(...)
- `context_style`: 命令上下文插值的风格,None 为关闭,bracket 为 `{...}`,parentheses 为 `$(...)`
- `extra`: 命令的自定义额外信息

元数据一定使用 `meta=...` 形式传入:
Expand Down
6 changes: 3 additions & 3 deletions website/docs/best-practice/alconna/uniseg.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Other(Segment):

```

:::tips
:::tip

或许你注意到了 `Segment` 上有一个 `children` 属性。

Expand Down Expand Up @@ -291,7 +291,7 @@ msg.extend([Text("text")])

这里额外说明 `UniMessage.template` 的拓展控制符

相比 `Message`,UniMessage 对于 {:XXX} 做了另一类拓展。其能够识别例如 At(xxx, yyy) 或 Emoji(aaa, bbb)的字符串并执行
相比 `Message`,UniMessage 对于 `{:XXX}` 做了另一类拓展。其能够识别例如 At(xxx, yyy) 或 Emoji(aaa, bbb)的字符串并执行

以 At(...) 为例:

Expand All @@ -305,7 +305,7 @@ UniMessage(At("user", "123"))
UniMessage(At("user", "123"))
```

而在 `AlconnaMatcher` 中,{:XXX} 更进一步地提供了获取 `event` 和 `bot` 中的属性的功能:
而在 `AlconnaMatcher` 中,`{:XXX}` 更进一步地提供了获取 `event` 和 `bot` 中的属性的功能:

```python title=在AlconnaMatcher中使用通用消息段的拓展控制符
from arclet.alconna import Alconna, Args
Expand Down
4 changes: 3 additions & 1 deletion website/docs/ospp/2021.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
sidebar_position: 0
description: 开源软件供应链点亮计划 - 暑期 2021
mdx:
format: md
---

# 暑期 2021

**开源软件供应链点亮计划 - 暑期 2021** 是**中国科学院软件研究所**与 **openEuler 社区**共同举办的一项面向高校学生的暑期活动,旨在鼓励在校学生积极参与开源软件的开发维护,促进优秀开源软件社区的蓬勃发展。关于具体的活动规划、报名方式,请查看该活动的 [官网](https://summer.iscas.ac.cn/) 和 [帮助文档](https://summer.iscas.ac.cn/help/)。

NoneBot 社区有幸作为开源社区参与了本次活动,下面列出了目前我们已经发布的项目,欢迎感兴趣的同学在上面给出的活动官网报名,或通过 <contact@nonebot.dev> 联系我们。
NoneBot 社区有幸作为开源社区参与了本次活动,下面列出了目前我们已经发布的项目,欢迎感兴趣的同学在上面给出的活动官网报名,或通过 [contact@nonebot.dev](mailto:contact@nonebot.dev) 联系我们。

## NoneBot v1

Expand Down
4 changes: 3 additions & 1 deletion website/docs/ospp/2022.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
sidebar_position: 1
description: 开源之夏 - 暑期 2022
mdx:
format: md
---

# 暑期 2022

**开源之夏 - 暑期 2022** 是由**开源软件供应链点亮计划**发起、由**中国科学院软件研究所**与 **openEuler 社区**主办的一项面向高校学生的暑期活动,类似 Google Summer of Code(GSoC),旨在鼓励在校学生积极参与开源软件的开发维护,促进优秀开源软件社区的蓬勃发展。关于具体的活动规划、报名方式,请查看该活动的 [官网](https://summer-ospp.ac.cn/) 和 [帮助文档](https://summer-ospp.ac.cn/help/)。

NoneBot 社区有幸作为开源社区 [参与](https://summer-ospp.ac.cn/#/org/orgdetail/e1fb5b8d-125a-4138-b756-25bd32c0a31a/) 了本次活动,下面列出了目前我们已经发布的项目,欢迎感兴趣的同学加入 QQ 群 [737131827](https://jq.qq.com/?_wv=1027&k=PEgyGeEu) 或通过 <contact@nonebot.dev> 联系我们。
NoneBot 社区有幸作为开源社区 [参与](https://summer-ospp.ac.cn/#/org/orgdetail/e1fb5b8d-125a-4138-b756-25bd32c0a31a/) 了本次活动,下面列出了目前我们已经发布的项目,欢迎感兴趣的同学加入 QQ 群 [737131827](https://jq.qq.com/?_wv=1027&k=PEgyGeEu) 或通过 [contact@nonebot.dev](mailto:contact@nonebot.dev) 联系我们。

## NoneBot2 命令行 CLI 交互体验升级

Expand Down
Loading
Loading