From 7cdc230100dc7208d9bb4957b0c01a65b7db60c0 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Sat, 12 Mar 2022 04:48:44 +0800 Subject: [PATCH] fix(docs): fix and cleanup VuePress config (#3738) * Use relative links * Remove migrating link * Fix zh-* config * Adjust how sidebar is generated * Enable evergreen * Format * Update docs/.vuepress/config.js Co-authored-by: David Knaack Co-authored-by: David Knaack --- docs/.vuepress/config.js | 229 ++++++++++++++--------------- docs/faq/README.md | 2 +- docs/installing/README.md | 2 +- docs/presets/README.md | 10 +- docs/presets/bracketed-segments.md | 2 +- docs/presets/nerd-font.md | 2 +- docs/presets/no-runtimes.md | 2 +- docs/presets/plain-text.md | 2 +- docs/presets/pure-preset.md | 2 +- 9 files changed, 121 insertions(+), 132 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 0dfc5e9c..0a425f5d 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,3 +1,28 @@ +const sidebar = (lang, override = {}) => + [ + "", // "Home", which should always have a override + "guide", // README, which should always have a override + // Overrides for any page below is an inconsistency between the sidebar title and page title + "installing", + "config", + "advanced-config", + "faq", + "presets", + ].map(page => { + let path = "/"; + + if (lang) { + path += `${lang}/`; + } + + if (page) { + path += `${page}/`; + } + + // If no override is set for current page, let VuePress fallback to page title + return page in override ? [path, override[page]] : path; + }); + module.exports = { locales: { "/": { @@ -85,6 +110,7 @@ module.exports = { ["meta", { name: "twitter:image", content: "https://starship.rs/icon.png" }], ["meta", { name: "twitter:alt", content: "Starship: Cross-Shell Prompt" }], ], + evergreen: true, theme: "default-prefers-color-scheme", themeConfig: { logo: "/icon.png", @@ -113,16 +139,9 @@ module.exports = { // Custom navbar values nav: [{ text: "Configuration", link: "/config/" }], // Custom sidebar values - sidebar: [ - "/", - ["/guide/", "Guide"], - ["/installing/", "Advanced Installation"], - ["/config/", "Configuration"], - ["/advanced-config/", "Advanced Configuration"], - ["/faq/", "Frequently Asked Questions"], - ["/presets/", "Presets"], - ["/migrating-to-0.45.0/", "Migrating to v0.45.0"], - ], + sidebar: sidebar("", { + guide: "Guide", + }), }, "/de-DE/": { // text for the language dropdown @@ -132,16 +151,14 @@ module.exports = { // Custom text for edit link. Defaults to "Edit this page" editLinkText: "Bearbeite diese Seite auf GitHub", // Custom navbar values - nav: [{ text: "Konfiguration", link: "/config/" }], + nav: [{ text: "Konfiguration", link: "/de-DE/config/" }], // Custom sidebar values - sidebar: [ - "/de-DE/", - ["/de-DE/guide/", "Anleitung"], - ["/de-DE/config/", "Konfiguration"], - ["/de-DE/advanced-config/", "Erweiterte Konfiguration"], - ["/de-DE/faq/", "Häufig gestellte Fragen"], - ["/de-DE/presets/", "Konfigurations-Beispiele"], - ], + sidebar: sidebar("de-DE", { + guide: "Anleitung", + installing: "Erweiterte Installation", + faq: "Häufig gestellte Fragen", + presets: "Konfigurations-Beispiele", + }), }, "/es-ES/": { // text for the language dropdown @@ -153,14 +170,12 @@ module.exports = { // Custom navbar values nav: [{ text: "Configuración", link: "/es-ES/config/" }], // Custom sidebar values - sidebar: [ - "/es-ES/", - ["/es-ES/guide/", "Guía"], - ["/es-ES/config/", "Configuración"], - ["/es-ES/advanced-config/", "Configuración Avanzada"], - ["/es-ES/faq/", "Preguntas frecuentes"], - ["/es-ES/presets/", "Ajustes predeterminados"], - ], + sidebar: sidebar("es-ES", { + guide: "Guía", + installing: "Instalación avanzada", + faq: "Preguntas frecuentes", + presets: "Ajustes predeterminados", + }), }, "/fr-FR/": { // text for the language dropdown @@ -172,14 +187,10 @@ module.exports = { // Custom navbar values nav: [{ text: "Configuration", link: "/fr-FR/config/" }], // Custom sidebar values - sidebar: [ - "/fr-FR/", - ["/fr-FR/guide/", "Guide"], - ["/fr-FR/config/", "Configuration"], - ["/fr-FR/advanced-config/", "Configuration avancée"], - ["/fr-FR/faq/", "Foire aux questions"], - ["/fr-FR/presets/", "Paramètres par défaut"], - ], + sidebar: sidebar("fr-FR", { + guide: "Guide", + installing: "Installation avancée", + }), }, "/id-ID/": { // text for the language dropdown @@ -191,14 +202,12 @@ module.exports = { // Custom navbar values nav: [{ text: "Konfigurasi", link: "/id-ID/config/" }], // Custom sidebar values - sidebar: [ - "/id-ID/", - ["/id-ID/guide/", "Petunjuk"], - ["/id-ID/config/", "Konfigurasi"], - ["/id-ID/advanced-config/", "Konfigurasi Lanjutan"], - ["/id-ID/faq/", "Pertanyaan Umum"], - ["/id-ID/presets/", "Prasetel"], - ], + sidebar: sidebar("id-ID", { + guide: "Petunjuk", + installing: "Advanced Installation", + faq: "Pertanyaan Umum", + presets: "Prasetel", + }), }, "/it-IT/": { // text for the language dropdown @@ -210,14 +219,10 @@ module.exports = { // Custom navbar values nav: [{ text: "Configuration", link: "/it-IT/config/" }], // Custom sidebar values - sidebar: [ - "/it-IT/", - ["/it-IT/guide/", "Guide"], - ["/it-IT/config/", "Configurazione"], - ["/it-IT/advanced-config/", "Configurazione Avanzata"], - ["/it-IT/faq/", "FAQ"], - ["/it-IT/presets/", "Preset"], - ], + sidebar: sidebar("it-IT", { + guide: "Guide", + installing: "Installazione Avanzata", + }), }, "/ja-JP/": { // text for the language dropdown @@ -229,15 +234,10 @@ module.exports = { // Custom navbar values nav: [{ text: "設定", link: "/ja-JP/config/" }], // Custom sidebar values - sidebar: [ - "/ja-JP/", - ["/ja-JP/guide/", "ガイド"], - ["/ja-JP/config/", "設定"], - ["/ja-JP/advanced-config/", "高度な設定"], - ["/ja-JP/faq/", "FAQ"], - ["/ja-JP/presets/", "準備するもの"], - ["/ja-JP/migrating-to-0.45.0/", "v0.45への移行"], - ], + sidebar: sidebar("ja-JP", { + guide: "ガイド", + installing: "高度なインストール", + }), }, "/pt-BR/": { // text for the language dropdown @@ -249,14 +249,12 @@ module.exports = { // Custom navbar values nav: [{ text: "Configuração", link: "/pt-BR/config/" }], // Custom sidebar values - sidebar: [ - "/pt-BR/", - ["/pt-BR/guide/", "Guia"], - ["/pt-BR/config/", "Configuração"], - ["/pt-BR/advanced-config/", "Configuração avançada"], - ["/pt-BR/faq/", "Perguntas frequentes"], - ["/pt-BR/presets/", "Predefinições"], - ], + sidebar: sidebar("pt-BR", { + guide: "Guia", + installing: "Instalação avançada", + faq: "Perguntas frequentes", + presets: "Predefinições", + }), }, "/ru-RU/": { // text for the language dropdown @@ -268,14 +266,13 @@ module.exports = { // Custom navbar values nav: [{ text: "Настройка", link: "/ru-RU/config/" }], // Custom sidebar values - sidebar: [ - "/ru-RU/", - ["/ru-RU/guide/", "Руководство"], - ["/ru-RU/config/", "Настройка"], - ["/ru-RU/advanced-config/", "Расширенная Настройка"], - ["/ru-RU/faq/", "Часто Задаваемые Вопросы"], - ["/ru-RU/presets/", "Предустановки"], - ], + sidebar: sidebar("ru-RU", { + guide: "Руководство", + installing: "Advanced Installation", + config: "Настройка", + "advanced-config": "Расширенная Настройка", + faq: "Часто Задаваемые Вопросы", + }), }, "/vi-VN/": { // text for the language dropdown @@ -287,51 +284,43 @@ module.exports = { // Custom navbar values nav: [{ text: "Cấu hình", link: "/vi-VN/config/" }], // Custom sidebar values - sidebar: [ - "/vi-VN/", - ["/vi-VN/guide/", "Hướng dẫn"], - ["/vi-VN/config/", "Cấu hình"], - ["/vi-VN/advanced-config/", "Cấu hình nâng cao"], - ["/vi-VN/faq/", "Các hỏi thường gặp"], - ["/vi-VN/presets/", "Mẫu thiết lập"], - ], + sidebar: sidebar("vi-VN", { + guide: "Hướng dẫn", + installing: "Cài đặt nâng cao", + faq: "Các hỏi thường gặp", + }), + }, + "/zh-TW/": { + // text for the language dropdown + selectText: "語言", + // label for this locale in the language dropdown + label: "繁體中文", + // Custom text for edit link. Defaults to "Edit this page" + editLinkText: "在 GitHub 上修改此頁面", + // Custom navbar values + nav: [{ text: "設定", link: "/zh-TW/config/" }], + // Custom sidebar values + sidebar: sidebar("zh-TW", { + guide: "指引", + installing: "進階安裝", + }), + }, + "/zh-CN/": { + // text for the language dropdown + selectText: "语言", + // label for this locale in the language dropdown + label: "简体中文", + // Custom text for edit link. Defaults to "Edit this page" + editLinkText: "在 GitHub 上修改此页", + // Custom navbar values + nav: [{ text: "配置", link: "/zh-CN/config/" }], + // Custom sidebar values + sidebar: sidebar("zh-CN", { + guide: "指南", + installing: "高级安装", + presets: "社区配置分享", + }), }, - }, - "/zh-TW/": { - // text for the language dropdown - selectText: "語言", - // label for this locale in the language dropdown - label: "繁體中文", - // Custom text for edit link. Defaults to "Edit this page" - editLinkText: "在 GitHub 上修改此頁面", - // Custom navbar values - nav: [{ text: "設定", link: "/zh-TW/config/" }], - // Custom sidebar values - sidebar: [ - "/zh-TW/", - ["/zh-TW/guide/", "指引"], - ["/zh-TW/config/", "設定"], - ["/zh-TW/advanced-config/", "進階設定"], - ], - }, - "/zh-CN/": { - // text for the language dropdown - selectText: "语言", - // label for this locale in the language dropdown - label: "简体中文", - // Custom text for edit link. Defaults to "Edit this page" - editLinkText: "在 GitHub 上修改此页", - // Custom navbar values - nav: [{ text: "配置", link: "/zh-CN/config/" }], - // Custom sidebar values - sidebar: [ - "/zh-CN/", - ["/zh-CN/guide/", "指南"], - ["/zh-CN/config/", "配置"], - ["/zh-CN/advanced-config/", "高级配置"], - ["/zh-CN/faq/", "常见问题"], - ["/zh-CN/presets/", "社区配置分享"], - ], }, }, plugins: [ diff --git a/docs/faq/README.md b/docs/faq/README.md index b8ceb7af..4cab4eb2 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -1,4 +1,4 @@ -# FAQ +# Frequently Asked Questions ## What is the configuration used in the demo GIF? diff --git a/docs/installing/README.md b/docs/installing/README.md index 39fd25f7..073be067 100644 --- a/docs/installing/README.md +++ b/docs/installing/README.md @@ -1,4 +1,4 @@ -# 🚀 Advanced Installation +# Advanced Installation To install starship, you need to do two things: diff --git a/docs/presets/README.md b/docs/presets/README.md index afa7a7bf..b453a176 100644 --- a/docs/presets/README.md +++ b/docs/presets/README.md @@ -5,33 +5,33 @@ If you have a preset to share, please [submit a PR](https://github.com/starship/ To get details on how to use a preset, simply click on the image. -## [Nerd Font Symbols](./nerd-font) +## [Nerd Font Symbols](./nerd-font.md) This preset changes the symbols for each module to use Nerd Font symbols. [![Screenshot of Nerd Font Symbols preset](/presets/img/nerd-font-symbols.png "Click to view Nerd Font Symbols preset")](./nerd-font) -## [Bracketed Segments](./bracketed-segments) +## [Bracketed Segments](./bracketed-segments.md) This preset changes the format of all the built-in modules to show their segment in brackets instead of using the default Starship wording ("via", "on", etc.). [![Screenshot of Bracketed Segments preset](/presets/img/bracketed-segments.png "Click to view Bracketed Segments preset")](./bracketed-segments) -## [Plain Text Symbols](./plain-text) +## [Plain Text Symbols](./plain-text.md) This preset changes the symbols for each module into plain text. Great if you don't have access to Unicode. [![Screenshot of Plain Text Symbols preset](/presets/img/plain-text-symbols.png "Click to view Plain Text Symbols preset")](./plain-text) -## [No Runtime Versions](./no-runtimes) +## [No Runtime Versions](./no-runtimes.md) This preset hides the version of language runtimes. If you work in containers or virtualized environments, this one is for you! [![Screenshot of Hide Runtime Versions preset](/presets/img/no-runtime-versions.png "Click to view No Runtime Versions preset")](./no-runtimes) -## [Pure Prompt](./pure-preset) +## [Pure Prompt](./pure-preset.md) This preset emulates the look and behavior of [Pure](https://github.com/sindresorhus/pure). diff --git a/docs/presets/bracketed-segments.md b/docs/presets/bracketed-segments.md index 6402020e..f595e777 100644 --- a/docs/presets/bracketed-segments.md +++ b/docs/presets/bracketed-segments.md @@ -1,4 +1,4 @@ -[Return to Presets](/presets/#bracketed-segments) +[Return to Presets](./README.md#bracketed-segments) # Bracketed Segments Preset diff --git a/docs/presets/nerd-font.md b/docs/presets/nerd-font.md index 82cedb19..c5810eff 100644 --- a/docs/presets/nerd-font.md +++ b/docs/presets/nerd-font.md @@ -1,4 +1,4 @@ -[Return to Presets](/presets/#nerd-font-symbols) +[Return to Presets](./README.md#nerd-font-symbols) # Nerd Font Symbols Preset diff --git a/docs/presets/no-runtimes.md b/docs/presets/no-runtimes.md index 1815872d..fd305051 100644 --- a/docs/presets/no-runtimes.md +++ b/docs/presets/no-runtimes.md @@ -1,4 +1,4 @@ -[Return to Presets](/presets/#no-runtime-versions) +[Return to Presets](./README.md#no-runtime-versions) # No Runtime Versions Preset diff --git a/docs/presets/plain-text.md b/docs/presets/plain-text.md index e80c85d2..6c38c49a 100644 --- a/docs/presets/plain-text.md +++ b/docs/presets/plain-text.md @@ -1,4 +1,4 @@ -[Return to Presets](/presets/#plain-text-symbols) +[Return to Presets](./README.md#plain-text-symbols) ## Plain Text Symbols Preset diff --git a/docs/presets/pure-preset.md b/docs/presets/pure-preset.md index 96a1b6a2..ad61b499 100644 --- a/docs/presets/pure-preset.md +++ b/docs/presets/pure-preset.md @@ -1,4 +1,4 @@ -[Return to Presets](/presets/#pure) +[Return to Presets](./README.md#pure) # Pure Preset