From 6651c06fd6ed1bb6e081b437dfa20ac977275013 Mon Sep 17 00:00:00 2001 From: Yury Pikhtarev Date: Thu, 3 Jul 2025 00:50:41 +0400 Subject: [PATCH] refactor: streamline Docusaurus configuration and enhance sidebar structure - Removed the API sidebar from docusaurus.config.ts and updated the main documentation sidebar to manually include relevant categories, excluding the API. - Cleared out unused plugin configurations to simplify the setup. - Adjusted sidebar.ts to reflect the new structure, ensuring better organization of documentation categories. - Updated API documentation files to improve code formatting and consistency in response examples. These changes aim to enhance the clarity and accessibility of the documentation, providing a more user-friendly experience. --- docs/blog/2025-06-30-welcome.md | 2 ++ docs/docs/api/emojis/aliases.md | 4 +-- docs/docs/api/emojis/categories.md | 4 +-- docs/docs/api/emojis/emojis.md | 7 +++-- docs/docs/api/overview.md | 17 +++++++---- docs/docusaurus.config.ts | 23 ++------------- docs/sidebars.ts | 46 ++++++++++++++++++++++++++++-- 7 files changed, 67 insertions(+), 36 deletions(-) diff --git a/docs/blog/2025-06-30-welcome.md b/docs/blog/2025-06-30-welcome.md index ecfe4235f..e2f3680c1 100644 --- a/docs/blog/2025-06-30-welcome.md +++ b/docs/blog/2025-06-30-welcome.md @@ -9,6 +9,8 @@ tags: [announcement, laravel, development] We're excited to announce the complete rewrite of TorrentPier using modern web technologies. This blog will document our journey, share development updates, and provide insights into the decisions we make along the way. + + ## Why a Rewrite? The original TorrentPier v2.x served the community well for many years, but technology has evolved significantly. We decided it was time for a complete modernization to: diff --git a/docs/docs/api/emojis/aliases.md b/docs/docs/api/emojis/aliases.md index f007eed65..1723061fc 100644 --- a/docs/docs/api/emojis/aliases.md +++ b/docs/docs/api/emojis/aliases.md @@ -9,7 +9,7 @@ The Emoji Aliases API allows you to manage alternative shortcodes for emojis, en ## Base URL -``` +```http /api/emoji/aliases ``` @@ -357,7 +357,7 @@ curl -X DELETE "https://api.example.com/api/emoji/aliases/3" \ #### Example Response -``` +```text HTTP/1.1 204 No Content ``` diff --git a/docs/docs/api/emojis/categories.md b/docs/docs/api/emojis/categories.md index bcde66a41..268122a95 100644 --- a/docs/docs/api/emojis/categories.md +++ b/docs/docs/api/emojis/categories.md @@ -9,7 +9,7 @@ The Emoji Categories API allows you to manage emoji categories used to organize ## Base URL -``` +```http /api/emoji/categories ``` @@ -248,7 +248,7 @@ curl -X DELETE "https://api.example.com/api/emoji/categories/3" \ #### Example Response -``` +```text HTTP/1.1 204 No Content ``` diff --git a/docs/docs/api/emojis/emojis.md b/docs/docs/api/emojis/emojis.md index 9488b36c9..3350aae1c 100644 --- a/docs/docs/api/emojis/emojis.md +++ b/docs/docs/api/emojis/emojis.md @@ -9,7 +9,7 @@ The Emoji API allows you to manage individual emojis, including Unicode emojis, ## Base URL -``` +```http /api/emoji/emojis ``` @@ -237,6 +237,7 @@ POST /api/emoji/emojis #### Example Requests **Unicode Emoji:** + ```bash curl -X POST "https://api.example.com/api/emoji/emojis" \ -H "Content-Type: application/json" \ @@ -251,6 +252,7 @@ curl -X POST "https://api.example.com/api/emoji/emojis" \ ``` **Custom Image Emoji:** + ```bash curl -X POST "https://api.example.com/api/emoji/emojis" \ -H "Content-Type: application/json" \ @@ -265,6 +267,7 @@ curl -X POST "https://api.example.com/api/emoji/emojis" \ ``` **CSS Sprite Emoji:** + ```bash curl -X POST "https://api.example.com/api/emoji/emojis" \ -H "Content-Type: application/json" \ @@ -387,7 +390,7 @@ curl -X DELETE "https://api.example.com/api/emoji/emojis/25" \ #### Example Response -``` +```text HTTP/1.1 204 No Content ``` diff --git a/docs/docs/api/overview.md b/docs/docs/api/overview.md index e6798bbb9..13f02fba8 100644 --- a/docs/docs/api/overview.md +++ b/docs/docs/api/overview.md @@ -11,7 +11,7 @@ Welcome to the API documentation. This section covers all available REST API end All API endpoints are prefixed with `/api/` and use the following base URL: -``` +```http https://your-domain.com/api/ ``` @@ -34,7 +34,7 @@ curl -X POST https://your-domain.com/api/login \ Include the token in the Authorization header: -```bash +```text Authorization: Bearer your-token-here ``` @@ -43,6 +43,7 @@ Authorization: Bearer your-token-here All API responses follow a consistent JSON format: ### Success Response + ```json { "data": { @@ -53,6 +54,7 @@ All API responses follow a consistent JSON format: ``` ### Collection Response + ```json { "data": [ @@ -80,6 +82,7 @@ All API responses follow a consistent JSON format: ``` ### Error Response + ```json { "message": "Validation failed", @@ -112,7 +115,7 @@ API requests are rate-limited to prevent abuse: Rate limit headers are included in responses: -``` +```text X-RateLimit-Limit: 60 X-RateLimit-Remaining: 59 X-RateLimit-Reset: 1640995200 @@ -126,7 +129,8 @@ List endpoints support pagination using query parameters: - `per_page` - Items per page (default: 50, max: 100) Example: -``` + +```http GET /api/emoji/emojis?page=2&per_page=25 ``` @@ -148,7 +152,8 @@ Use these parameters to include related data: - `with_emoji` - Include emoji information (for aliases) Example: -``` + +```http GET /api/emoji/emojis?search=smile&with_category=1&with_aliases=1 ``` @@ -156,7 +161,7 @@ GET /api/emoji/emojis?search=smile&with_category=1&with_aliases=1 The current API version is v1. Future versions will be available at: -``` +```http /api/v2/endpoint ``` diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 9cd84053c..231594221 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -34,7 +34,6 @@ const config: Config = { docs: { sidebarPath: './sidebars.ts', editUrl: 'https://github.com/torrentpier/torrentpier/tree/dexter/docs/', - exclude: ['api/**'], // Exclude API folder from main docs }, blog: { showReadingTime: true, @@ -54,24 +53,7 @@ const config: Config = { ], ], - plugins: [ - [ - '@docusaurus/plugin-content-docs', - { - id: 'api', - path: 'docs/api', - routeBasePath: 'api', - sidebarPath: './sidebars.ts', - editUrl: 'https://github.com/torrentpier/torrentpier/tree/dexter/docs/', - beforeDefaultRemarkPlugins: [], - beforeDefaultRehypePlugins: [], - remarkPlugins: [], - rehypePlugins: [], - showLastUpdateTime: true, - showLastUpdateAuthor: true, - } satisfies import('@docusaurus/plugin-content-docs').Options, - ], - ], + plugins: [], themeConfig: { image: 'img/social-card.jpg', @@ -92,7 +74,6 @@ const config: Config = { { type: 'docSidebar', sidebarId: 'apiSidebar', - docsPluginId: 'api', position: 'left', label: 'API', }, @@ -115,7 +96,7 @@ const config: Config = { }, { label: 'API Reference', - to: '/api/overview', + to: '/docs/api/overview', }, ], }, diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 973315410..706ca03fd 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -13,9 +13,49 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; Create as many sidebars as you want. */ const sidebars: SidebarsConfig = { - // By default, Docusaurus generates a sidebar from the docs folder structure - docsSidebar: [{type: 'autogenerated', dirName: '.'}], - apiSidebar: [{type: 'autogenerated', dirName: '.'}], + // Documentation sidebar - manually exclude API by listing other folders + docsSidebar: [ + 'intro', + { + type: 'category', + label: 'Getting Started', + items: [{type: 'autogenerated', dirName: 'getting-started'}], + }, + { + type: 'category', + label: 'Development', + items: [{type: 'autogenerated', dirName: 'development'}], + }, + { + type: 'category', + label: 'Architecture', + items: [{type: 'autogenerated', dirName: 'architecture'}], + }, + { + type: 'category', + label: 'Models', + items: [{type: 'autogenerated', dirName: 'models'}], + }, + { + type: 'category', + label: 'Migration', + items: [{type: 'autogenerated', dirName: 'migration'}], + }, + { + type: 'category', + label: 'Legacy Documentation', + items: [{type: 'autogenerated', dirName: 'legacy'}], + }, + 'contributing', + ], + + // API sidebar - only includes the API folder + apiSidebar: [ + { + type: 'autogenerated', + dirName: 'api', + }, + ], }; export default sidebars;