From 2d734edc07ffad23ee7d9688ff5e9237578d6a0b Mon Sep 17 00:00:00 2001 From: NeverBehave Date: Sun, 3 May 2020 12:29:36 -0400 Subject: [PATCH] fix: missing file and table escape --- docs/.format/file.js | 5 +++-- docs/README.md | 2 +- docs/format.js | 16 +++++++++++----- docs/install/README.md | 38 ++++++++++++++++++-------------------- docs/joinus/README.md | 32 +++++++++++++++++--------------- docs/multimedia.md | 5 +++-- docs/support/README.md | 2 +- docs/traditional-media.md | 7 ++++--- 8 files changed, 58 insertions(+), 49 deletions(-) diff --git a/docs/.format/file.js b/docs/.format/file.js index 6fbcf43fc..8e5516561 100644 --- a/docs/.format/file.js +++ b/docs/.format/file.js @@ -3,8 +3,9 @@ const fs = require('fs'); module.exports = { ROUTE_TYPE: 'route', GUIDE_TYPE: 'guide', - LANG_CN: 'cn', - LANG_EN: 'en', + NAV_TYPE: 'nav', + LANG_CN: 'zh-CN', + LANG_EN: 'en-US', readFile: async (filePath) => fs.promises.readFile(filePath, { encoding: 'utf8' }), writeFile: async (filePath, data) => fs.promises.writeFile(filePath, data, { encoding: 'utf8' }), }; diff --git a/docs/README.md b/docs/README.md index 3c2e41d9a..816b93dc7 100755 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以 可以配合浏览器扩展 [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) 食用 -[Telegram 群](https://t.me/rsshub) | [Telegram 频道](https://t.me/awesomeRSSHub) +[Telegram 群](https://t.me/rsshub) \| [Telegram 频道](https://t.me/awesomeRSSHub) ## 鸣谢 diff --git a/docs/format.js b/docs/format.js index d33d5dde1..80a698475 100644 --- a/docs/format.js +++ b/docs/format.js @@ -21,6 +21,12 @@ const loopSideBar = (children, type, lang, prefix) => type, lang, })); +const loopNav = (nav, lang) => + nav.map((e) => ({ + path: path.resolve(__dirname, e.link.slice(1), 'README.md'), + type: file.NAV_TYPE, + lang, + })); const loopType = (sidebar, lang, prefix) => loopSideBar(sidebar[0].children, file.GUIDE_TYPE, lang, prefix).concat(loopSideBar(sidebar[1].children, file.ROUTE_TYPE, lang, prefix)); /** @@ -37,12 +43,12 @@ const buildFileList = async () => { let fileList = []; Object.keys(config.themeConfig.locales).forEach((key) => { const locale = config.themeConfig.locales[key]; + const key_path = key.slice(1); if (locale.hasOwnProperty('sidebar')) { - if (locale.sidebar['/']) { - fileList = fileList.concat(loopType(locale.sidebar['/'], file.LANG_CN, '')); - } else if (locale.sidebar['/en/']) { - fileList = fileList.concat(loopType(locale.sidebar['/en/'], file.LANG_EN, 'en/')); - } + fileList = fileList.concat(loopType(locale.sidebar[key], locale.lang, key_path)); + } + if (locale.hasOwnProperty('nav')) { + fileList = fileList.concat(loopNav(locale.nav, locale.lang)); } }); diff --git a/docs/install/README.md b/docs/install/README.md index 2b03316c5..2901e9cfd 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -8,18 +8,18 @@ sidebar: auto 部署涉及到以下基本编程常识: -1. 命令行操作 -1. [Git](https://git-scm.com/) -1. [Node.js](https://nodejs.org/) -1. [npm](https://www.npmjs.com/get-npm) 或 [yarn](https://yarnpkg.com/zh-Hans/docs/install) +1. 命令行操作 +2. [Git](https://git-scm.com/) +3. [Node.js](https://nodejs.org/) +4. [npm](https://www.npmjs.com/get-npm) 或 [yarn](https://yarnpkg.com/zh-Hans/docs/install) 部署到可外网访问则可能涉及到: -1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) -1. [Docker](https://www.docker.com/get-started) 或 [docker-compose](https://docs.docker.com/compose/install/) -1. [Redis](https://redis.io/download) -1. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs) -1. [Google App Engine](https://cloud.google.com/appengine/) +1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) +2. [Docker](https://www.docker.com/get-started) 或 [docker-compose](https://docs.docker.com/compose/install/) +3. [Redis](https://redis.io/download) +4. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs) +5. [Google App Engine](https://cloud.google.com/appengine/) ## Docker Compose 部署 @@ -73,7 +73,7 @@ $ docker pull diygod/rsshub $ docker run -d --name rsshub -p 1200:1200 diygod/rsshub ``` -在浏览器中打开 [http://127.0.0.1:1200/](http://127.0.0.1:1200/),enjoy it! ✅ +在浏览器中打开 ,enjoy it! ✅ 您可以使用下面的命令来关闭 RSSHub @@ -153,7 +153,7 @@ $ yarn start $ pm2 start lib/index.js --name rsshub ``` -在浏览器中打开 [http://127.0.0.1:1200/](http://127.0.0.1:1200/),enjoy it! ✅ +在浏览器中打开 ,enjoy it! ✅ 详细使用说明参照 [指南](https://docs.rsshub.app/),替换所有路由例子中的 `https://rsshub.app/` 为 `http://localhost:1200` 即可正常使用 @@ -163,10 +163,8 @@ $ pm2 start lib/index.js --name rsshub 在项目根目录新建一个 `.env` 文件,每行以 `NAME=VALUE` 格式添加环境变量,例如 -``` -CACHE_TYPE=redis -CACHE_EXPIRE=600 -``` + CACHE_TYPE=redis + CACHE_EXPIRE=600 注意它不会覆盖已有的环境变量,更多规则请参考 [dotenv](https://github.com/motdotla/dotenv) @@ -265,7 +263,7 @@ env_variables: ::: warning 注意 - 需要 [DockerHub](https://hub.docker.com) 账号 -- [Play with Docker](https://labs.play-with-docker.com/) 一次仅能使用 4 小时,不能作为持久化解决方案,应当用于测试/验证路由规则 +- [Play with Docker](https://labs.play-with-docker.com/) 一次仅能使用 4 小时,不能作为持久化解决方案,应当用于测试 / 验证路由规则 - 如果部署完成后不能看到自动识别的端口,请手动点击顶部按钮`open port`并输入`1200` - 有的时候 PWD 会抽风,如果遇到点击`Start`后空白页面,或者拉起失败,请重试 @@ -319,7 +317,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式 `protected_route.js` 内的路由将启用 HTTP Basic Authentication 认证 -支持该认证协议的阅读器,在添加源地址时,需要在源地址前添加认证信息,例如:http://usernam3:passw0rd@127.0.0.1:1200/protected/rsshub/routes +支持该认证协议的阅读器,在添加源地址时,需要在源地址前添加认证信息,例如:`http://usernam3:passw0rd@127.0.0.1passw0rd@127.0.0.1:1200/protected/rsshub/routes` `HTTP_BASIC_AUTH_NAME`: Http basic authentication 用户名,默认为 `usernam3`,请务必修改 @@ -401,7 +399,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式 - 邮箱 邮件列表路由: - - `EMAIL_CONFIG_{email}`: 邮箱设置,替换 `{email}` 为 邮箱账号,邮件账户的 `@` 替换为 `.`,例如 `EMAIL_CONFIG_xxx.qq.com`。内容格式为 `password=密码&host=服务器&port=端口`,例如 `password=123456&host=imap.qq.com&port=993`。 + - `EMAIL_CONFIG_{email}`: 邮箱设置,替换 `{email}` 为 邮箱账号,邮件账户的 `@` 替换为 `.`,例如 `EMAIL_CONFIG_xxx.qq.com`。内容格式为 `password = 密码 & host = 服务器 & port = 端口`,例如 `password=123456&host=imap.qq.com&port=993`。 - 吹牛部落 栏目更新 @@ -411,7 +409,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式 - `WEIBO_APP_KEY`: 微博 App Key - `WEIBO_APP_SECRET`: 微博 App Secret - - `WEIBO_REDIRECT_URL`: 微博登录授权回调地址,默认为 `RSSHub地址/weibo/timeline/0`,自定义回调地址请确保最后可以转跳到 `RSSHub地址/weibo/timeline/0?code=xxx` + - `WEIBO_REDIRECT_URL`: 微博登录授权回调地址,默认为 `RSSHub 地址 / weibo/timeline/0`,自定义回调地址请确保最后可以转跳到 `RSSHub 地址 / weibo/timeline/0?code=xxx` - 饭否 全部路由: [申请地址](https://github.com/FanfouAPI/FanFouAPIDoc/wiki/Oauth) @@ -426,7 +424,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式 - 北大未名 BBS 全站十大 - - `PKUBBS_COOKIE`: BBS 注册用户登录后的 Cookie 值,获取方式:1.登录后打开论坛首页 2. 打开控制台 3. 刷新 4. 找到 请求 5. 找到请求头中的 Cookie + - `PKUBBS_COOKIE`: BBS 注册用户登录后的 Cookie 值,获取方式:1. 登录后打开论坛首页 2. 打开控制台 3. 刷新 4. 找到 请求 5. 找到请求头中的 Cookie - nhentai torrent: [注册地址](https://nhentai.net/register/) diff --git a/docs/joinus/README.md b/docs/joinus/README.md index c2df617bf..ae3a10c39 100644 --- a/docs/joinus/README.md +++ b/docs/joinus/README.md @@ -30,14 +30,16 @@ sidebar: auto #### 获取源数据 - 获取源数据的主要手段为使用 [got](https://github.com/sindresorhus/got) 发起 HTTP 请求(请求接口或请求网页)获取数据 + - 个别情况需要使用 [puppeteer](https://github.com/GoogleChrome/puppeteer) 模拟浏览器渲染目标页面并获取数据 - 返回的数据一般为 JSON 或 HTML 格式 + - 对于 HTML 格式的数据,使用 [cheerio](https://github.com/cheeriojs/cheerio) 进行处理 - 以下三种获取数据方法按 **「推荐优先级」** 排列: - 1. **使用 got 从接口获取数据** + 1. **使用 got 从接口获取数据** 样例:[/lib/routes/bilibili/coin.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/bilibili/coin.js)。 @@ -101,7 +103,7 @@ sidebar: auto // 至此本路由结束 ``` - 2. **使用 got 从 HTML 获取数据** + 2. **使用 got 从 HTML 获取数据** 有时候数据是写在 HTML 里的,**没有接口供我们调用**,样例: [/lib/routes/douban/explore.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/douban/explore.js)。 @@ -153,7 +155,7 @@ sidebar: auto // 至此本路由结束 ``` - 3. **使用 puppeteer 渲染页面获取数据** + 3. **使用 puppeteer 渲染页面获取数据** ::: tip 提示 @@ -213,16 +215,16 @@ sidebar: auto // 注:由于此路由只是起到一个新专栏上架提醒的作用,无法访问付费文章,因此没有文章正文 ``` - 4. **使用通用配置型路由** + 4. **使用通用配置型路由** 很大一部分网站是可以通过一个配置范式来生成 RSS 的。 通用配置即通过 cheerio(**CSS 选择器、jQuery 函数**)读取 json 数据来简便的生成 RSS。 首先我们需要几个数据: - 1. RSS 来源链接 - 2. 数据来源链接 - 3. RSS 标题(非 item 标题) + 1. RSS 来源链接 + 2. 数据来源链接 + 3. RSS 标题(非 item 标题) ```js const buildData = require('@/utils/common-config'); @@ -341,7 +343,7 @@ ctx.state.data = { }; ``` -##### BT/磁力源 +##### BT / 磁力源 用于下载类 RSS,**额外**添加这些字段能使你的 RSS 被 BT 客户端识别并自动下载: @@ -392,13 +394,13 @@ ctx.state.data = { - `example`: 路由举例 - `path`: 路由路径 - `:paramsDesc`: 路由参数说明,数组,支持 markdown - 1. 参数说明必须对应其在路径中出现的顺序 - 1. 如缺少说明将会导致`npm run docs:dev`报错 - 1. 说明中的 `'` `"` 必须通过反斜杠转义 `\'` `\"` - 1. 不必在说明中标注`可选/必选`,组件会根据路由`?`自动判断 + 1. 参数说明必须对应其在路径中出现的顺序 + 2. 如缺少说明将会导致`npm run docs:dev`报错 + 3. 说明中的 `'` `"` 必须通过反斜杠转义 `\'` `\"` + 4. 不必在说明中标注`可选 / 必选`,组件会根据路由`?`自动判断 - 文档样例: - 1. 无参数: + 1. 无参数: ```vue @@ -412,7 +414,7 @@ ctx.state.data = { *** - 2. 多参数: + 2. 多参数: ```vue @@ -455,7 +457,7 @@ ctx.state.data = { 1. 请一定要注意把``的标签关闭! -1. 执行 `npm run format` 自动标准化代码格式,提交代码, 然后提交 pull request +2. 执行 `npm run format` 自动标准化代码格式,提交代码, 然后提交 pull request ## 提交新的 RSSHub Radar 规则 diff --git a/docs/multimedia.md b/docs/multimedia.md index 72c871f09..8fb8e2507 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -162,9 +162,10 @@ pageClass: routes **类型参考这里** + | 电影 | 连续剧 | 动画 | 综艺 | 纪录片 | -\| ---- \| ------ \| ---- \| ---- \| ------ \| -| 6 | 7 | 15 | 20 | 24 | +| ---- | ------ | ---- | ---- | ------ | +| 6 | 7 | 15 | 20 | 24 | | 动作片 | 喜剧片 | 爱情片 | 科幻片 | 恐怖片 | | ------ | ------ | ------ | ------ | ------ | diff --git a/docs/support/README.md b/docs/support/README.md index d10f8f2d5..7cb20438f 100644 --- a/docs/support/README.md +++ b/docs/support/README.md @@ -14,7 +14,7 @@ RSSHub 是采用 MIT 许可的开源项目, 使用完全免费. 但是随着项 - 通过 [Patreon](https://www.patreon.com/DIYgod) 赞助 - 通过 [爱发电](https://afdian.net/@diygod) 赞助 -- 给我们发邮件联系赞助事宜: i@diygod.me +- 给我们发邮件联系赞助事宜: [i@diygod.me](mailto:i@diygod.me) ## 一次性赞助 diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 2b745003b..53936a3f9 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -109,9 +109,10 @@ Solidot 提供的 feed: | hk | tw | en | `类別` -| 新聞總集 | 兩岸國際 | 財經 | 娛樂 | 體育 | 健康 | -\| -------- \| -------- \| -------- \| ------------- \| ------ \| ------ \| -| (空) | world | business | entertainment | sports | health | + +| 新聞總集 | 兩岸國際 | 財經 | 娛樂 | 體育 | 健康 | +| -------- | -------- | -------- | ------------- | ------ | ------ | +| (空) | world | business | entertainment | sports | health |