From 6309afcccca5f22730c3271afe162ac87ea95883 Mon Sep 17 00:00:00 2001 From: Tony Date: Sun, 24 Sep 2023 15:30:16 +0000 Subject: [PATCH] docs: fix rendering (#13382) * docs: fix faq badge * docs: no md within jsx tag refs: https://docusaurus.io/docs/markdown-features/react#markdown-and-jsx-interoperability * docs: use link component * docs: route use link component * fix: remove invalid attr * docs: more a to link component * fix: remove invalid attr * fix: provide link in global scope --- website/docs/README.md | 4 +-- website/docs/faq.md | 4 ++- website/docs/joinus/new-rss/add-docs.md | 2 +- website/docs/joinus/quick-start.md | 8 +++--- website/docs/parameter.md | 8 +++--- website/docs/routes/other.md | 2 +- .../current/README.md | 4 +-- .../current/faq.md | 4 ++- .../current/joinus/quick-start.md | 6 +++-- .../current/parameter.md | 12 ++++----- website/src/components/Route.tsx | 25 ++++++++++--------- website/src/theme/MDXComponents.js | 2 ++ 12 files changed, 45 insertions(+), 36 deletions(-) diff --git a/website/docs/README.md b/website/docs/README.md index 035cc5b377..84ebf7c243 100644 --- a/website/docs/README.md +++ b/website/docs/README.md @@ -28,7 +28,7 @@ RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYg ### Special Sponsors

- +

[![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/support/) @@ -41,7 +41,7 @@ Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr) ### Backers - + ## Related Projects diff --git a/website/docs/faq.md b/website/docs/faq.md index 26332d4f81..50d7527341 100644 --- a/website/docs/faq.md +++ b/website/docs/faq.md @@ -1,12 +1,14 @@ # FAQs +import Translate from '@docusaurus/Translate'; + **Q: How does RSSHub work?** **A:** When a request is received, RSSHub fetches the corresponding data from the original site, the resulting contents will be outputted in RSS format. Caching is implemented to avoid requesting original sites for content. And of course, we throw in a little magic 🎩. **Q: Can I use the demo instance?** -**A:** [rsshub.app](https://rsshub.app) is the demo instance provided, running the latest build of RSSHub from master branch, the cache is set 120 minutes and it's free to use. However, if you see an badge for route, this means popular websites such as Facebook etc. may pose a request quota on individual IP address, which means it can get unreliable from time to time for the demo instance. You are encouraged to [host your own RSSHub instance](/install/) to get a better usability. +**A:** [rsshub.app](https://rsshub.app) is the demo instance provided, running the latest build of RSSHub from master branch, the cache is set 120 minutes and it's free to use. However, if you see an badge for route, this means popular websites such as Facebook etc. may pose a request quota on individual IP address, which means it can get unreliable from time to time for the demo instance. You are encouraged to [host your own RSSHub instance](/install/) to get a better usability. **Q: Why are images/videos not loading in some RSSHub routes?** diff --git a/website/docs/joinus/new-rss/add-docs.md b/website/docs/joinus/new-rss/add-docs.md index 0f92164ec3..1b3722fc5a 100644 --- a/website/docs/joinus/new-rss/add-docs.md +++ b/website/docs/joinus/new-rss/add-docs.md @@ -4,7 +4,7 @@ sidebar_position: 4 # Add documentation -Now that we have completed the code, it's time to add the documentation for your route. Open the appropriate file in the [document (/website/docs)](https://github.com/DIYgod/RSSHub/blob/master/website/docs), which in this example is `/website/i18n/en/docusaurus-plugin-content-docs/current/routes/programming.md`. +Now that we have completed the code, it's time to add the documentation for your route. Open the appropriate file in the [document (/website/docs)](https://github.com/DIYgod/RSSHub/blob/master/website/docs), which in this example is `website/docs/routes/programming.md`. In order to preview the documentation in real-time, you need to install the dependencies for the documentation. Run the following command in the **`website` directory**: diff --git a/website/docs/joinus/quick-start.md b/website/docs/joinus/quick-start.md index 005951b380..b51c2aae63 100644 --- a/website/docs/joinus/quick-start.md +++ b/website/docs/joinus/quick-start.md @@ -46,7 +46,7 @@ Once you have installed RSSHub Radar, open the settings and switch to the "List [Let's start!](/joinus/new-radar) -Get RSSHub Radar for Chromium -Get Get RSSHub Radar for Firefox -Get RSSHub Radar for Edge -Get RSSHub Radar for Safari +Get RSSHub Radar for Chromium +Get Get RSSHub Radar for Firefox +Get RSSHub Radar for Edge +Get RSSHub Radar for Safari diff --git a/website/docs/parameter.md b/website/docs/parameter.md index e296af19b0..c7bb426c8c 100644 --- a/website/docs/parameter.md +++ b/website/docs/parameter.md @@ -4,17 +4,17 @@ Parameters here are actually URI query and can be linked together with `&` to generate a complex feed. -Parameters here need to be placed after the route path. Some routes may have **custom route parameters** and **parameters here** need to be placed after them. +Parameters here need to be placed after the route path. Some routes may have custom route parameters and parameters here need to be placed after them. E.g. -https://rsshub.app/twitter/user/durov/readable=1&includeRts=0?brief=100&limit=5 +https://rsshub.app/twitter/user/durov/readable=1&includeRts=0?brief=100&limit=5 -If a **output format** (`.atom`, `.rss`, `.json`, `.debug.json`) is set, it needs to be placed between the route path (including **custom route parameters**) and **other parameters**. +If a output format (`.atom`, `.rss`, `.json`, `.debug.json`) is set, it needs to be placed between the route path (including custom route parameters) and other parameters. E.g. -https://rsshub.app/twitter/user/durov/readable=1&includeRts=0.atom?brief=100&limit=5 +https://rsshub.app/twitter/user/durov/readable=1&includeRts=0.atom?brief=100&limit=5 ::: diff --git a/website/docs/routes/other.md b/website/docs/routes/other.md index 9c8ae6dfb0..14943abd7a 100644 --- a/website/docs/routes/other.md +++ b/website/docs/routes/other.md @@ -354,7 +354,7 @@ For example: 1. If we want to search software engineer jobs of all levels and all job types, use `/linkedin/jobs/all/all/software engineer` 2. If we want to search all entry level contractor/part time software engineer jobs, use `/linkedin/jobs/P-C/2/software engineer` -**To make it easier, the recommended way is to start a search on LinkedIn and use RSSHub Radar to load the specific feed.** +**To make it easier, the recommended way is to start a search on [LinkedIn](https://www.linkedin.com/jobs/search) and use [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) to load the specific feed.** diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md index 0ddd6747c6..de10956f1d 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md @@ -30,7 +30,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以 ### 赞助商

- +

[![](https://opencollective.com/static/images/become_sponsor.svg)](/zh/support/) @@ -43,7 +43,7 @@ Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr) ### Backers - + ## 相关项目 diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/faq.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/faq.md index 4f60f7b042..a50108584f 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/faq.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/faq.md @@ -1,5 +1,7 @@ # 常见问题 +import Translate from '@docusaurus/Translate'; + **Q: RSS 是什么?RSS 如何使用?可以推荐一下好用的 RSS 阅读器么?** **A:** [我有特别的 RSS 使用技巧](https://diygod.cc/ohmyrss/) @@ -14,7 +16,7 @@ **Q: 演示地址可以用么?** -**A:** 演示地址为 [rsshub.app](https://rsshub.app), 缓存时间 120 分钟,可以随意使用。但如果你看到路由有 标记,如微博、知乎等,意味着目标网站有严重的反爬策略,demo 无法确保可用性,建议自建来提高稳定性。 +**A:** 演示地址为 [rsshub.app](https://rsshub.app), 缓存时间 120 分钟,可以随意使用。但如果你看到路由有 标记,如微博、知乎等,意味着目标网站有严重的反爬策略,demo 无法确保可用性,建议自建来提高稳定性。 **Q: 为什么 RSSHub 里的图片 / 视频加载不出来?** diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/joinus/quick-start.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/joinus/quick-start.md index ab5ef8ffb1..d916fb77e8 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/joinus/quick-start.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/joinus/quick-start.md @@ -2,7 +2,6 @@ sidebar_position: 1 --- - # 快速开始 如果您在使用 RSSHub 过程中遇到了问题或者有建议改进,我们很乐意听取您的意见!您可以通过 Pull Request 来提交您的修改。无论您对 Pull Request 的使用是否熟悉,我们都欢迎不同经验水平的开发者参与贡献。如果您不懂编程,也可以通过 [报告错误](https://github.com/DIYgod/RSSHub/issues) 的方式来帮助我们。 @@ -47,4 +46,7 @@ sidebar_position: 1 [开始吧!](/zh/joinus/new-radar) -为 Chromium 安装 RSSHub Radar 为 Firefox 安装 RSSHub Radar for 为 Edge 安装 RSSHub Radar 为 Safari 安装 RSSHub Radar +为 Chromium 安装 RSSHub Radar +为 Firefox 安装 RSSHub Radar for +为 Edge 安装 RSSHub Radar +为 Safari 安装 RSSHub Radar diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/parameter.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/parameter.md index a910e22c9e..f2c36ba128 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/parameter.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/parameter.md @@ -4,11 +4,11 @@ 通用参数实际上是 URI 中的 query,可以使用 `&` 连接组合使用,效果叠加。 -通用参数需要置于路由路径的最后。有些路由在路由路径(route path)的最后引入了**自定义参数**,**通用参数**也需要置于它们之后。 +通用参数需要置于路由路径的最后。有些路由在路由路径(route path)的最后引入了自定义参数,通用参数也需要置于它们之后。 举例: - + https://rsshub.app/twitter/user/durov/ readable=1&includeRts=0 @@ -17,13 +17,13 @@ https://rsshub.app/twitter/user/durov/ brief=100&limit=5 - + -如果设置了**输出格式**(`.atom`, `.rss`, `.json`, `.debug.json`),则需要置于路由路径(含**自定义参数**)与**其它通用参数**之间。 +如果设置了输出格式(`.atom`, `.rss`, `.json`, `.debug.json`),则需要置于路由路径(含自定义参数)与其它通用参数之间。 举例: - + https://rsshub.app/twitter/user/durov/ readable=1&includeRts=0 @@ -35,7 +35,7 @@ https://rsshub.app/twitter/user/durov/ brief=100&limit=5 - + ::: diff --git a/website/src/components/Route.tsx b/website/src/components/Route.tsx index 14c95691dc..2b959241f6 100644 --- a/website/src/components/Route.tsx +++ b/website/src/components/Route.tsx @@ -2,6 +2,7 @@ import React from 'react'; import MarkdownIt from 'markdown-it'; import Badge from './Badge'; import Translate from '@docusaurus/Translate'; +import Link from '@docusaurus/Link'; export default function Route({ author = 'DIYgod', @@ -50,39 +51,39 @@ export default function Route({ {supportScihub && } {puppeteer && } {anticrawler && ( - + - + )} {selfhost && ( - + - + )} {radar && ( - + - + )} {rssbud && ( - + - + )}

{author.split(' ').map((uid) => ( - + @{uid}{' '} - + ))}

- + {demoUrl} - +

{path} diff --git a/website/src/theme/MDXComponents.js b/website/src/theme/MDXComponents.js index 65aef33830..1e72aeca83 100644 --- a/website/src/theme/MDXComponents.js +++ b/website/src/theme/MDXComponents.js @@ -1,6 +1,7 @@ import MDXComponents from '@theme-original/MDXComponents'; import Badge from '@site/src/components/Badge'; import Route from '@site/src/components/Route'; +import Link from '@docusaurus/Link'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -9,6 +10,7 @@ export default { ...MDXComponents, Badge, Route, + Link, Tabs, TabItem, };