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

style: 按中文文案排版指北规范行文, 为AutoCorrect插件补充nolint标记 #280

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
132 changes: 132 additions & 0 deletions .autocorrectrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# yaml-language-server: $schema=https://huacnlee.github.io/autocorrect/schema.json
rules:
# Default rules: https://github.com/huacnlee/autocorrect/raw/main/autocorrect/.autocorrectrc.default
spellcheck: 2
# Enable or disable in special context
context:
# Enable or disable to format codeblock in Markdown or AsciiDoc etc.
codeblock: 0
textRules:
# Config some special rule for some texts
# For example, if we wants to let "Hello你好" just warning, and "Hi你好" to ignore
# "Hello你好": 2
# "Hi你好": 0
"「QQ(onebot11反向WS)」": 0
"「QQ(onebot11正向WS)」": 0
"「onebot11反向WS」": 0
"「onebot11正向WS」": 0
"「Discord账号」": 0
"「Telegram账号」": 0
"「KOOK(开黑啦)账号」": 0
"「DoDo语音」": 0
"「反向WebSocket监听地址」": 0
fileTypes:
# Config the files associations, you config is higher priority than default.
# "rb": ruby
# "Rakefile": ruby
# "*.js": javascript
# ".mdx": markdown
spellcheck:
words:
# Please do not add a general English word (eg. apple, python) here.
# Users can add their special words to their .autocorrectrc file by their need.
- ActiveMQ
- AirPods
- Aliyun
- API
- App Store
- AppKit
- AppStore = App Store
- AWS
- CacheStorage
- CDN
- CentOS
- CloudFront
- CORS
- CPU
- DNS
- Elasticsearch
- ESLint
- Facebook
- GeForce
- GitHub
- Google
- GPU
- H5
- Hadoop
- HBase
- HDFS
- HKEX
- HTML
- HTTP
- HTTPS
- I10n
- I18n
- iMovie
- IndexedDB
- Intel
- iOS
- iPad
- iPadOS
- iPhone
- iTunes
- JavaScript
- jQuery
- JSON
- JWT
- Linux
- LocalStorage
- macOS
- Markdown
- Microsoft
- MongoDB
- Mozilla
- MVC
- MySQL
- Nasdaq
- Netflix
- NodeJS = Node.js
- NoSQL
- NVDIA
- NYSE
- OAuth
- Objective-C
- OLAP
- OSS
- P2P
- PaaS
- RabbitMQ
- Redis
- RESTful
- RSS
- RubyGem
- RubyGems
- SaaS
- Sass
- SDK
- Shopify
- SQL
- SQLite
- SQLServer
- SSL
- Tesla
- TikTok
- tvOS
- TypeScript
- Ubuntu
- UML
- URI
- URL
- VIM
- watchOS
- WebAssembly
- WebKit
- Webpack
- Wi-Fi
- Windows
- WWDC
- Xcode
- XML
- YAML
- YML
- YouTube
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v16
with:
globs: '**/*.md'
globs: "**/*.md"
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,37 @@ VitePress 驱动的海豹骰官方使用手册。

如需调整导航栏和侧边栏,则涉及到修改 `docs/.vitepress/theme.ts` 和 `docs/.vitepress/catalogue.ts` 中的配置。

## Lint
## 安装依赖

提交前请务必使用 markdownlint 进行检查,不满足格式要求的修改无法合并入主仓库
编写文档原则上不需要安装任何依赖。但是,如果希望利用 linter 自检或本地运行预览效果,则需要执行以下指令安装依赖

```shell
pnpm install
```

## MarkDown 格式规范

提交前请务必使用 markdownlint 进行检查,不满足格式要求的修改无法合并入主仓库。

```shell
pnpm run lint:md
pnpm run lint:md:fix // 检查并进行部分自动修复
pnpm run lint:md:fix # 检查并进行部分自动修复
```

对于 VS Code 用户,请使用 [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) 插件获取编辑器警告。这一插件已经被添加到本项目的推荐插件中,只需在打开本项目时按 VS Code 的提示安装即可。

## 排版
## 排版规范

文档排版应当遵循 [中文文案排版指北](https://github.com/sparanoid/chinese-copywriting-guidelines) 的规范。

使用 AutoCorrect 插件可以提供相关帮助。
项目集成了自动检查和修复插件,可以通过以下指令调用。

```shell
pnpm run lint:autocorrect
pnpm run lint:autocorrect:fix # 检查并进行部分自动修复
```

使用 AutoCorrect 插件可以提供编辑器集成的提示,但确有观察到编辑器插件不识别配置文件造成假阳性报告的问题。

- [VS Code](https://marketplace.visualstudio.com/items?itemName=huacnlee.autocorrect)
- [JetBrains](https://plugins.jetbrains.com/plugin/20244-autocorrect)
Expand Down
6 changes: 3 additions & 3 deletions docs/about/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ title: 参与项目

你的修改完成后,在你 fork 的新仓库向主仓库发起 Pull Request:

![创建PR](./images/develop-pr-1.png)
![创建 PR](./images/develop-pr-1.png)

提交时间很近的时候,GitHub 会提示快捷发起 PR 的操作按钮:

![快速创建PR](./images/develop-pr-2.png)
![快速创建 PR](./images/develop-pr-2.png)

进入 PR 编辑页填写信息,请确认是从你的仓库的新分支,提向主仓库的主分支的:

`主仓库 主分支 <- fork仓库 功能分支`

![填写PR信息](./images/develop-open-pr-1.png)
![填写 PR 信息](./images/develop-open-pr-1.png)

填写完成后,等待开发组进行 review,有时会给你提出一些修改建议。在你的 PR review 通过并合并后,功能分支就可以被删除了。

Expand Down
3 changes: 1 addition & 2 deletions docs/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ index: false
- [编写牌堆](./edit_deck.md)
- [编写帮助文档](./edit_helpdoc.md)
- [编写敏感词库](./edit_sensitive_words.md)
- Javascript 插件
- JavaScript 插件
- [前言](./js_start.md)
- [插件的工程化编写](./js_project.md)
- [常见用法示例](./js_example.md)
- [编写新的 TRPG 规则](./js_gamesystem.md)
- [API 列表](./js_api_list.md)

10 changes: 7 additions & 3 deletions docs/advanced/edit_complex_custom_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ $t计算结果 == 1 ? " 啧!"

::: info 示例

<!-- autocorrect-disable -->
<ChatBox :messages="[
{content: '.r', send: true},
{content: '<木落>掷出了 D100=1 啧!'},
{content: '.r', send: true},
{content: '<木落>掷出了 D100=100 乐!'},
]" />
<!-- autocorrect-enable -->

:::

Expand All @@ -53,9 +55,9 @@ $t计算结果 == 1 ? " 啧!"
```text
{%
if $t1==""||$t1==" 默认" {$g文案模式 = 0; $t输出="默认模式启用"};
if $t1==" 模式1" {$g文案模式 = 1; $t输出="模式1启用"};
if $t1==" 模式1" {$g文案模式 = 1; $t输出="模式1启用"};
if $t1==" 模式2" {$g文案模式 = 2; $t输出="模式2启用"};
if $t1!=""&&$t1!=" 默认"&&$t1!=" 模式1"&&$t1!=" 模式2" {$t输出=`不存在指定模式{$t1}`};
if $t1!=""&&$t1!=" 默认"&&$t1!=" 模式1"&&$t1!=" 模式2" {$t输出=`不存在指定模式{$t1}`};
$t输出
%}
```
Expand All @@ -64,7 +66,7 @@ $t输出
回复:

```text
{%
{%
$g文案模式==0 ? "当前在默认模式",
$g文案模式==1 ? "当前在模式1" ,
$g文案模式==2 ? "当前在模式2"
Expand All @@ -89,6 +91,7 @@ if $g文案模式 == 2 {$t目标文案 = `(这里填你个性化的模式2文

::: info 示例

<!-- autocorrect-disable -->
<ChatBox :messages="[
{content: 'mode show', send: true},
{content: '默认模式启用'},
Expand All @@ -107,5 +110,6 @@ if $g文案模式 == 2 {$t目标文案 = `(这里填你个性化的模式2文
{content: '.jrrp', send: true},
{content: '(这里填你个性化的默认模式文案)'},
]" />
<!-- autocorrect-enable -->

:::
Loading