diff --git a/website/docs/guides/migrating-to-v1.md b/website/docs/guides/migrating-to-v1.md index d3380fc5..70936de8 100644 --- a/website/docs/guides/migrating-to-v1.md +++ b/website/docs/guides/migrating-to-v1.md @@ -1,5 +1,5 @@ --- -title: Migrating to V1 +title: Migrating from v0 sidebar_position: 4 --- diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index 1a616ed3..0d39cde4 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -29,6 +29,13 @@ const config: Config = { docs: { path: 'docs', routeBasePath: '/docs', + lastVersion: 'current', + versions: { + current: { + label: packageJson.version, + path: '', + }, + }, editUrl: 'https://github.com/rohit-gohri/redocusaurus/edit/main/website/', }, @@ -60,6 +67,15 @@ const config: Config = { }, ] satisfies Redocusaurus.PresetEntry, ], + i18n: { + defaultLocale: 'en', + locales: ['en', 'de','zh-Hant'], + localeConfigs: { + en: { + htmlLang: 'en-GB', + }, + }, + }, themeConfig: { navbar: { title: 'Redocusaurus', @@ -108,18 +124,14 @@ const config: Config = { ], }, { - label: `v${packageJson.version}`, + type: 'docsVersionDropdown', + position: 'right', + dropdownActiveClassDisabled: true, + // 'https://redocusaurus-v0.vercel.app/', + }, + { + type: 'localeDropdown', position: 'right', - items: [ - { - label: 'v0', - href: 'https://redocusaurus-v0.vercel.app/', - }, - { - label: 'v1 | v2', - to: '/', - }, - ], }, { href: 'https://github.com/rohit-gohri/redocusaurus', diff --git a/website/i18n/en/code.json b/website/i18n/en/code.json new file mode 100644 index 00000000..f9dc929c --- /dev/null +++ b/website/i18n/en/code.json @@ -0,0 +1,289 @@ +{ + "theme.ErrorPageContent.title": { + "message": "This page crashed.", + "description": "The title of the fallback page when the page crashed" + }, + "theme.blog.archive.title": { + "message": "Archive", + "description": "The page & hero title of the blog archive page" + }, + "theme.blog.archive.description": { + "message": "Archive", + "description": "The page & hero description of the blog archive page" + }, + "theme.blog.paginator.navAriaLabel": { + "message": "Blog list page navigation", + "description": "The ARIA label for the blog pagination" + }, + "theme.blog.paginator.newerEntries": { + "message": "Newer Entries", + "description": "The label used to navigate to the newer blog posts page (previous page)" + }, + "theme.blog.paginator.olderEntries": { + "message": "Older Entries", + "description": "The label used to navigate to the older blog posts page (next page)" + }, + "theme.BackToTopButton.buttonAriaLabel": { + "message": "Scroll back to top", + "description": "The ARIA label for the back to top button" + }, + "theme.blog.post.paginator.navAriaLabel": { + "message": "Blog post page navigation", + "description": "The ARIA label for the blog posts pagination" + }, + "theme.blog.post.paginator.newerPost": { + "message": "Newer Post", + "description": "The blog post button label to navigate to the newer/previous post" + }, + "theme.blog.post.paginator.olderPost": { + "message": "Older Post", + "description": "The blog post button label to navigate to the older/next post" + }, + "theme.blog.post.plurals": { + "message": "One post|{count} posts", + "description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.tagTitle": { + "message": "{nPosts} tagged with \"{tagName}\"", + "description": "The title of the page for a blog tag" + }, + "theme.tags.tagsPageLink": { + "message": "View All Tags", + "description": "The label of the link targeting the tag list page" + }, + "theme.colorToggle.ariaLabel": { + "message": "Switch between dark and light mode (currently {mode})", + "description": "The ARIA label for the navbar color mode toggle" + }, + "theme.colorToggle.ariaLabel.mode.dark": { + "message": "dark mode", + "description": "The name for the dark color mode" + }, + "theme.colorToggle.ariaLabel.mode.light": { + "message": "light mode", + "description": "The name for the light color mode" + }, + "theme.docs.breadcrumbs.navAriaLabel": { + "message": "Breadcrumbs", + "description": "The ARIA label for the breadcrumbs" + }, + "theme.docs.paginator.navAriaLabel": { + "message": "Docs pages", + "description": "The ARIA label for the docs pagination" + }, + "theme.docs.paginator.previous": { + "message": "Previous", + "description": "The label used to navigate to the previous doc" + }, + "theme.docs.paginator.next": { + "message": "Next", + "description": "The label used to navigate to the next doc" + }, + "theme.docs.DocCard.categoryDescription": { + "message": "{count} items", + "description": "The default description for a category card in the generated index about how many items this category includes" + }, + "theme.docs.tagDocListPageTitle.nDocsTagged": { + "message": "One doc tagged|{count} docs tagged", + "description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.tagDocListPageTitle": { + "message": "{nDocsTagged} with \"{tagName}\"", + "description": "The title of the page for a docs tag" + }, + "theme.docs.versions.unreleasedVersionLabel": { + "message": "This is unreleased documentation for {siteTitle} {versionLabel} version.", + "description": "The label used to tell the user that he's browsing an unreleased doc version" + }, + "theme.docs.versions.unmaintainedVersionLabel": { + "message": "This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.", + "description": "The label used to tell the user that he's browsing an unmaintained doc version" + }, + "theme.docs.versions.latestVersionSuggestionLabel": { + "message": "For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).", + "description": "The label used to tell the user to check the latest version" + }, + "theme.docs.versions.latestVersionLinkLabel": { + "message": "latest version", + "description": "The label used for the latest version suggestion link label" + }, + "theme.docs.versionBadge.label": { + "message": "Version: {versionLabel}" + }, + "theme.common.editThisPage": { + "message": "Edit this page", + "description": "The link label to edit the current page" + }, + "theme.common.headingLinkTitle": { + "message": "Direct link to {heading}", + "description": "Title for link to heading" + }, + "theme.lastUpdated.atDate": { + "message": " on {date}", + "description": "The words used to describe on which date a page has been last updated" + }, + "theme.lastUpdated.byUser": { + "message": " by {user}", + "description": "The words used to describe by who the page has been last updated" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "Last updated{atDate}{byUser}", + "description": "The sentence used to display when a page has been last updated, and by who" + }, + "theme.NotFound.title": { + "message": "Page Not Found", + "description": "The title of the 404 page" + }, + "theme.navbar.mobileVersionsDropdown.label": { + "message": "Versions", + "description": "The label for the navbar versions dropdown on mobile view" + }, + "theme.tags.tagsListLabel": { + "message": "Tags:", + "description": "The label alongside a tag list" + }, + "theme.admonition.caution": { + "message": "caution", + "description": "The default label used for the Caution admonition (:::caution)" + }, + "theme.admonition.danger": { + "message": "danger", + "description": "The default label used for the Danger admonition (:::danger)" + }, + "theme.admonition.info": { + "message": "info", + "description": "The default label used for the Info admonition (:::info)" + }, + "theme.admonition.note": { + "message": "note", + "description": "The default label used for the Note admonition (:::note)" + }, + "theme.admonition.tip": { + "message": "tip", + "description": "The default label used for the Tip admonition (:::tip)" + }, + "theme.admonition.warning": { + "message": "warning", + "description": "The default label used for the Warning admonition (:::warning)" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "Close", + "description": "The ARIA label for close button of announcement bar" + }, + "theme.blog.sidebar.navAriaLabel": { + "message": "Blog recent posts navigation", + "description": "The ARIA label for recent posts in the blog sidebar" + }, + "theme.CodeBlock.copied": { + "message": "Copied", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "Copy code to clipboard", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copy": { + "message": "Copy", + "description": "The copy button label on code blocks" + }, + "theme.CodeBlock.wordWrapToggle": { + "message": "Toggle word wrap", + "description": "The title attribute for toggle word wrapping button of code block lines" + }, + "theme.DocSidebarItem.expandCategoryAriaLabel": { + "message": "Expand sidebar category '{label}'", + "description": "The ARIA label to expand the sidebar category" + }, + "theme.DocSidebarItem.collapseCategoryAriaLabel": { + "message": "Collapse sidebar category '{label}'", + "description": "The ARIA label to collapse the sidebar category" + }, + "theme.NotFound.p1": { + "message": "We could not find what you were looking for.", + "description": "The first paragraph of the 404 page" + }, + "theme.NotFound.p2": { + "message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.", + "description": "The 2nd paragraph of the 404 page" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "Languages", + "description": "The label for the mobile language switcher dropdown" + }, + "theme.NavBar.navAriaLabel": { + "message": "Main", + "description": "The ARIA label for the main navigation" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "On this page", + "description": "The label used by the button on the collapsible TOC component" + }, + "theme.blog.post.readingTime.plurals": { + "message": "One min read|{readingTime} min read", + "description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.post.readMore": { + "message": "Read More", + "description": "The label used in blog post item excerpts to link to full blog posts" + }, + "theme.blog.post.readMoreLabel": { + "message": "Read more about {title}", + "description": "The ARIA label for the link to full blog posts from excerpts" + }, + "theme.docs.breadcrumbs.home": { + "message": "Home page", + "description": "The ARIA label for the home page in the breadcrumbs" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "Docs sidebar", + "description": "The ARIA label for the sidebar navigation" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.closeSidebarButtonAriaLabel": { + "message": "Close navigation bar", + "description": "The ARIA label for close button of mobile sidebar" + }, + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": { + "message": "← Back to main menu", + "description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)" + }, + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": { + "message": "Toggle navigation bar", + "description": "The ARIA label for hamburger menu button of mobile navigation" + }, + "theme.docs.sidebar.expandButtonTitle": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.docs.sidebar.expandButtonAriaLabel": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "Try again", + "description": "The label of the button to try again rendering when the React error boundary captures an error" + }, + "theme.common.skipToMainContent": { + "message": "Skip to main content", + "description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation" + }, + "theme.tags.tagsPageTitle": { + "message": "Tags", + "description": "The title of the tag list page" + }, + "theme.unlistedContent.title": { + "message": "Unlisted page", + "description": "The unlisted content banner title" + }, + "theme.unlistedContent.message": { + "message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.", + "description": "The unlisted content banner message" + } +} diff --git a/website/i18n/en/docusaurus-plugin-content-blog/options.json b/website/i18n/en/docusaurus-plugin-content-blog/options.json new file mode 100644 index 00000000..9239ff70 --- /dev/null +++ b/website/i18n/en/docusaurus-plugin-content-blog/options.json @@ -0,0 +1,14 @@ +{ + "title": { + "message": "Blog", + "description": "The title for the blog used in SEO" + }, + "description": { + "message": "Blog", + "description": "The description for the blog used in SEO" + }, + "sidebar.title": { + "message": "Recent posts", + "description": "The label for the left sidebar" + } +} diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current.json b/website/i18n/en/docusaurus-plugin-content-docs/current.json new file mode 100644 index 00000000..28e80e88 --- /dev/null +++ b/website/i18n/en/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,18 @@ +{ + "version.label": { + "message": "2.0.2", + "description": "The label for version current" + }, + "sidebar.defaultSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar defaultSidebar" + }, + "sidebar.defaultSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar defaultSidebar" + }, + "sidebar.defaultSidebar.category.Nested Docs Example": { + "message": "Nested Docs Example", + "description": "The label for category Nested Docs Example in sidebar defaultSidebar" + } +} diff --git a/website/i18n/en/docusaurus-plugin-content-docs/version-0.x.json b/website/i18n/en/docusaurus-plugin-content-docs/version-0.x.json new file mode 100644 index 00000000..1aa2402a --- /dev/null +++ b/website/i18n/en/docusaurus-plugin-content-docs/version-0.x.json @@ -0,0 +1,14 @@ +{ + "version.label": { + "message": "0.x", + "description": "The label for version 0.x" + }, + "sidebar.defaultSidebar.category.Getting Started": { + "message": "Getting Started", + "description": "The label for category Getting Started in sidebar defaultSidebar" + }, + "sidebar.defaultSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar defaultSidebar" + } +} diff --git a/website/i18n/en/docusaurus-theme-classic/footer.json b/website/i18n/en/docusaurus-theme-classic/footer.json new file mode 100644 index 00000000..22408832 --- /dev/null +++ b/website/i18n/en/docusaurus-theme-classic/footer.json @@ -0,0 +1,38 @@ +{ + "link.title.NPM Modules": { + "message": "NPM Modules", + "description": "The title of the footer links column with title=NPM Modules in the footer" + }, + "link.title.More": { + "message": "More", + "description": "The title of the footer links column with title=More in the footer" + }, + "link.item.label.Redocusaurus": { + "message": "Redocusaurus", + "description": "The label of footer link with label=Redocusaurus linking to https://www.npmjs.com/package/redocusaurus/" + }, + "link.item.label.Docusaurus Theme Redoc": { + "message": "Docusaurus Theme Redoc", + "description": "The label of footer link with label=Docusaurus Theme Redoc linking to https://www.npmjs.com/package/docusaurus-theme-redoc/" + }, + "link.item.label.Docusaurus Plugin Redoc": { + "message": "Docusaurus Plugin Redoc", + "description": "The label of footer link with label=Docusaurus Plugin Redoc linking to https://www.npmjs.com/package/docusaurus-plugin-redoc/" + }, + "link.item.label.Github": { + "message": "Github", + "description": "The label of footer link with label=Github linking to https://github.com/rohit-gohri/redocusaurus/" + }, + "link.item.label.Blog Post": { + "message": "Blog Post", + "description": "The label of footer link with label=Blog Post linking to https://rohit.page/blog/projects/openapi-for-docusaurus/" + }, + "link.item.label.Twitter Discussion": { + "message": "Twitter Discussion", + "description": "The label of footer link with label=Twitter Discussion linking to https://twitter.com/rohit_gohri/status/1351589213565644801" + }, + "copyright": { + "message": "Copyright © 2024 Rohit Gohri.
Built with Docusaurus v3.1.1.", + "description": "The footer copyright" + } +} diff --git a/website/i18n/en/docusaurus-theme-classic/navbar.json b/website/i18n/en/docusaurus-theme-classic/navbar.json new file mode 100644 index 00000000..0fc3ec16 --- /dev/null +++ b/website/i18n/en/docusaurus-theme-classic/navbar.json @@ -0,0 +1,46 @@ +{ + "title": { + "message": "Redocusaurus", + "description": "The title in the navbar" + }, + "item.label.Docs": { + "message": "Docs", + "description": "Navbar item with label Docs" + }, + "item.label.Examples": { + "message": "Examples", + "description": "Navbar item with label Examples" + }, + "item.label.All": { + "message": "All", + "description": "Navbar item with label All" + }, + "item.label.Using Single YAML": { + "message": "Using Single YAML", + "description": "Navbar item with label Using Single YAML" + }, + "item.label.Using Remote URL": { + "message": "Using Remote URL", + "description": "Navbar item with label Using Remote URL" + }, + "item.label.Using Multiple YAMLs": { + "message": "Using Multiple YAMLs", + "description": "Navbar item with label Using Multiple YAMLs" + }, + "item.label.Using Swagger": { + "message": "Using Swagger", + "description": "Navbar item with label Using Swagger" + }, + "item.label.Custom Page": { + "message": "Custom Page", + "description": "Navbar item with label Custom Page" + }, + "item.label.Custom Layout": { + "message": "Custom Layout", + "description": "Navbar item with label Custom Layout" + }, + "item.label.Client Only": { + "message": "Client Only", + "description": "Navbar item with label Client Only" + } +} diff --git a/website/i18n/zh-Hant/Introduction.md b/website/i18n/zh-Hant/Introduction.md new file mode 100644 index 00000000..858dd224 --- /dev/null +++ b/website/i18n/zh-Hant/Introduction.md @@ -0,0 +1,20 @@ +--- +slug: / +title: Introduction +sidebar_position: 0 +author: Rohit Gohri +author_url: https://rohit.page +--- + +Redocusaurus is a preset for Docusaurus to help you integrate OpenAPI documentation via [Redoc](https://github.com/redocly/redoc/). It was created to make it easy to have API docs that live with your other documentation and look and feel like a part of it. + +## Features + +- Built with 💚 and Typescript + - In built types +- Easy to setup and already themed + - Just add the preset and pass it your YAML + - Dark Mode support +- Customizable + - Change Redoc Options + - [Swizzle](https://docusaurus.io/docs/using-themes#swizzling-theme-components) components to your needs diff --git a/website/i18n/zh-Hant/changelog.mdx b/website/i18n/zh-Hant/changelog.mdx new file mode 100644 index 00000000..d57cb897 --- /dev/null +++ b/website/i18n/zh-Hant/changelog.mdx @@ -0,0 +1,8 @@ +--- +title: Changelog +sidebar_position: 10 +--- + +import Changelog from './../../CHANGELOG.md'; + + diff --git a/website/i18n/zh-Hant/code.json b/website/i18n/zh-Hant/code.json new file mode 100644 index 00000000..7b21f1e6 --- /dev/null +++ b/website/i18n/zh-Hant/code.json @@ -0,0 +1,290 @@ +{ + "theme.ErrorPageContent.title": { + "message": "此頁面崩潰了。", + "description": "當頁面崩潰時的後備頁面標題" + }, + "theme.blog.archive.title": { + "message": "存檔", + "description": "部落格存檔頁面的標題" + }, + "theme.blog.archive.description": { + "message": "存檔", + "description": "部落格存檔頁面的描述" + }, + "theme.blog.paginator.navAriaLabel": { + "message": "部落格列表頁面導航", + "description": "部落格分頁的ARIA標籤" + }, + "theme.blog.paginator.newerEntries": { + "message": "較新的文章", + "description": "用於導航到較新的部落格文章頁面的標籤(上一頁)" + }, + "theme.blog.paginator.olderEntries": { + "message": "較舊的文章", + "description": "用於導航到較舊的部落格文章頁面的標籤(下一頁)" + }, + "theme.BackToTopButton.buttonAriaLabel": { + "message": "滾動回到頂部", + "description": "返回頂部按鈕的ARIA標籤" + }, + "theme.blog.post.paginator.navAriaLabel": { + "message": "部落格文章頁面導航", + "description": "部落格文章分頁的ARIA標籤" + }, + "theme.blog.post.paginator.newerPost": { + "message": "較新的文章", + "description": "導航到較新/上一篇文章的按鈕標籤" + }, + "theme.blog.post.paginator.olderPost": { + "message": "較舊的文章", + "description": "導航到較舊/下一篇文章的按鈕標籤" + }, + "theme.blog.post.plurals": { + "message": "一篇文章|{count}篇文章", + "description": "“{count}篇文章”的複數形式標籤。根據語言支援的複數形式(使用“|”分隔)" + }, + "theme.blog.tagTitle": { + "message": "{nPosts} 篇標籤為 \"{tagName}\" 的文章", + "description": "部落格標籤頁面的標題" + }, + "theme.tags.tagsPageLink": { + "message": "查看所有標籤", + "description": "標籤列表頁面的鏈接標籤" + }, + "theme.colorToggle.ariaLabel": { + "message": "切換暗黑模式和亮模式(當前為{mode})", + "description": "導航欄顏色模式切換的ARIA標籤" + }, + "theme.colorToggle.ariaLabel.mode.dark": { + "message": "暗黑模式", + "description": "暗黑模式的名稱" + }, + "theme.colorToggle.ariaLabel.mode.light": { + "message": "亮模式", + "description": "亮模式的名稱" + }, + "theme.docs.breadcrumbs.navAriaLabel": { + "message": "麵包屑", + "description": "麵包屑的ARIA標籤" + }, + "theme.docs.paginator.navAriaLabel": { + "message": "文檔頁面", + "description": "文檔分頁的ARIA標籤" + }, + "theme.docs.paginator.previous": { + "message": "上一頁", + "description": "導航到上一個文檔的標籤" + }, + "theme.docs.paginator.next": { + "message": "下一頁", + "description": "導航到下一個文檔的標籤" + }, + "theme.docs.DocCard.categoryDescription": { + "message": "{count} 項目", + "description": "分類卡的默認描述,用於說明此類別包含多少項目" + }, + "theme.docs.tagDocListPageTitle.nDocsTagged": { + "message": "一個標籤的文檔|{count} 個標籤的文檔", + "description": "“{count} 個標籤的文檔”的複數形式標籤" + }, + "theme.docs.tagDocListPageTitle": { + "message": "{nDocsTagged} 篇標籤為 \"{tagName}\" 的文檔", + "description": "文檔標籤頁面的標題" + }, + "theme.docs.versions.unreleasedVersionLabel": { + "message": "這是 {siteTitle} {versionLabel} 版本的未發布文檔。", + "description": "用於告知用戶他正在瀏覽未發布版本文檔的標籤" + }, + "theme.docs.versions.unmaintainedVersionLabel": { + "message": "這是 {siteTitle} {versionLabel} 版本的文檔,此版本不再維護。", + "description": "用於告知用戶他正在瀏覽不再維護的文檔版本的標籤" + }, + "theme.docs.versions.latestVersionSuggestionLabel": { + "message": "有關最新的文檔,請參閱 {latestVersionLink} ({versionLabel})。", + "description": "用於告知用戶查看最新版本的標籤" + }, + "theme.docs.versions.latestVersionLinkLabel": { + "message": "最新版本", + "description": "最新版本建議鏈接標籤" + }, + "theme.docs.versionBadge.label": { + "message": "版本:{versionLabel}" + }, + "theme.common.editThisPage": { + "message": "編輯此頁面", + "description": "編輯當前頁面的鏈接標籤" + }, + "theme.common.headingLinkTitle": { + "message": "直接鏈接到 {heading}", + "description": "標題的鏈接標題" + }, + "theme.lastUpdated.atDate": { + "message": "於 {date}", + "description": "用於描述頁面最後更新日期的文字" + }, + "theme.lastUpdated.byUser": { + "message": "由 {user}", + "description": "用於描述頁面最後更新者的文字" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "最後更新於{atDate}{byUser}", + "description": "用於顯示頁面最後更新時間和更新者的句子" + }, + "theme.NotFound.title": { + "message": "頁面未找到", + "description": "404頁面的標題" + }, + "theme.navbar.mobileVersionsDropdown.label": { + "message": "版本", + "description": "移動視圖中導航欄版本下拉列表的標籤" + }, + "theme.tags.tagsListLabel": { + "message": "標籤:", + "description": "標籤列表旁的標籤" + }, + "theme.admonition.caution": { + "message": "注意", + "description": "注意提示的默認標籤(:::caution)" + }, + "theme.admonition.danger": { + "message": "危險", + "description": "危險提示的默認標籤(:::danger)" + }, + "theme.admonition.info": { + "message": "信息", + "description": "信息提示的默認標籤(:::info)" + }, + "theme.admonition.note": { + "message": "筆記", + "description": "筆記提示的默認標籤(:::note)" + }, + "theme.admonition.tip": { + "message": "提示", + "description": "提示提示的默認標籤(:::tip)" + }, + "theme.admonition.warning": { + "message": "警告", + "description": "警告提示的默認標籤(:::warning)" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "關閉", + "description": "公告欄關閉按鈕的ARIA標籤" + }, + "theme.blog.sidebar.navAriaLabel": { + "message": "部落格最近文章導航", + "description": "部落格側邊欄最近文章的ARIA標籤" + }, + "theme.CodeBlock.copied": { + "message": "已複製", + "description": "代碼塊上複製按鈕的標籤" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "複製代碼到剪貼板", + "description": "複製代碼塊按鈕的ARIA標籤" + }, + "theme.CodeBlock.copy": { + "message": "複製", + "description": "代碼塊上複製按鈕的標籤" + }, + + "theme.CodeBlock.wordWrapToggle": { + "message": "切換自動換行", + "description": "代碼塊行自動換行按鈕的標題屬性" + }, + "theme.DocSidebarItem.expandCategoryAriaLabel": { + "message": "展開側邊欄分類 '{label}'", + "description": "展開側邊欄分類的ARIA標籤" + }, + "theme.DocSidebarItem.collapseCategoryAriaLabel": { + "message": "折疊側邊欄分類 '{label}'", + "description": "折疊側邊欄分類的ARIA標籤" + }, + "theme.NotFound.p1": { + "message": "我們找不到您要找的內容。", + "description": "404頁面的第一段" + }, + "theme.NotFound.p2": { + "message": "請聯絡將您鏈接到原始URL的網站所有者,並告知他們鏈接已斷開。", + "description": "404頁面的第二段" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "語言", + "description": "移動視圖中語言切換下拉列表的標籤" + }, + "theme.NavBar.navAriaLabel": { + "message": "主導航", + "description": "主導航的ARIA標籤" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "本頁內容", + "description": "可折疊目錄組件上的按鈕標籤" + }, + "theme.blog.post.readingTime.plurals": { + "message": "閱讀時間一分鐘|閱讀時間 {readingTime} 分鐘", + "description": "“閱讀時間 {readingTime} 分鐘”的複數形式標籤" + }, + "theme.blog.post.readMore": { + "message": "閱讀更多", + "description": "用於部落格文章摘錄中鏈接到完整部落格文章的標籤" + }, + "theme.blog.post.readMoreLabel": { + "message": "閱讀更多關於 {title}", + "description": "從摘錄中鏈接到完整部落格文章的ARIA標籤" + }, + "theme.docs.breadcrumbs.home": { + "message": "首頁", + "description": "麵包屑中首頁的ARIA標籤" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "文檔側邊欄", + "description": "側邊欄導航的ARIA標籤" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "折疊側邊欄", + "description": "文檔側邊欄折疊按鈕的標題屬性" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "折疊側邊欄", + "description": "文檔側邊欄折疊按鈕的ARIA標籤" + }, + "theme.docs.sidebar.closeSidebarButtonAriaLabel": { + "message": "關閉導航欄", + "description": "移動側邊欄關閉按鈕的ARIA標籤" + }, + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": { + "message": "← 返回主菜單", + "description": "返回主菜單的標籤,用於移動導航欄側邊欄二級菜單(主要用於顯示文檔側邊欄)" + }, + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": { + "message": "切換導航欄", + "description": "移動導航的ARIA標籤" + }, + "theme.docs.sidebar.expandButtonTitle": { + "message": "展開側邊欄", + "description": "文檔側邊欄展開按鈕的標題屬性" + }, + "theme.docs.sidebar.expandButtonAriaLabel": { + "message": "展開側邊欄", + "description": "文檔側邊欄展開按鈕的ARIA標籤" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "再試一次", + "description": "當React錯誤邊界捕捉到錯誤時,嘗試重新渲染的按鈕標籤" + }, + "theme.common.skipToMainContent": { + "message": "跳到主要內容", + "description": "用於無障礙功能的跳到內容標籤,允許使用鍵盤Tab/Enter導航快速跳到主要內容" + }, + "theme.tags.tagsPageTitle": { + "message": "標籤", + "description": "標籤列表頁面的標題" + }, + "theme.unlistedContent.title": { + "message": "未列出的頁面", + "description": "未列出的內容橫幅標題" + }, + "theme.unlistedContent.message": { + "message": "此頁面未列出。搜索引擎不會索引它,只有擁有直接鏈接的用戶才能訪問它。", + "description": "未列出的內容橫幅消息" + } +} diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-blog/options.json b/website/i18n/zh-Hant/docusaurus-plugin-content-blog/options.json new file mode 100644 index 00000000..61e77500 --- /dev/null +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-blog/options.json @@ -0,0 +1,14 @@ +{ + "title": { + "message": "部落格", + "description": "The title for the blog used in SEO" + }, + "description": { + "message": "部落格", + "description": "The description for the blog used in SEO" + }, + "sidebar.title": { + "message": "近期文章", + "description": "The label for the left sidebar" + } +} diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current.json b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current.json new file mode 100644 index 00000000..ca1dc834 --- /dev/null +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,18 @@ +{ + "version.label": { + "message": "2.0.2", + "description": "當前版本的標籤" + }, + "sidebar.defaultSidebar.category.Getting Started": { + "message": "入門指南", + "description": "側邊欄 defaultSidebar 中類別「入門指南」的標籤" + }, + "sidebar.defaultSidebar.category.Guides": { + "message": "指南", + "description": "側邊欄 defaultSidebar 中類別「指南」的標籤" + }, + "sidebar.defaultSidebar.category.Nested Docs Example": { + "message": "嵌套文檔範例", + "description": "側邊欄 defaultSidebar 中類別「嵌套文檔範例」的標籤" + } +} diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.x.json b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.x.json new file mode 100644 index 00000000..a184d8c1 --- /dev/null +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.x.json @@ -0,0 +1,14 @@ +{ + "version.label": { + "message": "0.x", + "description": "版本 0.x 的標籤" + }, + "sidebar.defaultSidebar.category.Getting Started": { + "message": "入門指南", + "description": "側邊欄 defaultSidebar 中類別「入門指南」的標籤" + }, + "sidebar.defaultSidebar.category.Guides": { + "message": "指南", + "description": "側邊欄 defaultSidebar 中類別「指南」的標籤" + } +} diff --git a/website/i18n/zh-Hant/docusaurus-theme-classic/footer.json b/website/i18n/zh-Hant/docusaurus-theme-classic/footer.json new file mode 100644 index 00000000..4b30c57a --- /dev/null +++ b/website/i18n/zh-Hant/docusaurus-theme-classic/footer.json @@ -0,0 +1,38 @@ +{ + "link.title.NPM Modules": { + "message": "NPM 模組", + "description": "頁腳中標題為 NPM 模組的連結欄位標題" + }, + "link.title.More": { + "message": "更多", + "description": "頁腳中標題為更多的連結欄位標題" + }, + "link.item.label.Redocusaurus": { + "message": "Redocusaurus", + "description": "頁腳連結的標籤為 Redocusaurus,連結到 https://www.npmjs.com/package/redocusaurus/" + }, + "link.item.label.Docusaurus Theme Redoc": { + "message": "Docusaurus 主題 Redoc", + "description": "頁腳連結的標籤為 Docusaurus 主題 Redoc,連結到 https://www.npmjs.com/package/docusaurus-theme-redoc/" + }, + "link.item.label.Docusaurus Plugin Redoc": { + "message": "Docusaurus 插件 Redoc", + "description": "頁腳連結的標籤為 Docusaurus 插件 Redoc,連結到 https://www.npmjs.com/package/docusaurus-plugin-redoc/" + }, + "link.item.label.Github": { + "message": "Github", + "description": "頁腳連結的標籤為 Github,連結到 https://github.com/rohit-gohri/redocusaurus/" + }, + "link.item.label.Blog Post": { + "message": "部落格文章", + "description": "頁腳連結的標籤為部落格文章,連結到 https://rohit.page/blog/projects/openapi-for-docusaurus/" + }, + "link.item.label.Twitter Discussion": { + "message": "Twitter 討論", + "description": "頁腳連結的標籤為 Twitter 討論,連結到 https://twitter.com/rohit_gohri/status/1351589213565644801" + }, + "copyright": { + "message": "版權所有 © 2024 Rohit Gohri.
Docusaurus v3.1.1 構建。", + "description": "頁腳版權聲明" + } +} diff --git a/website/i18n/zh-Hant/docusaurus-theme-classic/navbar.json b/website/i18n/zh-Hant/docusaurus-theme-classic/navbar.json new file mode 100644 index 00000000..507857aa --- /dev/null +++ b/website/i18n/zh-Hant/docusaurus-theme-classic/navbar.json @@ -0,0 +1,46 @@ +{ + "title": { + "message": "Redocusaurus", + "description": "導航列中的標題" + }, + "item.label.Docs": { + "message": "文件", + "description": "導航列項目,標籤為文件" + }, + "item.label.Examples": { + "message": "範例", + "description": "導航列項目,標籤為範例" + }, + "item.label.All": { + "message": "全部", + "description": "導航列項目,標籤為全部" + }, + "item.label.Using Single YAML": { + "message": "使用單一 YAML", + "description": "導航列項目,標籤為使用單一 YAML" + }, + "item.label.Using Remote URL": { + "message": "使用遠端 URL", + "description": "導航列項目,標籤為使用遠端 URL" + }, + "item.label.Using Multiple YAMLs": { + "message": "使用多個 YAML", + "description": "導航列項目,標籤為使用多個 YAML" + }, + "item.label.Using Swagger": { + "message": "使用 Swagger", + "description": "導航列項目,標籤為使用 Swagger" + }, + "item.label.Custom Page": { + "message": "自訂頁面", + "description": "導航列項目,標籤為自訂頁面" + }, + "item.label.Custom Layout": { + "message": "自訂佈局", + "description": "導航列項目,標籤為自訂佈局" + }, + "item.label.Client Only": { + "message": "僅客戶端", + "description": "導航列項目,標籤為僅客戶端" + } +} diff --git a/website/i18n/zh-Hant/getting-started/Installation.md b/website/i18n/zh-Hant/getting-started/Installation.md new file mode 100644 index 00000000..0830a1ad --- /dev/null +++ b/website/i18n/zh-Hant/getting-started/Installation.md @@ -0,0 +1,106 @@ +--- +title: 安裝 +sidebar_position: 0 +author: Rohit Gohri +author_url: https://rohit.page +--- + +1. 設置 [docusaurus 專案](https://docusaurus.io/docs/installation) + +1. 安裝 redocusaurus: + + ![npm](https://img.shields.io/npm/v/redocusaurus?style=flat-square) + + ```sh + yarn add redocusaurus + # 或 + pnpm add redocusaurus + # 或 + npm i --save redocusaurus + ``` + +1. 在 docusaurus 配置中添加它作為預設,並與 [@docusaurus/preset-classic](https://docusaurus.io/docs/using-plugins#docusauruspreset-classic) 一起傳遞選項: + + ```js + // docusaurus.config.ts + import type { Config } from '@docusaurus/types'; + import type * as Preset from '@docusaurus/preset-classic'; + import type * as Redocusaurus from 'redocusaurus'; + + const config: Config = { + // ... + presets: [ + // .. 其他預設的配置 + [ + '@docusaurus/preset-classic', + { + googleAnalytics: { + trackingID: 'XXXXXX', + }, + } satisfies Preset.Options, + ] + // Redocusaurus 配置 + [ + 'redocusaurus', + { + // 用於加載 OpenAPI 文件的插件選項 + specs: [ + // 提供本地 OpenAPI YAML 文件的路徑 + { + // Redocusaurus 將自動在構建過程中將您的 spec 打包成單個文件 + spec: 'openapi/index.yaml', + route: '/api/', + }, + // 您也可以提供 OpenAPI spec URL + { + spec: 'https://redocly.github.io/redoc/openapi.yaml', + route: '/openapi/', + }, + ], + // 修改 Redoc 渲染樣式的主題選項 + theme: { + // 使用您的網站顏色進行更改 + primaryColor: '#1890ff', + }, + }, + ] satisfies Redocusaurus.PresetEntry, + ], + // ... 其餘配置 + }; + + export default config; + ``` + +API 文檔將根據 `route` 指定的路徑提供。如果不設置 `route` 屬性,可以跳過添加路由。 +您仍然可以使用 [Schema Imports](/docs/guides/schema-imports) 手動引用 schema 元素,或使用數據和主題組件創建自定義 React 頁面。 +如果您有 [`redocly.yaml`](https://redocly.com/docs/cli/configuration/),它將自動加載。 + +## 選項 + +### specs + +一個 **數組** 的插件選項,詳細見 [插件選項](./plugin-options.md)。 + +### theme + +傳遞選項以自定義主題,詳細見 [主題選項](./theme-options.md)。 + +### config (可選) + +> 類型:字符串 + +Redocly 配置,用於打包文件並提供選項。如果未提供自定義路徑,它將嘗試從專案根目錄加載 `redocly.yaml` 文件(如果存在)。 + +範例:[redocly.yaml](https://github.com/rohit-gohri/redocusaurus/blob/main/website/redocly.yaml) +參考:[https://redocly.com/docs/cli/configuration/](https://redocly.com/docs/cli/configuration/)。僅支持標記為“支持於 Redoc CE”的選項。 + +:::important +設置 `redocly.yaml` 配置時,網站僅在使用以下命令構建並運行後才能正確渲染: + +```bash +npm run build +npm run serve +``` + +在本地運行網站時,使用 `npm start` 可能會顯示一些錯誤消息。 +::: diff --git a/website/i18n/zh-Hant/getting-started/_category_.yaml b/website/i18n/zh-Hant/getting-started/_category_.yaml new file mode 100644 index 00000000..4ef97c14 --- /dev/null +++ b/website/i18n/zh-Hant/getting-started/_category_.yaml @@ -0,0 +1,2 @@ +label: '入門' +position: 1 diff --git a/website/i18n/zh-Hant/getting-started/plugin-options.md b/website/i18n/zh-Hant/getting-started/plugin-options.md new file mode 100644 index 00000000..893f3215 --- /dev/null +++ b/website/i18n/zh-Hant/getting-started/plugin-options.md @@ -0,0 +1,30 @@ +--- +title: 插件選項 +sidebar_position: 1 +author: Rohit Gohri +author_url: https://rohit.page +--- + +### spec (必需,字符串:文件路徑或遠程絕對 URL) + +指定 OpenAPI YAML/JSON 文件的文件路徑或在某些網站上托管的 URL(不是同一個 docusaurus 網站)。在構建時會被 **解析** 並轉發給 Redoc 組件。我們還會自動生成一個可下載的單一 YAML 文件,並將其添加為靜態資產,以用作下載 URL。 + +### route (可選,字符串:相對 URI) + +文檔可用的路由 URL,這將使用 `docusaurus-theme-redoc` 中的主題組件 `@theme/ApiDoc` 來渲染頁面。您也可以跳過此選項,使用自定義頁面按您的需求渲染文檔。 + +### url (可選,字符串:下載 URL) + +指向 OpenAPI 規範的 URL。這將用作下載 URL,並且規範將用於渲染。這可能是必要的,因為默認情況下下載 URL 將指向由 redocusaurus 生成的處理和解析文件。 + +### layout (可選,對象:layoutProps) + +傳遞作為布局屬性的對象。對於設置頁面的標題/描述非常有用。所有可用屬性請參見 [這裡](https://github.com/rohit-gohri/redocusaurus/blob/main/packages/docusaurus-plugin-redoc/src/options.ts#L3)。 + +### config (可選) + +:::warning +已棄用:使用 `redocly.yaml` 來指定主題。參見 [範例](https://github.com/rohit-gohri/redocusaurus/blob/main/website/redocly.yaml)。 +::: + +與 [根選項](./Installation.md#config-optional) 中的 config 選項相同,但專門用於加載數據。 diff --git a/website/i18n/zh-Hant/getting-started/theme-options.md b/website/i18n/zh-Hant/getting-started/theme-options.md new file mode 100644 index 00000000..48dbb828 --- /dev/null +++ b/website/i18n/zh-Hant/getting-started/theme-options.md @@ -0,0 +1,42 @@ +--- +title: 主題配置 +sidebar_position: 2 +author: Rohit Gohri +author_url: https://rohit.page +--- + +### primaryColor (字符串,十六進制/rgba 值) + +方便提供 Redoc 使用的高亮顏色。 +此值將用作 `themes` 選項中的 `colors.primary.main`。必須是實際的顏色值,而不是 CSS 變數。 + +### primaryColorDark (字符串,十六進制/rgba 值) + +可選的方式來更改 Redoc 在暗模式下使用的高亮顏色。如果未設置,默認為 `primaryColor`。 +此值將用作 `themes` 選項中的 `colors.primary.main`。必須是實際的顏色值,而不是 CSS 變數。 + +### theme (可選,對象) + +:::warning +已棄用:使用 `redocly.yaml` 來指定主題。參見 [範例](https://github.com/rohit-gohri/redocusaurus/blob/main/website/redocly.yaml)。 +::: + +覆蓋傳遞給 Redoc 的 Redoc 主題對象。默認值請參見 [這裡](https://github.com/Redocly/redoc#redoc-theme-object)。 + +:::warning +注意:您不應該使用此屬性覆蓋任何顏色,因為這將是暗模式和亮模式中相同的值。 +::: + +### options (可選,對象) + +:::warning +已棄用:使用 `redocly.yaml` 來指定 `theme.options`。參見 [範例](https://github.com/rohit-gohri/redocusaurus/blob/main/website/redocly.yaml)。 +::: + +覆蓋傳遞給 [RedocStandalone](https://redoc.ly/docs/redoc/quickstart/react/) 組件的 Redoc 選項。默認值請參見 [這裡](https://github.com/rohit-gohri/redocusaurus/blob/main/packages/docusaurus-theme-redoc/src/redocData.ts#L5-L12)。 + +可用的屬性 [在這裡](https://redocly.com/docs/api-reference-docs/configuration/functionality/#featuresopenapi-schema)。 + +您不能使用此屬性設置主題屬性,請使用上述 `theme` 選項代替。 + +如果存在,將自動從 `redocly.yaml` 加載。 diff --git a/website/i18n/zh-Hant/guides/_category_.yaml b/website/i18n/zh-Hant/guides/_category_.yaml new file mode 100644 index 00000000..a022361a --- /dev/null +++ b/website/i18n/zh-Hant/guides/_category_.yaml @@ -0,0 +1,2 @@ +label: '教學' +position: 2 diff --git a/website/i18n/zh-Hant/guides/build-time-rendering.md b/website/i18n/zh-Hant/guides/build-time-rendering.md new file mode 100644 index 00000000..967a2058 --- /dev/null +++ b/website/i18n/zh-Hant/guides/build-time-rendering.md @@ -0,0 +1,17 @@ +--- +title: 構建時渲染 +description: 在構建時解析 OpenAPI schema,並跳過加載畫面 +sidebar_position: 3 +--- + +:::warning +**注意:** 這現在對所有人默認啟用。請 [在這裡提供您的反饋](https://github.com/rohit-gohri/redocusaurus/discussions/88)。 +::: + +## 前置條件 + +用戶無需進行任何操作。該包使用自定義的 webpack 配置來服務器渲染 Redoc 並在構建時添加相關的樣式表。 + +## 試用 + +禁用瀏覽器中的 JavaScript,然後打開其中一個示例頁面 ⚡️ diff --git a/website/i18n/zh-Hant/guides/migrating-to-v1.md b/website/i18n/zh-Hant/guides/migrating-to-v1.md new file mode 100644 index 00000000..62e4f2e3 --- /dev/null +++ b/website/i18n/zh-Hant/guides/migrating-to-v1.md @@ -0,0 +1,51 @@ +--- +title: 從 v0 升級 +sidebar_position: 4 +--- + +## 選項變更 + +1. `spec` - 現在可以是本地文件的路徑或絕對 URL。您現在也可以指向多文件 OpenAPI 定義的入口點,我們將為您打包。 + +1. `routePath` -> `route`(可選) - 現在仍然有效,但現在是可選的。 + +1. `redocOptions` -> `options`(可選) - 我們已經刪除了一些默認值(`downloadUrl` 曾經默認隱藏),現在將自定義留給用戶。 + +## 已移除的選項 + +1. `specUrl` - 根據傳遞的 spec 類型,現在由包自動處理。我們將把您的定義打包成單個可下載的 YAML,並在構建時將其作為靜態資產添加。 + +1. `addRoute` - 現在不再需要,因為 `route` 現在是可選的,因此如果不需要路由,請不要傳遞它。 + +1. `apiDocComponent` - 現在不再需要,因為我們提供了一個 react-hook `useSpecData` 來加載插件數據,可以與 `@theme/Redoc` 組件一起使用。 + +## 組件變更 + +### 已移除實驗性 `@theme/ServerStyle` + +現在,構建時/服務器端渲染對所有人默認有效,無需進行任何操作。 + +### `@theme/Redoc` 和 `@theme/ApiDoc` prop 變更 + +我們現在提供了一個新的 hook `@theme/useSpecData` 來加載 YAML 文件,您可以直接將結果傳遞給 `@theme/Redoc`,而無需自己解析 API 文件。 + +```jsx +import React from 'react'; +import Layout from '@theme/Layout'; +import Redoc from '@theme/Redoc'; +import useSpecData from '@theme/useSpecData'; + +function CustomPage() { + const specData = useSpecData('using-custom-layout'); + return ( + + + + ); +} + +export default CustomPage; +``` diff --git a/website/i18n/zh-Hant/guides/multiple-apis.md b/website/i18n/zh-Hant/guides/multiple-apis.md new file mode 100644 index 00000000..7e965d1e --- /dev/null +++ b/website/i18n/zh-Hant/guides/multiple-apis.md @@ -0,0 +1,25 @@ +--- +title: 顯示多個 API +sidebar_position: 2 +--- + +## 使用 MDX 的嵌套視圖 + +要使用 Docusaurus 側邊欄導航顯示多個 API 文檔,您可以使用 MDX 組件 `@theme/ApiDocMdx`,並為文件設置 `hide_table_of_contents`。有關示例,請參見側邊欄中的「嵌套文檔示例」部分。 + +```mdx +--- +title: API 1 - Swagger Petstore +hide_table_of_contents: true +--- + +import ApiDocMdx from '@theme/ApiDocMdx'; + + +``` + +上述內容的輸出可以在這裡查看:[嵌套 API 1](/docs/nested/nested-1)。 + +## 在下拉菜單中包含完整頁面連結 + +對於更簡單的解決方案,只需將所有路由添加到 Navbar 下拉菜單中(請參見 [文檔](https://docusaurus.io/docs/api/themes/configuration#navbar-dropdown))。這就是本網站「示例」部分的結構方式。 diff --git a/website/i18n/zh-Hant/guides/schema-imports.mdx b/website/i18n/zh-Hant/guides/schema-imports.mdx new file mode 100644 index 00000000..915bf09e --- /dev/null +++ b/website/i18n/zh-Hant/guides/schema-imports.mdx @@ -0,0 +1,94 @@ +--- +title: Schema 匯入 +sidebar_position: 1 +--- + +import ApiSchema from '@theme/ApiSchema'; + +# Schema 匯入 + +您可以從 API schema 中匯入模型定義並在 Docusaurus 文檔中渲染它們。您需要創建一個 `.mdx` 文件並導入 React 組件。更多信息請參見 [Docusaurus 中的 MDX](https://docusaurus.io/docs/markdown-features/react)。 + +# 在文檔中匯入 Schema 模型 + +`pointer` prop 傳遞給 [Redoc](https://redoc.ly/docs/resources/ref-guide/#pointer)。 + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +``` + +### 結果 + + + +## 在文檔中匯入 Schema 模型(含範例) + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +``` + +### 結果 + + + +## 匯入多個 OpenAPI schema 的 Schema 模型 + +如果您已經使用 redocusaurus 載入了多個 API,則建議在配置中添加 `id`,以便在載入 schema 模型時可以引用它們。 + +```js title="docusaurus.config.js" +const config = { + presets: [ + '@docusaurus/preset-classic', + [ + 'redocusaurus', + { + specs: [ + { + id: 'using-single-yaml', + spec: 'openapi/single-file/openapi.yaml', + route: '/examples/using-single-yaml/', + }, + { + id: 'using-remote-url', + spec: 'https://redocly.github.io/redoc/openapi.yaml', + route: '/examples/using-remote-url/', + }, + ], + theme: { + /** + * 文檔的高亮顏色 + */ + primaryColor: '#1890ff', + /** + * 傳遞給 redoc 的選項 + * @see https://github.com/redocly/redoc#redoc-options-object + */ + options: { disableSearch: true }, + }, + }, + ], + ], + title: 'Redocusaurus', +}; +``` + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +; +``` + +### 結果 + +#### 對於 ID `id="using-single-yaml"` + + + +#### 對於 ID `id="using-remote-url"` + + diff --git a/website/i18n/zh-Hant/nested/_category_.yaml b/website/i18n/zh-Hant/nested/_category_.yaml new file mode 100644 index 00000000..dc0746dd --- /dev/null +++ b/website/i18n/zh-Hant/nested/_category_.yaml @@ -0,0 +1,2 @@ +label: '巢狀文檔範例' +position: 8 diff --git a/website/i18n/zh-Hant/nested/nested-1.mdx b/website/i18n/zh-Hant/nested/nested-1.mdx new file mode 100644 index 00000000..9389550f --- /dev/null +++ b/website/i18n/zh-Hant/nested/nested-1.mdx @@ -0,0 +1,8 @@ +--- +title: API 1 - Swagger Petstore +hide_table_of_contents: true +--- + +import ApiDocMdx from '@theme/ApiDocMdx'; + + diff --git a/website/i18n/zh-Hant/nested/nested-2.mdx b/website/i18n/zh-Hant/nested/nested-2.mdx new file mode 100644 index 00000000..0d6becbe --- /dev/null +++ b/website/i18n/zh-Hant/nested/nested-2.mdx @@ -0,0 +1,8 @@ +--- +title: API 2 - Swagger Petstore +hide_table_of_contents: true +--- + +import ApiDocMdx from '@theme/ApiDocMdx'; + + diff --git a/website/i18n/zh-Hant/who-is-using-redocusaurus.md b/website/i18n/zh-Hant/who-is-using-redocusaurus.md new file mode 100644 index 00000000..88041d0e --- /dev/null +++ b/website/i18n/zh-Hant/who-is-using-redocusaurus.md @@ -0,0 +1,15 @@ +--- +slug: /who-is-using-redocusaurus +title: 誰在使用 Redocusaurus? +sidebar_position: 9 +--- + +歡迎您通過發送 Pull Request 來添加您的網站!(按字母順序排序) + +- [ChatKitty API 文檔](https://chatkitty.com/docs/rest/reference) +- [Facturapi API 文檔](https://docs.facturapi.io/api) +- [Forem API 文檔](https://developers.forem.com/api) +- [Modrinth API 文檔](https://docs.modrinth.com) +- [Quaderno API](https://developers.quaderno.io/api) +- [Regards OSS](http://regardsoss.github.io/) - [示例](http://regardsoss.github.io/docs/development/backend/services/catalog/api-swagger) +- [Wechaty OpenAPI](https://wechaty.js.org/docs/openapi/) diff --git a/website/versioned_docs/version-0.x/Introduction.md b/website/versioned_docs/version-0.x/Introduction.md new file mode 100644 index 00000000..858dd224 --- /dev/null +++ b/website/versioned_docs/version-0.x/Introduction.md @@ -0,0 +1,20 @@ +--- +slug: / +title: Introduction +sidebar_position: 0 +author: Rohit Gohri +author_url: https://rohit.page +--- + +Redocusaurus is a preset for Docusaurus to help you integrate OpenAPI documentation via [Redoc](https://github.com/redocly/redoc/). It was created to make it easy to have API docs that live with your other documentation and look and feel like a part of it. + +## Features + +- Built with 💚 and Typescript + - In built types +- Easy to setup and already themed + - Just add the preset and pass it your YAML + - Dark Mode support +- Customizable + - Change Redoc Options + - [Swizzle](https://docusaurus.io/docs/using-themes#swizzling-theme-components) components to your needs diff --git a/website/versioned_docs/version-0.x/getting-started/Installation.md b/website/versioned_docs/version-0.x/getting-started/Installation.md new file mode 100644 index 00000000..8f82c79a --- /dev/null +++ b/website/versioned_docs/version-0.x/getting-started/Installation.md @@ -0,0 +1,101 @@ +--- +title: Installation +sidebar_position: 0 +author: Rohit Gohri +author_url: https://rohit.page +--- + +1. Install redocusaurus: + +![npm](https://img.shields.io/npm/v/redocusaurus?style=flat-square) + +```sh +npm i --save redocusaurus +``` + +1. Add it as a preset to your docusaurus config and pass options: + + - Pass it a OpenAPI spec URL + + ```js + // docusaurus.config.js + + module.exports = { + // ... + presets: [ + [ + 'redocusaurus', + { + specs: [ + { + specUrl: 'https://redocly.github.io/redoc/openapi.yaml', + }, + ], + }, + ], + ], + // ... + }; + ``` + + - Pass it a OpenAPI spec local path + + ```js + // docusaurus.config.js + + module.exports = { + // ... + presets: [ + [ + 'redocusaurus', + { + specs: [ + { + spec: 'openapi.yaml', + }, + ], + }, + ], + ], + // ... + }; + ``` + +The API Doc will be available by default at `/api/` path. If you wish to +override this path, you may set the `routePath` option. To skip adding a +route altogether, set the `addRoute` option to false. You will still be +able to reference schema elements manually using [Schema Imports](/docs/guides/schema-imports). + +```js +// docusaurus.config.js + +module.exports = { + // ... + presets: [ + [ + 'redocusaurus', + { + specs: [ + { + id: 'default-route', + // routePath: '/api/', + // addRoute: true, + }, + { + id: 'route-overridden', + routePath: '/different-path/', + // addRoute: true, + }, + { + id: 'no-route', + addRoute: false, + }, + ], + }, + ], + ], + // ... +}; +``` + +To customize it see [full plugin options](#options). diff --git a/website/versioned_docs/version-0.x/getting-started/_category_.yaml b/website/versioned_docs/version-0.x/getting-started/_category_.yaml new file mode 100644 index 00000000..73584564 --- /dev/null +++ b/website/versioned_docs/version-0.x/getting-started/_category_.yaml @@ -0,0 +1,2 @@ +label: 'Getting Started' +position: 1 diff --git a/website/versioned_docs/version-0.x/guides/_category_.yaml b/website/versioned_docs/version-0.x/guides/_category_.yaml new file mode 100644 index 00000000..b8e18877 --- /dev/null +++ b/website/versioned_docs/version-0.x/guides/_category_.yaml @@ -0,0 +1,2 @@ +label: 'Guides' +position: 2 diff --git a/website/versioned_docs/version-0.x/guides/schema-imports.mdx b/website/versioned_docs/version-0.x/guides/schema-imports.mdx new file mode 100644 index 00000000..ba885f24 --- /dev/null +++ b/website/versioned_docs/version-0.x/guides/schema-imports.mdx @@ -0,0 +1,91 @@ +--- +title: Schema Imports +--- + +import ApiSchema from '@theme/ApiSchema'; + +You can import model definitions from your API schema and render them in your Docusaurus Docs. You'll need to create an `.mdx` file and import the React Component. Read more [here about MDX in Docusaurus](https://docusaurus.io/docs/markdown-features/react). + +# Import Schema Model in Docs + +The `pointer` prop is passed on to [Redoc](https://redoc.ly/docs/resources/ref-guide/#pointer). + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +``` + +### Results + + + +## Import Schema Model (with example) in Docs + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +``` + +### Results + + + +## Importing Schema Model with multiple OpenAPI schemas + +If you have multiple APIs loaded with redocusaurus, then it is recommended to add `id`s to the config so that you can refer them when loading schema models. + +```js title="docusaurus.config.js" +const config = { + presets: [ + [ + 'redocusaurus', + { + specs: [ + { + id: 'using-spec-url', + specUrl: 'https://redocly.github.io/redoc/openapi.yaml', + routePath: '/examples/using-spec-url/', + }, + { + id: 'using-relative-url', + specUrl: `${process.env.DEPLOY_BASE_URL || '/'}openapi-page.yaml`, + routePath: '/examples/using-relative-url/', + }, + ], + theme: { + /** + * Highlight color for docs + */ + primaryColor: '#1890ff', + /** + * Options to pass to redoc + * @see https://github.com/redocly/redoc#redoc-options-object + */ + redocOptions: { hideDownloadButton: false, disableSearch: true }, + }, + }, + ], + '@docusaurus/preset-classic', + ], + title: 'Redocusaurus', +}; +``` + +```tsx +import ApiSchema from '@theme/ApiSchema'; + +; +; +``` + +### Results + +#### For ID `id="using-single-yaml"` + + + +#### For ID `id="using-remote-url"` + + diff --git a/website/versioned_docs/version-0.x/guides/server-side-rendering.md b/website/versioned_docs/version-0.x/guides/server-side-rendering.md new file mode 100644 index 00000000..2f6c1540 --- /dev/null +++ b/website/versioned_docs/version-0.x/guides/server-side-rendering.md @@ -0,0 +1,72 @@ +--- +title: Server Side Rendering +--- + +:::caution +**NOTE:** This is in Beta. Please [add your feedback here](https://github.com/rohit-gohri/redocusaurus/discussions/88) +::: + +## Prerequisites + +To enable SSR you have to do 2 things: + +### Updating your Root theme component + +Use the custom ServerStyle component in your [Theme Root](https://docusaurus.io/docs/using-themes#wrapper-your-site-with-root) (as mentioned [here](https://github.com/facebook/docusaurus/issues/3236#issuecomment-788953743)) for SSR like below: + +```tsx title="src/theme/Root/index.tsx" +import React from 'react'; + +import ServerStyle from '@theme/ServerStyle'; + +function Root({ children }: { children: React.Component }): JSX.Element { + return ( + <> + // TODO: Remove when docusaurus adds proper css-in-js support + + {children} + + ); +} + +export default Root; +``` + +### Use yaml files rather than urls to load OpenAPI files + +To enable SSR we need to parse the schema at build time so it needs to passed on as a yaml and it will be processed to JSON. This has a side-effect of the download button pointing to the JSON, to fix this you can also provide a `specUrl` to the original url that will be used as the download link. + +```js title="docusaurs.config.js" +const config = { + presets: [ + [ + 'redocusaurus', + { + specs: [ + { + spec: 'openapi.yaml', + /** + * This becomes the Download URL in this case, while docs are generated from `spec` + */ + specUrl: `${process.env.DEPLOY_BASE_URL || '/'}openapi-page.yaml`, + routePath: '/examples/using-spec-yaml/', + }, + ], + theme: { + /** + * Highlight color for docs + */ + primaryColor: '#1890ff', + /** + * Options to pass to redoc + * @see https://github.com/redocly/redoc#redoc-options-object + */ + redocOptions: { hideDownloadButton: false, disableSearch: true }, + }, + }, + ], + '@docusaurus/preset-classic', + ], + title: 'Redocusaurus', +}; +``` diff --git a/website/versioned_sidebars/version-0.x-sidebars.json b/website/versioned_sidebars/version-0.x-sidebars.json new file mode 100644 index 00000000..cff0c94e --- /dev/null +++ b/website/versioned_sidebars/version-0.x-sidebars.json @@ -0,0 +1,8 @@ +{ + "defaultSidebar": [ + { + "type": "autogenerated", + "dirName": "." + } + ] +} diff --git a/website/versions.json b/website/versions.json new file mode 100644 index 00000000..772d0506 --- /dev/null +++ b/website/versions.json @@ -0,0 +1,3 @@ +[ + "0.x" +]