2025-2-26-fixed
This commit is contained in:
80
themes/next/docs/zh-CN/ALGOLIA-SEARCH.md
Normal file
80
themes/next/docs/zh-CN/ALGOLIA-SEARCH.md
Normal file
@@ -0,0 +1,80 @@
|
||||
<h1 align="center">Algolia 搜索</h1>
|
||||
|
||||
NexT 内部提供 Algolia 的搜索功能,要使用此功能请确保所使用的 NexT 版本在 `v5.1.0` 之后。需要注意的是,仅仅将 `next/_config.yml` 中 `algolia_search` 的 `enable` 打开**并不能让你使用 Algolia 搜索**,你还需要**使用对应的 Hexo-Algolia 插件** 才能真正在博客页面中使用 Algolia 搜索。按照下面介绍的步骤操作即可完成 Algolia 搜索的安装。
|
||||
|
||||
1. 前往 [Algolia 注册页面](https://www.algolia.com/),注册一个新账户。 可以使用 GitHub 或者 Google 账户直接登录,注册后的 14 天内拥有所有功能(包括收费类别的)。之后若未续费会自动降级为免费账户,免费账户 总共有 10,000 条记录,每月有 100,000 的可以操作数。注册完成后,创建一个新的 Index,这个 Index 将在后面使用。
|
||||
|
||||

|
||||
|
||||
1. 在 `API Keys` 页面找到需要使用的一些配置的值,包括 `Application ID` 和 `Search-Only API Key`。注意,`Admin API Key` 需要保密保存,不要外泄。
|
||||
|
||||

|
||||
|
||||
1. 编辑 `站点配置文件`,新增以下配置,除了 `chunkSize` 字段,替换成在 Algolia 获取到的值:
|
||||
|
||||
```yml
|
||||
algolia:
|
||||
applicationID: 'Application ID'
|
||||
apiKey: 'Search-Only API Key'
|
||||
indexName: 'indexName'
|
||||
chunkSize: 5000
|
||||
```
|
||||
|
||||
1. 在 `API Keys` 页面,点击 `All API Keys` 切换到对应的页面中。接着点击 `New API Key` 按钮,来**编辑权限**。在弹出框中找到 ACL ,**输入 addObject、 deleteObject、listIndexes、deleteIndex 权限**,然后点击最下方的 `Create` 按钮。将这个新创建的 API Key 复制到剪贴板,我们称之为 `High-privilege API key`。
|
||||
|
||||

|
||||

|
||||
|
||||
1. 在 Index 和 API Key 创建完成后,此时这个 Index 里未包含任何数据。接下来需要安装 [Hexo Algolia](https://github.com/oncletom/hexo-algolia) 扩展,这个扩展的功能是搜集站点的内容并通过 API 发送给 Algolia。前往站点根目录,执行命令安装:
|
||||
|
||||
```
|
||||
$ cd hexo
|
||||
$ npm install hexo-algolia
|
||||
```
|
||||
|
||||
1. 当配置完成,在站点根目录下执行以下命令来更新上传 Index。请注意观察命令的输出。
|
||||
|
||||
```
|
||||
$ export HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Git Bash
|
||||
# set HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Windows CMD 命令行
|
||||
$ hexo clean
|
||||
$ hexo algolia
|
||||
```
|
||||
|
||||

|
||||
|
||||
1. 更改`主题配置文件`,找到 Algolia Search 配置部分,将 `enable` 改为 `true`。同时你需要**关闭**其他搜索插件,如 Local Search 等。你也可以根据需要调整 `labels` 中的文本:
|
||||
|
||||
```yml
|
||||
# Algolia Search
|
||||
algolia_search:
|
||||
enable: true
|
||||
hits:
|
||||
per_page: 10
|
||||
labels:
|
||||
input_placeholder: Search for Posts
|
||||
hits_empty: "We didn't find any results for the search: ${query}"
|
||||
hits_stats: "${hits} results found in ${time} ms"
|
||||
```
|
||||
|
||||
1. 如果你需要通过 CDN 使用其它版本的 algolia-instant-search ,请根据以下步骤操作。
|
||||
|
||||
你需要在`主题配置文件`中的 vendors 字段进行设置:
|
||||
|
||||
```yml
|
||||
vendors:
|
||||
...
|
||||
# Algolia Search
|
||||
# algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
|
||||
# instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
|
||||
algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
|
||||
instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
|
||||
...
|
||||
```
|
||||
|
||||
<h2 align="center">已知的问题</h2>
|
||||
|
||||
1. 考虑到 Algolia 免费账户的限制,目前 [Hexo-Algolia](https://github.com/oncletom/hexo-algolia) 插件最新版本去掉了正文索引功能。
|
||||
1. [Hexo-Algoliasearch](https://github.com/LouisBarranqueiro/hexo-algoliasearch) 插件提供了正文索引功能,不过需要替换 NEXT 主题中的关键字。对于免费账户,`Record Too Big` 的问题同样存在。
|
||||
- 替换 `source/js/algolia-search.js` 中所有的 `applicationID` 为 `appId`
|
||||
- 替换 `layout/_partials/head/head.swig` 中所有的 `applicationID` 为 `appId`
|
||||
95
themes/next/docs/zh-CN/CODE_OF_CONDUCT.md
Normal file
95
themes/next/docs/zh-CN/CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,95 @@
|
||||
<div align="right">
|
||||
语言:
|
||||
<a title="英语" href="../../.github/CODE_OF_CONDUCT.md">:us:</a>
|
||||
:cn:
|
||||
<a title="俄语" href="../ru/CODE_OF_CONDUCT.md">:ru:</a>
|
||||
</div>
|
||||
|
||||
# <div align="center"><a title="Go to homepage" href="https://theme-next.org"><img align="center" width="56" height="56" src="https://raw.githubusercontent.com/theme-next/hexo-theme-next/master/source/images/logo.svg?sanitize=true"></a> e x T</div>
|
||||
|
||||
[NexT](https://theme-next.org) 是一个优雅而强大的 [Hexo](https://hexo.io/)主题。在这里,您可以构建一个托管在 [GitHub Pages](https://pages.github.com/) 上的静态博客,分享您的生活,并与新朋友进行交流。
|
||||
|
||||
参与者公约用来约束在 [NexT](https://github.com/theme-next/hexo-theme-next) 社区中代码更新、问题交流、请求合并等行为。我们期望所有用户相互尊重,礼貌待人。任何违反这些规则的人都将不会被审核,并会在发现后立即被阻止和驱逐。
|
||||
|
||||
## 目录
|
||||
|
||||
- [我们的保证](#我们的保证)
|
||||
- [我们的责任](#我们的责任)
|
||||
- [我们的标准](#我们的标准)
|
||||
- [使用范围](#使用范围)
|
||||
- [强制执行](#强制执行)
|
||||
- [联系项目维护者](#联系项目维护者)
|
||||
- [来源](#来源)
|
||||
|
||||
## 我们的保证
|
||||
|
||||
作为此项目的贡献者和维护者,我们承诺尊重所有做出贡献的用户,这些贡献包括了报告问题、发布功能请求、更新文档、提交合并请求以及其他活动。
|
||||
|
||||
为了促进一个开放透明且友好的环境,我们作为贡献者和维护者保证:无论年龄、种族、民族、性别认同和表达(方式)、体型、身体健全与否、经验水平、国籍、个人表现、宗教或性别取向,参与者在我们项目和社区中都免于骚扰。
|
||||
|
||||
## 我们的责任
|
||||
|
||||
项目维护者有责任为「可接受的行为」标准做出诠释,有权利及责任去删除、编辑、拒绝与本行为标准有所违背的评论(comments)、提交(commits)、代码、wiki 编辑、问题(issues)和其他贡献,以及项目维护者可暂时或永久性的禁止任何他们认为有不适当、威胁、冒犯、有害行为的贡献者。
|
||||
|
||||
## 我们的标准
|
||||
|
||||
作为 GitHub 上的一个项目,本项目受到 [GitHub 社区准则](https://help.github.com/articles/github-community-guidelines/)的约束。 此外,作为 npm 托管的项目,[npm 公司的行为准则](https://www.npmjs.com/policies/conduct)也涵盖了本项目。
|
||||
|
||||
有助于创造正面环境的行为包括但不限于:
|
||||
|
||||
* 使用友好和包容性语言
|
||||
* 尊重不同的观点和经历
|
||||
* 耐心地接受建设性批评
|
||||
* 关注对社区最有利的事情
|
||||
* 友善对待其他社区成员
|
||||
|
||||
身为参与者不能接受的行为包括但不限于:
|
||||
|
||||
* 使用与性有关的言语或是图像,以及不受欢迎的性骚扰
|
||||
* 捣乱/煽动/造谣的行为或进行侮辱/贬损的评论,人身攻击及政治攻击
|
||||
* 公开或私下的骚扰
|
||||
* 未经许可地发布他人的个人资料,例如住址或是电子地址
|
||||
* 其他可以被合理地认定为不恰当或者违反职业操守的行为
|
||||
|
||||
## 使用范围
|
||||
|
||||
当一个人代表该项目或是其社区时,本行为标准适用于其项目社区和公共社区。
|
||||
|
||||
根据某人在本社区范围以外发生的违规情况,项目维护者可以认为其不受欢迎,并采取适当措施来保证所有成员的安全性和舒适性。
|
||||
|
||||
## 强制执行
|
||||
|
||||
如果您看到违反行为准则的行为,请按以下步骤操作:
|
||||
|
||||
1. 让这个人知道他所做的并不合适,并要求他停止或编辑他们的提交信息。该人应立即停止行为并纠正问题。
|
||||
2. 如果该人没有纠正其行为,或者您不方便与其沟通,请[联系项目维护者](#联系项目维护者)。上报时,请尽可能多的提供详细信息,链接,截图,上下文或可用于更好地理解和解决情况的其他信息。
|
||||
3. 收到上报信息后,项目维护者会查看问题,并采取进一步的措施。
|
||||
|
||||
一旦项目维护者参与其中,他们将遵循以下一系列步骤,并尽力保护项目成员的利益。任何维护团队认为有必要且适合的所有投诉都将进行审查及调查,并做出相对应的回应。项目小组有对事件回报者有保密的义务。具体执行的方针近一步细节可能会单独公布。
|
||||
|
||||
以下是项目维护者根据需要采取的进一步执法步骤:
|
||||
|
||||
1. 再次要求停止违规行为。
|
||||
2. 如果违规者还是没有回应,将会受到正式的警告,并收到项目维护者的移除或修改消息。同时,相关的问题或合并请求将会被锁定。
|
||||
3. 如果警告后违规行为继续出现,违规者将会被禁言 24 小时。
|
||||
4. 如果禁言后违规行为继续出现,违规者将会被处罚长期(6-12个月)禁言。
|
||||
|
||||
除此之外,项目维护者可以根据需要删除任何违规的消息,图片,贡献等。如果违规行为被认为是对社区成员的严重或直接威胁,包括任何置社区成员于风险的威胁、身体或言语攻击,项目维护者有充分权利自行决定跳过上述任何步骤。
|
||||
|
||||
没有切实地遵守或是执行本行为标准的项目维护人员,可能会因项目领导人或是其他成员的决定,暂时或是永久地取消其参与资格。
|
||||
|
||||
## 联系项目维护者
|
||||
|
||||
您可以通过以下任何方法与维护人员联系
|
||||
|
||||
* 电子邮件:
|
||||
* [support@theme-next.org](mailto:support@theme-next.org)
|
||||
|
||||
* 即时通信:
|
||||
* [Gitter](https://gitter.im/theme-next)
|
||||
* [Riot](https://riot.im/app/#/room/#NexT:matrix.org)
|
||||
* [Telegram](https://t.me/joinchat/GUNHXA-vZkgSMuimL1VmMw)
|
||||
|
||||
## 来源
|
||||
|
||||
本行为标准改编自[Contributor Covenant](https://www.contributor-covenant.org/) 和 [WeAllJS Code of Conduct](https://wealljs.org/code-of-conduct)。
|
||||
196
themes/next/docs/zh-CN/CONTRIBUTING.md
Normal file
196
themes/next/docs/zh-CN/CONTRIBUTING.md
Normal file
@@ -0,0 +1,196 @@
|
||||
<div align="right">
|
||||
语言:
|
||||
<a title="英语" href="../../.github/CONTRIBUTING.md">:us:</a>
|
||||
:cn:
|
||||
<a title="俄语" href="../ru/CONTRIBUTING.md">:ru:</a>
|
||||
</div>
|
||||
|
||||
# <div align="center"><a title="Go to homepage" href="https://theme-next.org"><img align="center" width="56" height="56" src="https://raw.githubusercontent.com/theme-next/hexo-theme-next/master/source/images/logo.svg?sanitize=true"></a> e x T</div>
|
||||
|
||||
首先,非常感谢大家抽出宝贵时间来让我们的 NexT 主题越变越好。在这里,我们介绍一下 [NexT 主题及其子模块](https://github.com/theme-next) 的开源贡献指南。不过,我们希望大家不要局限于此,更欢迎大家随时进行补充。
|
||||
|
||||
## 目录
|
||||
|
||||
[如何为 NexT 做贡献](#如何为-next-做贡献)
|
||||
|
||||
* [你需要了解的](#你需要了解的)
|
||||
* [阅读文档](#阅读文档)
|
||||
* [快速调试指南](#快速调试指南)
|
||||
* [反馈 Bug](#反馈-bug)
|
||||
* [提交漏洞](#提交漏洞)
|
||||
* [提交功能需求](#提交功能需求)
|
||||
* [提交合并请求](#提交合并请求)
|
||||
* [发布版本](#发布版本)
|
||||
|
||||
[规范](#规范)
|
||||
|
||||
* [行为规范](#行为规范)
|
||||
* [编码规范](#编码规范)
|
||||
* [标签规范](#标签规范)
|
||||
* [提交信息规范](#提交信息规范)
|
||||
|
||||
## 如何为 NexT 做贡献
|
||||
|
||||
### 你需要了解的
|
||||
|
||||
#### 阅读文档
|
||||
|
||||
如果你在使用过程中遇到了问题,你可以查阅 [FAQs](https://theme-next.org/docs/faqs) 或者 [NexT 帮助文档](https://theme-next.org/docs/troubleshooting)。
|
||||
|
||||
另外,你也可以通过 [这里](https://github.com/theme-next/hexo-theme-next/search?q=&type=Issues&utf8=%E2%9C%93) 进行大致检索,有些问题已经得到解答,你可以自行解决。对于没有解决的 Issue,你也可以继续提问。
|
||||
|
||||
#### 快速调试指南
|
||||
|
||||
在 GitHub 上提交 Issue 前,请先通过以下方法 debug:
|
||||
|
||||
* 执行`hexo clean`,清除浏览器缓存,并禁用 CDN 服务(例如 Cloudflare Rocket Loader);
|
||||
* 切换到其它主题并检查 bug 是否仍然存在(例如使用默认主题 landscape)。换言之,证明这是 NexT 主题而非来自 Hexo 的 bug;
|
||||
* 将 NexT 主题升级到最新版;
|
||||
* 将 Hexo 和 Hexo 插件升级到最新版;
|
||||
* 将 Node.js 和 `npm` 升级到最新版;
|
||||
* 卸载不必要的 Hexo 插件,或重新通过 `npm install --save` 安装插件。
|
||||
|
||||
如果你得到了来自 Hexo 或浏览器控制台的报错信息,请在 Google / Stackoverflow / GitHub Issue 中搜寻,或在提交 Issue 时报告给我们。
|
||||
|
||||
如果你在使用过程中发现了 Bug,请再次确认 Bug 在 [最新发布版本](https://github.com/theme-next/hexo-theme-next/releases/latest) 中是否重现。如果 Bug 重现,欢迎你到我们的 [主题仓库](https://github.com/theme-next/hexo-theme-next) 中 [反馈 Bug](#reporting-bugs) 或者 [提交功能需求](#提交功能需求),也更期待您 [提交合并请求](#提交合并请求)。
|
||||
|
||||
### 反馈 Bug
|
||||
|
||||
反馈 Bug 前,请再次确认您已经查看了 [你需要了解的](#你需要了解的) 内容,避免提交重复的 Issue。确定相关仓库后,创建 Issue 并按照 [模板](../../.github/ISSUE_TEMPLATE.md) 尽可能的详细填写相关信息。
|
||||
|
||||
请认真遵守如下指南,这样我们才能更好地理解问题,重现问题和解决问题。
|
||||
|
||||
* 在标题中清晰准确地描述你的问题。
|
||||
* 参照如下问题尽可能多的提供信息:
|
||||
* Bug 是否能够重现?是一直出现还是偶尔出现?
|
||||
* Bug 是从什么时候开始发生的?
|
||||
* 如果 Bug 突然发生,使用 [旧版本主题](https://github.com/theme-next/hexo-theme-next/releases) 是否能够重现 Bug?又是从哪个版本开始出现 Bug?
|
||||
* 你所使用 Node,Hexo 以及 Next 的版本号多少?你可以运行 `node -v` 和 `hexo version` 获取版本号,或者查看文件 `package.json` 的内容。
|
||||
* 你使用了哪些插件包?查看文件 `package.json` 的内容即可获取。
|
||||
* 一步步详细你是如何重现 Bug 的,做了什么,使用了哪些功能等等。如果你需要展示代码段,请使用 [Markdown 代码块](https://help.github.com/articles/creating-and-highlighting-code-blocks/) 或 [Github 预览链接](https://help.github.com/articles/creating-a-permanent-link-to-a-code-snippet/) 或 [Gist 链接](https://gist.github.com/)。
|
||||
* 提供 Bug 的样例,如图像文件、在线演示网址等等。
|
||||
* 详细描述通过上述重现过程出现的问题。
|
||||
* 详细描述你期待的结果。
|
||||
|
||||
#### 提交漏洞
|
||||
|
||||
如果你发现安全问题,请以负责任的方式行事,即不要在公共 Issue 中提交而是直接向我们反馈,这样我们就可以在漏洞被利用之前对其进行修复。请将相关信息发送到 security@theme-next.com(可接受 PGP 加密邮件)。
|
||||
|
||||
我们很乐意对任何提交漏洞的人予以特别感谢以便我们修复它。如果你想保持匿名性或使用笔名替代,请告诉我们。我们将充分尊重你的意愿。
|
||||
|
||||
### 提交功能需求
|
||||
|
||||
提交功能需求前,请再次确认您已经查看了 [你需要了解的](#你需要了解的) 内容,避免提交重复的 Issue。确定相关仓库后,创建 Issue 并按照 [模板](../../.github/ISSUE_TEMPLATE.md) 尽可能的详细填写相关信息。
|
||||
|
||||
请认真遵守如下指南,这样我们才能更好地理解和开发功能需求:pencil::
|
||||
|
||||
* 在标题中清晰准确地描述你的功能需求。
|
||||
* 详细描述目前所具有的功能和你所期待的功能,并解释为什么需要该功能。
|
||||
* 提供功能需求的样例,如图像文件、在线演示网址等等。
|
||||
|
||||
### 提交合并请求
|
||||
|
||||
提交合并请求前,请再次确认您已经查看了 [你需要了解的](#你需要了解的) 内容,避免提交重复的合并请求。确定相关仓库后,创建合并请求。更多详细操作过程可以查看 [帮助文档](https://help.github.com/articles/creating-a-pull-request/)。
|
||||
|
||||
请认真遵守如下指南,这样我们才能更好地理解你的合并请求:
|
||||
|
||||
* 创建合并请求时,请遵守 [编码规范](#编码规范) 和 [提交信息规范](#提交信息规范)。
|
||||
* 在标题中清晰准确地描述你的合并请求,不要加入 Issue 编号。
|
||||
* 按照 [模板](../../.github/PULL_REQUEST_TEMPLATE.md) 尽可能的详细填写相关信息。
|
||||
* 合并请求需要在所有主题样式中测试通过,并提供所表现功能的样例,如图像文件、在线演示网址等等。
|
||||
|
||||
### 发布版本
|
||||
|
||||
版本发布是将项目发布给用户的一种很好的方式。
|
||||
|
||||
1. 进入 GitHub 项目主页,点击 **Releases** 和 **Draft a new release**。
|
||||
2. 输入你需要发布的版本号。版本控制是基于 [Git tags](https://git-scm.com/book/en/Git-Basics-Tagging) 工作的,建议按照 [About Major and Minor NexT versions](https://github.com/theme-next/hexo-theme-next/issues/187) 确定版本号。
|
||||
3. 确定你需要发布的分支。除非发布测试版本,通常情况下选择 `master` 分支。
|
||||
4. 输入发布版本的标题和说明。
|
||||
- 标题为版本号。
|
||||
- 所有内容更改的类型包括了 **Breaking Changes**, **Updates**, **Features** 和 **Bug Fixes**。在描述 Breaking Changes 时,使用二级标题分别陈述,描述其他类型时,使用项目列表陈述。
|
||||
- 使用被动语态,省略主语。
|
||||
- 所有的变化都需要记录在版本说明中。对于没有使用 PR 的更改,需要添加相应的 commit 编号。如果使用了 PR 进行合并修改,则直接添加相应的 PR 编号即可。
|
||||
5. 如果您希望随版本一起发布二进制文件(如编译的程序),请在上传二进制文件对话框中手动拖放或选择文件。
|
||||
6. 如果版本不稳定,请选择 **This is a pre-release**,以通知用户它尚未完全准备好。如果您准备公布您的版本,请点击 **Publish release**。否则,请单击 **Save draft** 以稍后处理。
|
||||
|
||||
## 规范
|
||||
|
||||
### 行为规范
|
||||
|
||||
为了保证本项目的顺利运作,所有参与人都需要遵守 [行为规范](CODE_OF_CONDUCT.md)。
|
||||
|
||||
### 编码规范
|
||||
|
||||
我们使用 ESLint 和 Stylint 来识别和报告 JavaScript 和 Stylus 中的模式,目的是使代码更加一致并避免错误。编码时应遵循这些规范。
|
||||
|
||||
### 标签规范
|
||||
|
||||
为了方便维护人员和用户能够快速找到他们想要查看的问题,我们使用“标签”功能对 Pull requests 和 Issues 进行分类。
|
||||
|
||||
如果您不确定某个标签的含义,或者不知道将哪些标签应用于 PR 或 issue,千万别错过这个。
|
||||
|
||||
Issue 的标签:
|
||||
|
||||
- 类型
|
||||
- `Bug`: 检测到需要进行确认的 Bug
|
||||
- `Feature Request`: 提出了新功能请求的 Issue
|
||||
- `Question`: 提出疑问的 Issue
|
||||
- `Meta`: 表明使用条款变更的 Issue
|
||||
- `Support`: 被标记为支持请求的 Issue
|
||||
- `Polls`: 发起投票的 Issue
|
||||
- 结果
|
||||
- `Duplicate`: 重复提及的 Issue
|
||||
- `Irrelevant`: 与 NexT 主题无关的 Issue
|
||||
- `Invalid`: 无法复现的 Issue
|
||||
- `Expected Behavior`: 与预期行为相符的 Issue
|
||||
- `Need More Info`: 需要更多信息的 Issue
|
||||
- `Verified`: 已经被确认的 Issue
|
||||
- `Solved`: 已经解决的 Issue
|
||||
- `Backlog`: 待解决的 Issue
|
||||
- `Stale`: 由于长期无人回应被封存的 Issue
|
||||
|
||||
Pull Request 的标签:
|
||||
|
||||
- `Breaking Change`: 产生重大变动的 Pull Request
|
||||
- `Bug Fix`: 修复相关 Bug 的 Pull Request
|
||||
- `New Feature`: 添加了新功能的 Pull Request
|
||||
- `Feature`: 为现有功能提供选项或加成的 Pull Request
|
||||
- `i18n`: 更新了翻译的 Pull Request
|
||||
- `Work in Progress`: 仍在进行改动和完善的 Pull Request
|
||||
- `Skip Release`: 无需在 Release Note 中展现的 Pull Request
|
||||
|
||||
两者兼有:
|
||||
|
||||
- `Roadmap`: 与 NexT 主题发展相关的 Issue 或者 Pull Request
|
||||
- `Help Wanted`: 需要帮助的 Issue 或者 Pull Request
|
||||
- `Discussion`: 需要进行讨论的 Issue 或者 Pull Request
|
||||
- `Improvement`: 需要改进的 Issue 或者改进了 NexT 主题的 Pull Request
|
||||
- `Performance`: 提出性能问题的 Issue 或者提高了 NexT 主题性能的 Pull Request
|
||||
- `Hexo`: 与 Hexo 和 Hexo 插件相关的 Issue 或者 Pull Request
|
||||
- `Template Engine`: 与模版引擎相关的 Issue 或者 Pull Request
|
||||
- `CSS`: 与 NexT 主题 CSS 文件相关的 Issue 或者 Pull Request
|
||||
- `Fonts`: 与 NexT 主题字体相关的 Issue 或者 Pull Request
|
||||
- `PJAX`: 与 PJAX 相关的 Issue 或者 Pull Request
|
||||
- `3rd Party Plugin`: 与第三方插件和服务相关的 Issue 或者 Pull Request
|
||||
- `Docs`: 与文档说明相关的 Issue 或者 Pull Request
|
||||
- `Configurations`: 与 NexT 主题设置相关的 Issue 或者 Pull Request
|
||||
|
||||
### 提交信息规范
|
||||
|
||||
我们对项目的 git 提交信息格式进行统一格式约定,每条提交信息由 `type`+`subject` 组成,这将提升项目日志的可读性。
|
||||
|
||||
- `type` 用于表述此次提交信息的意义,首写字母大写,包括但不局限于如下类型:
|
||||
* `Build`:基础构建系统或依赖库的变化
|
||||
* `Ci`:CI 构建系统及其脚本变化
|
||||
* `Docs`:文档内容变化
|
||||
* `Feat`:新功能
|
||||
* `Fix`:Bug 修复
|
||||
* `Perf`:性能优化
|
||||
* `Refactor`:重构(即不是新增功能,也不是修改 Bug 的代码变动)
|
||||
* `Style`:格式(不影响代码运行的变动)
|
||||
* `Revert`:代码回滚
|
||||
* `Release`:版本发布
|
||||
- `subject` 用于简要描述修改变更的内容,如 `Update code highlighting in readme.md`。
|
||||
* 句尾不要使用符号。
|
||||
* 使用现在时、祈使句语气。
|
||||
61
themes/next/docs/zh-CN/DATA-FILES.md
Normal file
61
themes/next/docs/zh-CN/DATA-FILES.md
Normal file
@@ -0,0 +1,61 @@
|
||||
<h1 align="center">数据文件</h1>
|
||||
|
||||
目前,通过 pull 或下载新的 release 版本来更新 NexT 主题的体验并不平滑。当用户使用 `git pull` 更新 NexT 主题时经常需要解决冲突问题,而在手动下载 release 版本时也经常需要手动合并配置。
|
||||
|
||||
现在来说,NexT 推荐用户存储部分配置在 Hexo 站点配置文件(`/_config.yml`),而另一部分在主题配置文件(`/themes/next/_config.yml`)。这一方式固然可用,但也有一些缺点:
|
||||
1. 配置项被分裂为两部分;
|
||||
2. 用户难以弄清何处存放配置选项。
|
||||
|
||||
为了解决这一问题,NexT 提供了以下两种方案。
|
||||
|
||||
<h2 align="center">选择 1:Hexo 方式</h2>
|
||||
|
||||
使用这一方式,你的全部配置都将置于 Hexo 站点配置文件(`/_config.yml`),并且不需要修改 `/themes/next/_config.yml`,或者创建什么其他的文件。但是所有用到的主题选项必须放置在 `theme_config` 后,并全部增加两个空格的缩进。
|
||||
|
||||
如果在新的 release 中新增了选项,那么你只需要从 `/themes/next/_config.yml` 中将他们复制到 `/_config.yml` 中并将它们的值设置为你想要的。
|
||||
|
||||
### 用法
|
||||
|
||||
1. 请确认不存在 `/source/_data/next.yml` 文件(如果已存在,请删除)
|
||||
2. 从主题的 `/themes/next/_config.yml` 文件中复制你需要的 NexT 配置项到 `/_config.yml` 中,然后\
|
||||
2.1. 所有这些配置项右移两个空格(在 Visual Studio Code 中:选中这些文字,<kbd>CTRL</kbd> + <kbd>]</kbd>)。\
|
||||
2.2. 在这些参数最上方添加一行 `theme_config:`。
|
||||
|
||||
### 相关链接
|
||||
|
||||
* [Hexo 配置](https://hexo.io/zh-cn/docs/configuration.html)
|
||||
* [Hexo Pull #757](https://github.com/hexojs/hexo/pull/757)
|
||||
|
||||
<h2 align="center">选择 2: NexT 方式</h2>
|
||||
|
||||
使用这一方式,你现在可以将你的全部配置置于同一位置(`/source/_data/next.yml`),并且不需要修改 `/themes/next/_config.yml`。
|
||||
但是可能无法让所有 Hexo 外部库都准确处理它们的附加选项(举个例子,`hexo-server` 模块只会从 Hexo 默认配置文件中读取选项)。
|
||||
|
||||
如果在新的 release 中出现了任何新的选项,那么你只需要从 `/themes/next/_config.yml` 中将他们复制到 `/source/_data/next.yml` 中并设置它们的值为你想要的选项。
|
||||
|
||||
这一方法依赖于 Hexo 的[数据文件](https://hexo.io/docs/data-files.html)特性。因为数据文件是在 Hexo 3 中被引入,所以你需要更新至 Hexo 3.0 以后的版本来使用这一特性。
|
||||
|
||||
### 用法
|
||||
|
||||
1. 请确认你的 Hexo 版本为 3.0 或更高。
|
||||
2. 在你站点的 `/source/_data` 目录创建一个 `next.yml` 文件(如果 `_data` 目录不存在,请创建之)。
|
||||
|
||||
<p align="center">以上步骤之后有 <b>两种选择</b>,请<b>任选其一</b>然后<b>继续后面的步骤</b>。</p>
|
||||
|
||||
* **选择 1:`override: false`(默认)**:
|
||||
|
||||
1. 检查默认 NexT 配置中的 `override` 选项,必须设置为 `false`。\
|
||||
在 `next.yml` 文件中,也要设置为 `false`,或者不定义此选项。
|
||||
2. 从站点配置文件(`/_config.yml`)与主题配置文件(`/themes/next/_config.yml`)中复制你需要的选项到 `/source/_data/next.yml` 中。
|
||||
|
||||
* **选择 2:`override: true`**:
|
||||
|
||||
1. 在 `next.yml` 中设置 `override` 选项为 `true`。
|
||||
2. 从 `/themes/next/_config.yml` 配置文件中复制**所有**的 NexT 主题选项到 `/source/_data/next.yml` 中。
|
||||
|
||||
3. 然后,在站点的 `/_config.yml` 中需要定义 `theme: next` 选项(如果需要的话,`source_dir: source`)。
|
||||
4. 使用标准参数来启动服务器,生成或部署(`hexo clean && hexo g -d && hexo s`)。
|
||||
|
||||
### 相关链接
|
||||
|
||||
* [NexT Issue #328](https://github.com/iissnan/hexo-theme-next/issues/328)
|
||||
121
themes/next/docs/zh-CN/INSTALLATION.md
Normal file
121
themes/next/docs/zh-CN/INSTALLATION.md
Normal file
@@ -0,0 +1,121 @@
|
||||
<h1 align="center">安装</h1>
|
||||
|
||||
<h2 align="center">步骤 1 → 进入 Hexo 目录</h2>
|
||||
|
||||
进入 **Hexo 根**目录。这一目录中应当有 `node_modules`、`source`、`themes` 等若干子目录:
|
||||
|
||||
```sh
|
||||
$ cd hexo
|
||||
$ ls
|
||||
_config.yml node_modules package.json public scaffolds source themes
|
||||
```
|
||||
|
||||
<h2 align="center">步骤 2 → 获取 NexT</h2>
|
||||
|
||||
<p align="center">从 GitHub 下载主题。<br>
|
||||
为了下载这一主题,共有 <b>3 种选项</b>可选。你需要选择其中<b>唯一一个方式</b>。</p>
|
||||
|
||||
### 选项 1:下载[最新 release 版本][releases-latest-url]
|
||||
|
||||
通常情况下请选择 **stable** 版本。推荐不熟悉的用户按此方式进行。
|
||||
|
||||
* 使用 [curl、tar 和 wget][curl-tar-wget-url] 安装:
|
||||
|
||||
```sh
|
||||
$ mkdir themes/next
|
||||
$ curl -s https://api.github.com/repos/theme-next/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1
|
||||
```
|
||||
这种方式将**仅提供最新的 release 版本**(其中不附带 `.git` 目录)。\
|
||||
因此,将来你将不可能通过 `git` 更新这一方式安装的主题。\
|
||||
取而代之的,为了能不丢失你的自定义配置,你可以使用独立的配置文件(例如 [数据文件][docs-data-files-url])并下载最新版本到旧版本的目录中(或者下载到新的主题目录中并修改 Hexo 配置中的主题名)。
|
||||
|
||||
### 选项 2:下载 [tag 指向的 release 版本][releases-url]
|
||||
|
||||
在少数情况下将有所帮助,但这并非推荐方式。\
|
||||
你必须指定一个版本:使用 [tags 列表][tags-url]中的任意 tag 替换 `v6.0.0`。
|
||||
|
||||
* 方式 1:使用 [curl 和 tar][curl-tar-url] 安装:
|
||||
|
||||
```sh
|
||||
$ mkdir themes/next
|
||||
$ curl -L https://api.github.com/repos/theme-next/hexo-theme-next/tarball/v6.0.0 | tar -zxv -C themes/next --strip-components=1
|
||||
```
|
||||
和上述的 `curl、tar 和 wget` 方法相同,但只会下载**指定的 release 版本**。
|
||||
|
||||
* 方式 2:使用 [git][git-url] 安装:
|
||||
|
||||
```sh
|
||||
$ git clone --branch v6.0.0 https://github.com/theme-next/hexo-theme-next themes/next
|
||||
```
|
||||
这一方式将为你下载**指定的 release 版本**(其中包含 `.git` 目录)。\
|
||||
并且,你可以随时切换到任何已定义的版本号所对应的 tag 的版本。
|
||||
|
||||
### 选项 3:下载[最新 master 分支][download-latest-url]
|
||||
|
||||
可能**不稳定**,但包含最新的特性。推荐进阶用户和开发者按此方式进行。
|
||||
|
||||
* 方式 1:使用 [curl 和 tar][curl-tar-url] 安装:
|
||||
|
||||
```sh
|
||||
$ mkdir themes/next
|
||||
$ curl -L https://api.github.com/repos/theme-next/hexo-theme-next/tarball | tar -zxv -C themes/next --strip-components=1
|
||||
```
|
||||
和上述的 `curl、tar 和 wget` 方法相同,但只会下载**最新 master 分支版本**。\
|
||||
在有些情况对开发者有所帮助。
|
||||
|
||||
* 方式 2:使用 [git][git-url] 安装:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/theme-next/hexo-theme-next themes/next
|
||||
```
|
||||
|
||||
这一方式将为你下载**完整仓库**(其中包含 `.git` 目录)。\
|
||||
你可以随时[使用 git 更新至最新版本][update-with-git-url]并切换至任何有 tag 标记的 release 版本、最新的 master 分支版本、甚至其他分支。\
|
||||
在绝大多数情况下对用户和开发者友好。
|
||||
|
||||
获取 tags 列表:
|
||||
|
||||
```sh
|
||||
$ cd themes/next
|
||||
$ git tag -l
|
||||
…
|
||||
v6.0.0
|
||||
v6.0.1
|
||||
v6.0.2
|
||||
```
|
||||
|
||||
例如,假设你想要切换到 `v6.0.1` 这一 [tag 指向的 release 版本][tags-url]。输入如下指令:
|
||||
|
||||
```sh
|
||||
$ git checkout tags/v6.0.1
|
||||
Note: checking out 'tags/v6.0.1'.
|
||||
…
|
||||
HEAD is now at da9cdd2... Release v6.0.1
|
||||
```
|
||||
|
||||
然后,假设你想要切换回 [master 分支][commits-url],输入如下指令即可:
|
||||
|
||||
```sh
|
||||
$ git checkout master
|
||||
```
|
||||
|
||||
<h2 align="center">步骤 3 → 完成配置</h2>
|
||||
|
||||
在 **Hexo 站点配置文件**(`/_config.yml`)中设置你的主题:
|
||||
|
||||
```yml
|
||||
theme: next
|
||||
```
|
||||
|
||||
[download-latest-url]: https://github.com/theme-next/hexo-theme-next/archive/master.zip
|
||||
[releases-latest-url]: https://github.com/theme-next/hexo-theme-next/releases/latest
|
||||
[releases-url]: https://github.com/theme-next/hexo-theme-next/releases
|
||||
[tags-url]: https://github.com/theme-next/hexo-theme-next/tags
|
||||
[commits-url]: https://github.com/theme-next/hexo-theme-next/commits/master
|
||||
|
||||
[git-url]: http://lmgtfy.com/?q=linux+git+install
|
||||
[curl-tar-url]: http://lmgtfy.com/?q=linux+curl+tar+install
|
||||
[curl-tar-wget-url]: http://lmgtfy.com/?q=linux+curl+tar+wget+install
|
||||
|
||||
[update-with-git-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/README.md#update
|
||||
[docs-data-files-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/DATA-FILES.md
|
||||
191
themes/next/docs/zh-CN/LEANCLOUD-COUNTER-SECURITY.md
Normal file
191
themes/next/docs/zh-CN/LEANCLOUD-COUNTER-SECURITY.md
Normal file
@@ -0,0 +1,191 @@
|
||||
<h1 align="center">修复 LeanCloud 统计插件安全漏洞</h1>
|
||||
|
||||
在配置前,请升级 NexT 至 **v6.0.6** 以上。
|
||||
|
||||
在配置过程中请注意**博客配置文件**和**主题配置文件**的区别。
|
||||
|
||||
---
|
||||
|
||||
# 注册 LeanCloud 并创建应用
|
||||
- 首先,前往 LeanCloud 官网 [leancloud.cn](https://leancloud.cn) 进行注册,并登录。
|
||||
|
||||
请注意,目前华东节点和华北节点创建应用需要先在账号设置完成实名认证,并且官方表明“[在国内市场将只服务于可验证的商业客户](https://leancloudblog.com/domain-incident/)”;美国节点暂无上述要求,并且账号系统与华东节点和华北节点是独立的,如需使用请前往 LeanCloud 国际版官网 [leancloud.app](https://leancloud.app) 注册登录。
|
||||
|
||||
- 然后点击图示 `1` 处,进入控制台:
|
||||
|
||||

|
||||
|
||||
- 接着,点击图示 `1` 处,创建应用:
|
||||
|
||||

|
||||
|
||||
- 在弹出窗口 `1` 处输入应用名称(可随意输入,可更改,为演示方便取名为test),并选择 `2` 处“开发版”,然后点击 `3` 处创建:
|
||||
|
||||

|
||||
|
||||
到这里应用创建完成。
|
||||
|
||||
# 建立 Counter 类并在 NexT 中启用插件
|
||||
- 点击 `1` 处应用名称进入应用管理界面:
|
||||
|
||||

|
||||
|
||||
- 如图,点击侧边栏 `1` 处创建 Class:
|
||||
|
||||

|
||||
|
||||
- 在弹出窗口 `1` 处填入 `Counter`,勾选 `2` 处无限制,并点击 `3` 处创建 Class:
|
||||
|
||||

|
||||
|
||||
- 此时类已创建完成。接下来点击图示 `1` 处进入设置,然后点击 `2` 处进入应用 Key:
|
||||
|
||||

|
||||
|
||||
- 粘贴 `App ID` 和 `App Key` 到 **NexT主题配置文件** `_config.yml` 对应位置。此时配置文件应如下:
|
||||
```yml
|
||||
leancloud_visitors:
|
||||
enable: true
|
||||
app_id: # <your app id>
|
||||
app_key: # <your app key>
|
||||
# Required for apps from CN region
|
||||
server_url: # <your server url>
|
||||
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
|
||||
security: true
|
||||
```
|
||||
|
||||
- 设置Web安全域名确保域名调用安全。点击 `1` 处进入安全中心,然后在 `2` 处填写自己博客对应的域名(**注意协议、域名和端口号需严格一致**):
|
||||
|
||||

|
||||
|
||||
到这里内容均与 Doublemine 的[为NexT主题添加文章阅读量统计功能](https://notes.wanghao.work/2015-10-21-%E4%B8%BANexT%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%87%8F%E7%BB%9F%E8%AE%A1%E5%8A%9F%E8%83%BD.html#%E9%85%8D%E7%BD%AELeanCloud)这篇文章相同,只不过截图为新版的Leancloud的界面。
|
||||
|
||||
# 部署云引擎以保证访客数量不被随意篡改
|
||||
- 点击左侧 `1` 处云引擎,然后点击 `2` 处部署,再点击 `3` 处在线编辑:
|
||||
|
||||

|
||||
|
||||
- 点击 `1` 处创建函数:
|
||||
|
||||

|
||||
|
||||
- 在弹出窗口选择 `1` 处 `Hook` 类型,然后 `2` 处选择 `beforeUpdate`,`3` 处选择刚才建立的 `Counter` 类。在 `4` 中粘贴下方代码后,点 `5` 处保存。
|
||||
```javascript
|
||||
var query = new AV.Query("Counter");
|
||||
if (request.object.updatedKeys.includes('time')) {
|
||||
return query.get(request.object.id).then(function (obj) {
|
||||
if (obj.get("time") > request.object.get("time")) {
|
||||
throw new AV.Cloud.Error('Invalid update!');
|
||||
}
|
||||
return request.object.save();
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
如图所示:
|
||||
|
||||

|
||||
|
||||
- 点击保存后应出现类似红框处函数。此时点击 `1` 处部署:
|
||||
|
||||

|
||||
|
||||
- 在弹出窗口点击 `1` 处部署:
|
||||
|
||||

|
||||
|
||||
- 等待出现红框处的成功部署信息后,点击 `1` 处关闭:
|
||||
|
||||

|
||||
|
||||
至此云引擎已成功部署,任何非法的访客数量更改请求都将失败。
|
||||
|
||||
# 进一步设置权限
|
||||
- 打开**NexT主题配置文件** `_config.yml`,将 `leancloud_visitors` 下的 `security` 设置为 `true`(如没有则新增):
|
||||
```yml
|
||||
leancloud_visitors:
|
||||
enable: true
|
||||
app_id: # <your app id>
|
||||
app_key: # <your app key>
|
||||
# Required for apps from CN region
|
||||
server_url: # <your server url>
|
||||
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
|
||||
security: true
|
||||
```
|
||||
|
||||
- 打开 cmd 并切换至**博客根目录**,键入以下命令以安装 `hexo-leancloud-counter-security` 插件:
|
||||
```
|
||||
npm install hexo-leancloud-counter-security
|
||||
```
|
||||
|
||||
- 打开**博客配置文件** `_config.yml`,新增以下配置:
|
||||
```yml
|
||||
leancloud_counter_security:
|
||||
enable_sync: true
|
||||
app_id: <your app id>
|
||||
app_key: <your app key>
|
||||
username:
|
||||
password:
|
||||
```
|
||||
|
||||
- 在相同目录键入以下命令:
|
||||
```
|
||||
hexo lc-counter register <username> <password>
|
||||
```
|
||||
或
|
||||
```
|
||||
hexo lc-counter r <username> <password>
|
||||
```
|
||||
|
||||
将 `<username>` 和 `<password>` 替换为你自己的用户名和密码(不必与 LeanCloud 的账号相同)。此用户名和密码将在 Hexo 部署时使用。
|
||||
|
||||
- 打开**博客配置文件** `_config.yml`,将 `<username>` 和 `<password>` 替换为你刚刚设置的用户名和密码:
|
||||
```yml
|
||||
leancloud_counter_security:
|
||||
enable_sync: true
|
||||
app_id: <your app id>
|
||||
app_key: <your app key>
|
||||
username: <your username> #如留空则将在部署时询问
|
||||
password: <your password> #建议留空以保证安全性,如留空则将在部署时询问
|
||||
```
|
||||
|
||||
- 在**博客配置文件** `_config.yml` 的 `deploy` 下添加项:
|
||||
```yml
|
||||
deploy:
|
||||
# other deployer
|
||||
- type: leancloud_counter_security_sync
|
||||
```
|
||||
|
||||
- 返回 LeanCloud 控制台的应用内。依次点击 `1` `2`,检查 `_User` 表中是否出现一条记录(图示以用户名为 `admin` 为例):
|
||||
|
||||

|
||||
|
||||
- 点击 `1` 处进入 `Counter` 表,依次点击 `2` `3`,打开权限设置:
|
||||
|
||||

|
||||
|
||||
- <del>点击 `1` `add_field` 后选择 `2` 指定用户, 并将下两栏留空:</del> 此处应与下条 `create` 设置相同(选择你所创建的用户):
|
||||
|
||||

|
||||
|
||||
- 点击 `1` `create` 后选择 `2` 指定用户, 在 `3` 处键入用户名,点击 `4` 处后点击 `5` 处添加:
|
||||
|
||||

|
||||
|
||||
完成此步操作后,界面应与图示类似:
|
||||
|
||||

|
||||
|
||||
- 点击 `1` `delete` 后选择 `2` 指定用户, 并将下两栏留空:
|
||||
|
||||

|
||||
|
||||
至此权限已设置完成,数据库记录只能在本地增删。
|
||||
|
||||
每次运行 `hexo d` 部署的时候,插件都会扫描本地 `source/_posts` 下的文章并与数据库对比,然后在数据库创建没有录入数据库的文章记录。
|
||||
|
||||
如果在**博客配置文件**中留空 `username` 或 `password` ,则在部署过程中程序会要求输入。
|
||||
|
||||
---
|
||||
|
||||
原文链接:https://leaferx.online/2018/02/11/lc-security/
|
||||
243
themes/next/docs/zh-CN/MATH.md
Normal file
243
themes/next/docs/zh-CN/MATH.md
Normal file
@@ -0,0 +1,243 @@
|
||||
<h1 align="center">数学公式</h1>
|
||||
|
||||
NexT 内部提供数学公式渲染的引擎,这样你就不需要自己手动在模板中引入 JS 或者 CSS;
|
||||
只需要选择对应的渲染引擎,并在 `next/_config.yml` 中将其 `enable` 选项改为 `true` 即可。
|
||||
|
||||
需要注意的是,仅仅将 `enable` 打开**并不能让你看到数学公式**,你还需要**使用对应的 Hexo 渲染器(Renderer)** 才能真正在博客页面中显示出数学公式。引擎对应使用的 Hexo 渲染器会在引擎相关的部分介绍。
|
||||
|
||||
<h2 align="center">提供的渲染引擎</h2>
|
||||
|
||||
目前,NexT 提供两种数学公式渲染引擎,分别为 [MathJax](https://www.mathjax.org/) 和 [Katex](https://khan.github.io/KaTeX/)。
|
||||
|
||||
### MathJax
|
||||
|
||||
如果你选择使用 MathJax 进行数学公式渲染,你需要使用 [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) 或者 [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) (不推荐)作为 Hexo 的 Markdown 渲染器。
|
||||
|
||||
首先,卸载原有的渲染器 `hexo-renderer-marked`,并安装这两种渲染器的**其中一个**:
|
||||
|
||||
```sh
|
||||
npm uninstall hexo-renderer-marked
|
||||
npm install hexo-renderer-pandoc # 或者 hexo-renderer-kramed
|
||||
```
|
||||
|
||||
然后在 `next/_config.yml` 中将 `mathjax` 的 `enable` 打开。
|
||||
|
||||
```yml
|
||||
math:
|
||||
...
|
||||
mathjax:
|
||||
enable: true
|
||||
```
|
||||
|
||||
执行 Hexo 生成,部署,或者启动服务器:
|
||||
|
||||
```sh
|
||||
hexo clean && hexo g -d
|
||||
# 或者 hexo clean && hexo s
|
||||
```
|
||||
|
||||
#### 使用 MathJax 给公式编号并引用公式
|
||||
|
||||
在新版本的 NexT 主题中,我们加入了公式自动编号和引用功能。下面简要介绍一下如何使用这项功能。
|
||||
|
||||
为了使用这项功能,一般来说,你必须把所使用的 LaTeX 公式放在 `equation` 环境里面,采用旧的方法(也就是说,仅仅把公式的每一边用两个 $ 符号包含起来)是无效的。如何引用公式?你只需要在书写公式的时候给公式一个 `\label{}` 标记(tag),然后在正文中,可以使用 `\ref{}` 或者 `\eqref{}` 命令来引用对应的公式。使用 `\eqref{}` 是推荐的方式,因为如果你使用 `\ref{}`,公式在文中的引用编号将没有圆括号包围。下面介绍几种常见的公式编号例子。
|
||||
|
||||
对于简单的公式,使用下面的方式给公式一个标记,
|
||||
|
||||
```latex
|
||||
$$\begin{equation}\label{eq1}
|
||||
e=mc^2
|
||||
\end{equation}$$
|
||||
```
|
||||
|
||||
然后,在正文中,你可以轻松引用上述公式,一个简单的例子如下:
|
||||
|
||||
```
|
||||
著名的质能方程 $\eqref{eq1}$ 由爱因斯坦提出 ...
|
||||
```
|
||||
|
||||
对于多行公式,在 `equation` 环境中,你可以使用 `aligned` 环境把公式分成多行,
|
||||
|
||||
```latex
|
||||
$$\begin{equation}\label{eq2}
|
||||
\begin{aligned}
|
||||
a &= b + c \\
|
||||
&= d + e + f + g \\
|
||||
&= h + i
|
||||
\end{aligned}
|
||||
\end{equation}$$
|
||||
```
|
||||
|
||||
要对齐多个公式,我们需要使用 `align` 环境。align 环境中的每个公式都有自己的编号:
|
||||
|
||||
```
|
||||
$$\begin{align}
|
||||
a &= b + c \label{eq3} \\
|
||||
x &= yz \label{eq4}\\
|
||||
l &= m - n \label{eq5}
|
||||
\end{align}$$
|
||||
```
|
||||
|
||||
在 `align` 环境中,如果你不想给某个或某几个公式编号,那么在这些公式后面使用 [`\nonumber`](https://tex.stackexchange.com/questions/17528/show-equation-number-only-once-in-align-environment) 命令即可。例如:
|
||||
|
||||
```latex
|
||||
$$\begin{align}
|
||||
-4 + 5x &= 2+y \nonumber \\
|
||||
w+2 &= -1+w \\
|
||||
ab &= cb
|
||||
\end{align}$$
|
||||
```
|
||||
|
||||
有时,你可能会希望采用更加奇特的方式来标记和引用你的公式,你可以通过使用 `\tag{}` 命令来实现,例如:
|
||||
|
||||
```latex
|
||||
$$x+1\over\sqrt{1-x^2} \tag{i}\label{eq_tag}$$
|
||||
```
|
||||
|
||||
如果你想要了解更多信息,请访问 [MathJax 关于公式编号的官方文档](https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html)。同时,你也可以阅读 [这篇文档](https://theme-next.org/docs/third-party-services/math-equations) 来获取更多细节信息。
|
||||
|
||||
### Katex
|
||||
|
||||
Katex 渲染引擎相对于 MathJax 来说**大大提高了速度**,而且在关掉 JavaScript 时也能渲染数学公式。
|
||||
|
||||
但是 Katex 所支持的东西没有 MathJax 全面,你可以从下面的相关链接中获取更多的信息。
|
||||
|
||||
如果你选择使用 Katex 进行数学公式渲染,你需要使用 [hexo-renderer-markdown-it-plus](https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus) 或者 [hexo-renderer-markdown-it](https://github.com/hexojs/hexo-renderer-markdown-it) 这两种渲染器的其中一个。
|
||||
|
||||
首先,卸载原有的渲染器 `hexo-renderer-marked`,并安装这两种渲染器的**其中一个**:
|
||||
|
||||
```sh
|
||||
npm uninstall hexo-renderer-marked
|
||||
npm install hexo-renderer-markdown-it-plus
|
||||
# 或者 hexo-renderer-markdown-it
|
||||
```
|
||||
|
||||
然后在 `next/_config.yml` 中将 `katex` 的 `enable` 打开。
|
||||
|
||||
```yml
|
||||
math:
|
||||
...
|
||||
katex:
|
||||
enable: true
|
||||
```
|
||||
|
||||
执行 Hexo 生成,部署,或者启动服务器:
|
||||
|
||||
```sh
|
||||
hexo clean && hexo g -d
|
||||
# 或者 hexo clean && hexo s
|
||||
```
|
||||
|
||||
#### 如果你使用 hexo-renderer-markdown-it
|
||||
|
||||
如果你使用 `hexo-renderer-markdown-it`,你还需要为其加上 `markdown-it-katex` 作为插件:
|
||||
|
||||
```
|
||||
npm install markdown-it-katex
|
||||
```
|
||||
|
||||
然后在 `hexo/_config.yml` 中将 `markdown-it-katex` 作为插件写入 `hexo-renderer-markdown-it` 的配置中:
|
||||
|
||||
```yml
|
||||
markdown:
|
||||
render:
|
||||
html: true
|
||||
xhtmlOut: false
|
||||
breaks: true
|
||||
linkify: true
|
||||
typographer: true
|
||||
quotes: '“”‘’'
|
||||
plugins:
|
||||
- markdown-it-katex
|
||||
```
|
||||
|
||||
#### 已知的问题
|
||||
|
||||
1. 首先请查阅 Katex 的 [Common Issue](https://github.com/Khan/KaTeX#common-issues)
|
||||
2. 块级公式(例如 `$$...$$`)必须位于空行。\
|
||||
即在开头的 `$$` 前和在结尾的 `$$` 后不能有除了空白字符以外的其他字符。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
|
||||
3. 不支持 Unicode。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
|
||||
4. 行内公式(例如 `$...$`)在开头的 `$` 后面和结尾的 `$` 前面**不能含有空格**。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
|
||||
5. 如果你在文章的各级标题中(例如 `## 标题`)使用公式。\
|
||||
那么文章目录中的这个标题会出现 3 次未渲染的公式代码([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359018694))
|
||||
6. 如果你在文章 Title 中使用公式,那么公式将不会被渲染。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359142879))
|
||||
|
||||
我们目前使用的 Katex 版本为 0.11.1,这里面可能有某些问题是因为 Katex 版本老旧导致的;
|
||||
|
||||
但是,就像上面所说的,数学公式的渲染必须依靠渲染器来支持,目前的 Katex 相关的渲染器仅支持到 Katex 0.11.1;
|
||||
|
||||
我们会持续关注相关渲染器的更新,如果有渲染器支持更高版本的 Katex,我们会及时更新我们的 Katex 版本。
|
||||
|
||||
### 相关链接
|
||||
|
||||
* [Katex 与 MathJax 渲染速度对比](https://www.intmath.com/cg5/katex-mathjax-comparison.php)
|
||||
* [Katex 支持的功能列表](https://khan.github.io/KaTeX/function-support.html)
|
||||
|
||||
<h2 align="center">相关配置说明</h2>
|
||||
|
||||
注意,在修改配置选项时,**不要更改配置的缩进**;
|
||||
|
||||
目前,NexT 的所有配置都采用**2 空格的缩进**;
|
||||
|
||||
如果配置的内容接在冒号后面,那么内容和冒号之间必须有一个空格(例如`enable: true`)
|
||||
|
||||
```yml
|
||||
# Math Formulas Render Support
|
||||
math:
|
||||
# Default (true) will load mathjax / katex script on demand.
|
||||
# That is it only render those page which has `mathjax: true` in Front-matter.
|
||||
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
|
||||
per_page: true
|
||||
|
||||
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
|
||||
mathjax:
|
||||
enable: true
|
||||
# See: https://mhchem.github.io/MathJax-mhchem/
|
||||
mhchem: false
|
||||
|
||||
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
|
||||
katex:
|
||||
enable: false
|
||||
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
|
||||
copy_tex: false
|
||||
```
|
||||
|
||||
### `per_page`
|
||||
|
||||
`true` 或者 `false`,默认为 `true`。
|
||||
|
||||
这个选项是控制是否在每篇文章都渲染数学公式;
|
||||
|
||||
默认(`true`) 的行为是**只对 Front-matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。
|
||||
|
||||
如果 Front-matter 中不含有 `mathjax: true`,或者 `mathjax: false`,那么 NexT 将不会对这些文章进行数学公式渲染。
|
||||
|
||||
例如:
|
||||
|
||||
```md
|
||||
<!-- 这篇文章会渲染数学公式 -->
|
||||
---
|
||||
title: 'Will Render Math'
|
||||
mathjax: true
|
||||
---
|
||||
....
|
||||
```
|
||||
|
||||
```md
|
||||
<!-- 这篇文章不会渲染数学公式 -->
|
||||
---
|
||||
title: 'Not Render Math'
|
||||
mathjax: false
|
||||
---
|
||||
....
|
||||
```
|
||||
|
||||
```md
|
||||
<!-- 这篇文章也不会渲染数学公式 -->
|
||||
---
|
||||
title: 'Not Render Math Either'
|
||||
---
|
||||
....
|
||||
```
|
||||
|
||||
当你将它设置为 `false` 时,它就会在每个页面都加载 MathJax 或者 Katex 来进行数学公式渲染。
|
||||
151
themes/next/docs/zh-CN/README.md
Normal file
151
themes/next/docs/zh-CN/README.md
Normal file
@@ -0,0 +1,151 @@
|
||||
<div align="right">
|
||||
语言:
|
||||
<a title="英语" href="../../README.md">🇺🇸</a>
|
||||
🇨🇳
|
||||
<a title="俄语" href="../ru/README.md">🇷🇺</a>
|
||||
</div>
|
||||
|
||||
# <div align="center"><a title="NexT website repository" href="https://github.com/theme-next/theme-next.org"><img align="center" width="56" height="56" src="https://raw.githubusercontent.com/theme-next/hexo-theme-next/master/source/images/logo.svg?sanitize=true"></a> e x T</div>
|
||||
|
||||
<p align="center">
|
||||
«NexT» 是一款风格优雅的高质量 <a href="https://hexo.io">Hexo</a> 主题,自点点滴滴中用爱雕琢而成。
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://www.npmjs.com/package/hexo-theme-next"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a>
|
||||
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E=10.9.0-green?style=flat-square"></a>
|
||||
<a href="https://hexo.io"><img src="https://img.shields.io/badge/hexo-%3E=4.0.0-blue?style=flat-square&logo=hexo"></a>
|
||||
<a href="https://github.com/theme-next/hexo-theme-next/blob/master/LICENSE.md"><img src="https://img.shields.io/badge/license-%20AGPL-orange?style=flat-square&logo=gnu"></a>
|
||||
<br>
|
||||
<a href="https://bestpractices.coreinfrastructure.org/projects/2625"><img src="https://img.shields.io/cii/level/2625?style=flat-square" title="Core Infrastructure Initiative Best Practices"></a>
|
||||
<a href="https://travis-ci.org/theme-next/hexo-theme-next?branch=master"><img src="https://img.shields.io/travis/theme-next/hexo-theme-next/master?style=flat-square&logo=travis%20ci" title="Travis CI [Linux]"></a>
|
||||
<a href="https://app.codacy.com/manual/theme-next/hexo-theme-next/dashboard"><img src="https://img.shields.io/codacy/grade/72f7fe7609c2438a92069f448e5a341a/master?style=flat-square&logo=codacy" title="Project Grade"></a>
|
||||
<img src="https://img.shields.io/snyk/vulnerabilities/github/theme-next/hexo-theme-next?style=flat-square" title="Vulnerabilities">
|
||||
<br>
|
||||
<img src="https://user-images.githubusercontent.com/16272760/63487983-da41b080-c4df-11e9-951c-64883a8a5e9b.png">
|
||||
</p>
|
||||
|
||||
## 即时预览
|
||||
|
||||
<p align="center">
|
||||
💟 <a href="https://muse.theme-next.org">Muse</a> | 🔯 <a href="https://mist.theme-next.org">Mist</a> | ♓️ <a href="https://pisces.theme-next.org">Pisces</a> | ♊️ <a href="https://theme-next.org">Gemini</a>
|
||||
<br>
|
||||
<br>
|
||||
更多 «NexT» 的例子参见<a href="https://github.com/theme-next/awesome-next#live-preview">这里</a>。
|
||||
</p>
|
||||
|
||||
## 安装
|
||||
|
||||
最简单的安装方式是直接克隆整个仓库:
|
||||
|
||||
```sh
|
||||
$ cd hexo
|
||||
$ git clone https://github.com/theme-next/hexo-theme-next themes/next
|
||||
```
|
||||
|
||||
此外,如果你想要使用其他方式,你也可以参见[详细安装步骤][docs-installation-url]。
|
||||
|
||||
## 插件
|
||||
|
||||
NexT 支持大量的第三方插件,它们可以被轻松地配置。
|
||||
|
||||
例如,你想要在你的站点中使用 `pjax` 插件,请进入 NexT 配置文件,启用 `pjax` 配置项:
|
||||
|
||||
```yml
|
||||
# Easily enable fast Ajax navigation on your website.
|
||||
# Dependencies: https://github.com/theme-next/theme-next-pjax
|
||||
pjax: true
|
||||
```
|
||||
|
||||
然后,打开它上面的 «Dependencies» 链接以查看它的安装步骤。
|
||||
|
||||
### 设置 CDN
|
||||
|
||||
如果你想要通过 CDN 来加载插件脚本,那么需要设置相关的 CDN 链接。
|
||||
|
||||
例如,你想要使用 `mediumzoom` 插件并通过 CDN 加载,进入 Next 配置文件并找到如下内容:
|
||||
|
||||
```yml
|
||||
vendors:
|
||||
# ...
|
||||
# Some contents...
|
||||
# ...
|
||||
mediumzoom: # Set or update mediumzoom CDN URL.
|
||||
```
|
||||
|
||||
## 更新
|
||||
|
||||
NexT 每个月都会发布新版本。你可以通过如下命令更新到最新的 master 分支:
|
||||
|
||||
```sh
|
||||
$ cd themes/next
|
||||
$ git pull
|
||||
```
|
||||
|
||||
如果你在此过程中收到了任何错误报告 (例如 **«Commit your changes or stash them before you can merge»**),我们推荐你使用 [Hexo 数据文件][docs-data-files-url]特性。\
|
||||
然而你也可以通过提交(`Commit`)、贮藏(`Stash`)或忽视(`Discard`)本地更改以绕过这种更新错误。具体方法请参考[这里](https://stackoverflow.com/a/15745424/5861495)。
|
||||
|
||||
**如果你想要从 v5.1.x 更新到最新版本,阅读[这篇文档][docs-update-5-1-x-url]。**
|
||||
|
||||
## 反馈
|
||||
|
||||
* 浏览 [Awesome NexT][awesome-next-url] 列表,与其它用户分享插件和教程。
|
||||
* 加入我们的 [Telegram][t-chat-url] / [Gitter][gitter-url] / [Riot][riot-url] 聊天。
|
||||
* 请花几秒钟来[添加或修正翻译][i18n-url]。
|
||||
* 在 [GitHub Issues][issues-bug-url] 报告Bug。
|
||||
* 在 [GitHub][issues-feat-url] 请求新的功能。
|
||||
* 为 [受欢迎的 Feature request][feat-req-vote-url] 投票。
|
||||
|
||||
## 贡献你的代码
|
||||
|
||||
我们欢迎你加入 NexT 的开发,贡献出你的一份力量。请看[开源贡献指南][contributing-document-url]。 🤗
|
||||
|
||||
你也可以随时向我们的[官方插件][official-plugins-url]提交 Issue 或 Pull Request。
|
||||
|
||||
## 贡献者
|
||||
|
||||
[![][contributors-image]][contributors-url]
|
||||
|
||||
## 鸣谢
|
||||
|
||||
<p align="center">
|
||||
«NexT» 特别感谢这些支持我们核心基础设施的优质服务:
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://github.com"><img align="center" width="100" src="https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png"></a>
|
||||
|
||||
<a href="https://www.netlify.com"><img align="center" width="150" src="https://cdn.netlify.com/15ecf59b59c9d04b88097c6b5d2c7e8a7d1302d0/1b6d6/img/press/logos/full-logo-light.svg"></a>
|
||||
<br>
|
||||
<sub>GitHub 容许我们托管 Git 仓库,Netlify 容许我们分发文档。</sub>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://crowdin.com"><img align="center" width="180" src="https://support.crowdin.com/assets/logos/crowdin-logo1-small.png"></a>
|
||||
<br>
|
||||
<sub>Crowdin 容许我们方便地翻译文档。</sub>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://codacy.com"><img align="center" width="155" src="https://user-images.githubusercontent.com/16944225/55026017-623f8f00-5002-11e9-88bf-0d6a5884c6c2.png"></a>
|
||||
|
||||
<a href="https://travis-ci.com"><img align="center" width="140" src="https://raw.githubusercontent.com/travis-ci/travis-web/master/public/images/logos/TravisCI-Full-Color.png"></a>
|
||||
<br>
|
||||
<sub>Codacy 容许我们监控代码质量,Travis CI 容许我们运行测试套件。</sub>
|
||||
</p>
|
||||
|
||||
[docs-installation-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/INSTALLATION.md
|
||||
[docs-data-files-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/DATA-FILES.md
|
||||
[docs-update-5-1-x-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/UPDATE-FROM-5.1.X.md
|
||||
|
||||
[t-news-url]: https://t.me/theme_next_news
|
||||
[t-chat-url]: https://t.me/theme_next_chinese
|
||||
[gitter-url]: https://gitter.im/theme-next
|
||||
[riot-url]: https://riot.im/app/#/room/#theme-next:matrix.org
|
||||
[i18n-url]: https://i18n.theme-next.org
|
||||
|
||||
[awesome-next-url]: https://github.com/theme-next/awesome-next
|
||||
[issues-bug-url]: https://github.com/theme-next/hexo-theme-next/issues/new?assignees=&labels=Bug&template=bug-report.md
|
||||
[issues-feat-url]: https://github.com/theme-next/hexo-theme-next/issues/new?assignees=&labels=Feature+Request&template=feature-request.md
|
||||
[feat-req-vote-url]: https://github.com/theme-next/hexo-theme-next/issues?q=is%3Aopen+is%3Aissue+label%3A%22Feature+Request%22
|
||||
|
||||
[contributing-document-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/CONTRIBUTING.md
|
||||
[official-plugins-url]: https://github.com/theme-next
|
||||
[contributors-image]: https://opencollective.com/theme-next/contributors.svg?width=890
|
||||
[contributors-url]: https://github.com/theme-next/hexo-theme-next/graphs/contributors
|
||||
40
themes/next/docs/zh-CN/UPDATE-FROM-5.1.X.md
Normal file
40
themes/next/docs/zh-CN/UPDATE-FROM-5.1.X.md
Normal file
@@ -0,0 +1,40 @@
|
||||
<h1 align="center">从 NexT v5.1.x 更新</h1>
|
||||
|
||||
在使用 Hexo 3 时,NexT V5 版本仍然能够正常运行,但是如果你想获得更多的功能和帮助,还是建议您升级到 NexT V7+ 版本,并移步 [Theme-Next](https://github.com/theme-next/hexo-theme-next) 仓库。
|
||||
|
||||
在 5.1.x 版本和新版本之间没有很大的革命性改进。主版本号变更至 7 主要是因为:
|
||||
|
||||
1. 主仓库已从 [iissnan 名下](https://github.com/iissnan/hexo-theme-next) 迁移至 [theme-next](https://github.com/theme-next) 组织。
|
||||
2. `next/source/lib` 目录下的绝大多数库被移出到了 [NexT 组织的外部仓库](https://github.com/theme-next)中。
|
||||
3. 第三方插件 [`hexo-wordcount`](https://github.com/willin/hexo-wordcount) 被 [`hexo-symbols-count-time`](https://github.com/theme-next/hexo-symbols-count-time) 所取代,因为 `hexo-symbols-count-time` 没有任何外部 Node.js 依赖、也没有会导致生成站点时的性能问题 [language filter](https://github.com/willin/hexo-wordcount/issues/7)。
|
||||
|
||||
我们推荐通过如下步骤从 v5 升级到 v7:
|
||||
|
||||
1. 并不修改原有的 `next` 目录,而只是复制部分 NexT 文件:
|
||||
1. `_config.yml` 或 `next.yml`(如果你使用了[数据文件](DATA-FILES.md))。
|
||||
2. 自定义的 CSS 配置,它们应在 `next/source/css/_custom/*` 和 `next/source/css/_variables/*` 中。
|
||||
3. 自定义的排布配置,它们应在 `next/layout/_custom/*` 中。
|
||||
4. 任何其它可能的附加自定义内容;为了定位它们,你可以通过某些工具在仓库间比较。
|
||||
2. 克隆新的仓库到任一异于 `next` 的目录(如 `next-reloaded`):
|
||||
```sh
|
||||
$ git clone https://github.com/theme-next/hexo-theme-next themes/next-reloaded
|
||||
```
|
||||
如此,你可以在不修改原有的 NexT v5.1.x 目录的同时使用 `next-reloaded` 目录中的新版本主题。
|
||||
3. 在 Hexo 的主配置文件中设置主题:
|
||||
```yml
|
||||
...
|
||||
theme: next-reloaded
|
||||
...
|
||||
```
|
||||
如此,你的 `next-reloaded` 主题将在生成站点时被加载。如果你遇到了任何错误、或只是不喜欢这一新版本,你可以随时切换回旧的 v5.1.x 版本。
|
||||
|
||||
4. 更新语言配置
|
||||
|
||||
从 v6.0.3 版本起,`zh-Hans` 改名为 `zh-CN`:https://github.com/theme-next/hexo-theme-next/releases/tag/v6.0.3
|
||||
|
||||
升级到 v6.0.3 及以后版本的用户,需要显式修改 Hexo 主配置文件 `_config.yml` 里的 `language` 配置,否则语言显示不正确。
|
||||
5. 更新 Hexo 和 Hexo 插件
|
||||
|
||||
如果完成了以上步骤后,执行 `hexo s` 或 `hexo g` 出现错误,这意味着可能是旧版的 Hexo 和 Hexo 插件与新版的 NexT 主题产生了冲突。我们建议将 Hexo 升级至 4.0 以上的版本,将 Hexo 插件升级到最新版本。你可以执行 `npm outdated` 查看所有可以升级的插件。
|
||||
|
||||
关于第三方库的启用,参见[这里](https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/INSTALLATION.md#插件)。
|
||||
Reference in New Issue
Block a user