From beb209b3c10700844587609ddfd980afde617a56 Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Wed, 26 Nov 2025 21:06:14 +0300 Subject: [PATCH 1/2] Resolving changelog (and not only) avatars from GitHub --- docusaurus.config.ts | 16 +++-- .../changelog.md | 56 ++++++++--------- src/components/GithubAuthors.tsx | 25 ++++++++ src/pages/changelog.md | 56 ++++++++--------- src/plugins/remark-authors.mjs | 61 +++++++++++++++++++ src/theme/MDXComponents.tsx | 4 +- 6 files changed, 157 insertions(+), 61 deletions(-) create mode 100644 src/components/GithubAuthors.tsx create mode 100644 src/plugins/remark-authors.mjs diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 8b251fc66f..d7ce983c1d 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -24,6 +24,7 @@ import { Config } from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; import type * as Docs from '@docusaurus/plugin-content-docs'; import type * as Typedoc from './api/docusaurus-plugin'; +import remarkAuthors from './src/plugins/remark-authors.mjs'; import { readdirSync } from 'fs'; import path from 'path'; @@ -65,9 +66,13 @@ export default { breadcrumbs: false, editLocalizedFiles: true, editUrl: 'https://github.com/nernar/nernar.github.io/tree/master/', - showLastUpdateTime: true + showLastUpdateTime: true, + remarkPlugins: [remarkAuthors] }, blog: false, + pages: { + remarkPlugins: [remarkAuthors] + }, theme: { customCss: require.resolve('./src/css/custom.css') } @@ -86,7 +91,8 @@ export default { breadcrumbs: false, editLocalizedFiles: true, editUrl: 'https://github.com/nernar/nernar.github.io/tree/master/', - showLastUpdateTime: true + showLastUpdateTime: true, + remarkPlugins: [remarkAuthors] } satisfies Docs.Options ], [ @@ -101,7 +107,8 @@ export default { editUrl: 'https://github.com/nernar/nernar.github.io/tree/master/', showLastUpdateTime: true, sidebarCollapsed: true, - sidebarCollapsible: true + sidebarCollapsible: true, + remarkPlugins: [remarkAuthors] } satisfies Docs.Options ], [ @@ -150,7 +157,8 @@ export default { // TODO: Internals like in @gobstones/typedoc-theme-gobstones. // TODO: Page groups like in typedoc-github-theme. // ] - } + }, + remarkPlugins: [remarkAuthors] } satisfies Typedoc.Options ] ], diff --git a/i18n/ru/docusaurus-plugin-content-pages/changelog.md b/i18n/ru/docusaurus-plugin-content-pages/changelog.md index c30b44911d..d8071139a2 100644 --- a/i18n/ru/docusaurus-plugin-content-pages/changelog.md +++ b/i18n/ru/docusaurus-plugin-content-pages/changelog.md @@ -2,34 +2,34 @@ ## 3.1.0b126 -- Добавлены методы для манипуляции погодой, атмосферой и другими [свойствами измерений](/api/namespace/Dimensions#CustomDimension) ([@rislaed](https://vk.com/id268478382)) -- Добавлена поддержка кастомных [звуков блоков](/api/namespace/Block#sound) ([@rislaed](https://vk.com/id268478382)) -- Добавлена поддержка неймспейсов для блоков и предметов и методы для работы с ними ([@zheka2304](https://vk.com/id24708057), [@rislaed](https://vk.com/id268478382)) -- Поддержка парсинга HTML-цветов в [элементах интерфейса](/api/namespace/UI#FontColor) ([@rislaed](https://vk.com/id268478382)) -- Добавлен метод для получения списка кастумных измерений ([@rislaed](https://vk.com/id268478382)) +- Добавлены методы для манипуляции погодой, атмосферой и другими [свойствами измерений](/api/namespace/Dimensions#CustomDimension) (@rislaed) +- Добавлена поддержка кастомных [звуков блоков](/api/namespace/Block#sound) (@rislaed) +- Добавлена поддержка неймспейсов для блоков и предметов и методы для работы с ними (@zheka2304, @rislaed) +- Поддержка парсинга HTML-цветов в [элементах интерфейса](/api/namespace/UI#FontColor) (@rislaed) +- Добавлен метод для получения списка кастумных измерений (@rislaed) :::tip Реализована кодогенерация для API -Что позволит заметно повысить производительность и упростить введение новых методов API, включая поддержку модов на Java ([@zheka2304](https://vk.com/id24708057), [@rislaed](https://vk.com/id268478382)). Старое API будет постепенно переноситься на новое. +Что позволит заметно повысить производительность и упростить введение новых методов API, включая поддержку модов на Java (@zheka2304, @rislaed). Старое API будет постепенно переноситься на новое. -- Восстановление работы и перенос на кодогенерацию модуля PathNavigation ([@zheka2304](https://vk.com/id24708057)) -- Перенос модуля [BlockSource](/api/class/BlockSource) на кодогенерацию ([@reider745](https://vk.com/id500917624)) -- Добавлены методы для манипуляций с модулями API: [injectBindingsIntoScope](/api/function/injectBindingsIntoScope), [injectModule(s)IntoScope](/api/function/injectModuleIntoScope) ([@rislaed](https://vk.com/id268478382)) +- Восстановление работы и перенос на кодогенерацию модуля PathNavigation (@zheka2304) +- Перенос модуля [BlockSource](/api/class/BlockSource) на кодогенерацию (@reider745) +- Добавлены методы для манипуляций с модулями API: [injectBindingsIntoScope](/api/function/injectBindingsIntoScope), [injectModule(s)IntoScope](/api/function/injectModuleIntoScope) (@rislaed) ::: -- Исправлено событие получения урона ([@zheka2304](https://vk.com/id24708057)) -- Исправлен метод [BlockSource.fetchEntitiesOfTypeInAABB](/api/class/BlockSource#fetchEntitiesOfTypeInAABB) ([@zheka2304](https://vk.com/id24708057)) -- Исправлено использование предметов из модов на некоторые ванильные блоки ([@rislaed](https://vk.com/id268478382)) -- [getTileEntity](/api/namespace/TileEntity#getTileEntity) теперь гарантированно возвращает уже загруженный TileEntity ([@reider745](https://vk.com/id500917624)) -- Исправлено отображение некоторых предметов в контейнерах ([@reider745](https://vk.com/id500917624)) -- Исправлено изменение насыщения игроков ([@reider745](https://vk.com/id500917624)) -- Исправлен дроп изумрудной руды ([@mineexplorer](https://vk.com/id201975250)) -- Исправлены модели адских заборов в интерфейсах ([@mineexplorer](https://vk.com/id201975250)) -- Исправлен кастомный цвет неба, заката и тумана ([@zheka2304](https://vk.com/id24708057)) -- Отключена поддержка Realms ([@rislaed](https://vk.com/id268478382)) +- Исправлено событие получения урона (@zheka2304) +- Исправлен метод [BlockSource.fetchEntitiesOfTypeInAABB](/api/class/BlockSource#fetchEntitiesOfTypeInAABB) (@zheka2304) +- Исправлено использование предметов из модов на некоторые ванильные блоки (@rislaed) +- [getTileEntity](/api/namespace/TileEntity#getTileEntity) теперь гарантированно возвращает уже загруженный TileEntity (@reider745) +- Исправлено отображение некоторых предметов в контейнерах (@reider745) +- Исправлено изменение насыщения игроков (@reider745) +- Исправлен дроп изумрудной руды (@mineexplorer) +- Исправлены модели адских заборов в интерфейсах (@mineexplorer) +- Исправлен кастомный цвет неба, заката и тумана (@zheka2304) +- Отключена поддержка Realms (@rislaed) -## 3.1.0b125 ([@reider745](https://vk.com/id500917624), [@rislaed](https://vk.com/id268478382)) +## 3.1.0b125 (@reider745, @rislaed) - Исправление сохранений - Исправление цвета неба/тумана/воды измерений @@ -51,7 +51,7 @@ Эта версия получила поддержку 64 битных архетиктур (arm64-v8a), что также избавило ее от ряда вылетов и повысило общую стабильность. Ожидаются некоторые ошибки, которые будут исправлены с ближайшими обновлениями. -## 2.4.0b123 ([@rislaed](https://vk.com/id268478382)) +## 2.4.0b123 (@rislaed) Скорее всего, это последняя версия для архитектур ARM32 (armeabi-v7a). Все последующие обновления выходят для 64 битных устройств и данные паки будут получать только исправления критических ошибок. @@ -80,7 +80,7 @@ - Множественные небольшие улучшения внутренней работы движка -## 2.4.0b122 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b122 (@reider745) - Добавлены методы [World.addListenerChunkStateChanged(listener, statesList)](/api/namespace/World#addListenerChunkStateChanged)/[addLocalListenerChunkStateChanged](/api/namespace/World#addLocalListenerChunkStateChanged) для отслеживания загрузки и выгрузки чанков - Добавлена возможность получения игровых настроек с помощью [Game.getOption(key)](/api/namespace/Game#getOption), воспользуйтесь [Game.getOptions](/api/namespace/Game#getOptions) для получения списка всех доступных ключей @@ -88,7 +88,7 @@ - Реализованы пакеты с двоичными данными, передайте массив с байтами для их отправки - Исправлена работа раздатчиков с ведрами жидкостей из модов, а также передача идентификатора игрока в каллбек *CraftRecipePreProvided* -## 2.4.0b120-121 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b120-121 (@reider745) - Исправления прокси браузера модов - Исправления повреждающихся сохранений в некоторых случаях, из-за коллизии @@ -100,7 +100,7 @@ - Исправления крашей в мод браузере - Исправления некоторых крашей в игре, в частности от всплывающих сообщений на некоторых прошивках -## 2.4.0b118-119 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b118-119 (@reider745) - Улучшение сетевого протокола - Добавлены методы BlockSource для управления погодой @@ -110,7 +110,7 @@ ## 2.4.0b116-117 -Добавлена поддержка серверов с модами на основе [ядра ZoteCore](https://github.com/Reider745/ZoteCoreLoader) от [@reider745](https://vk.com/id500917624), что также включает в себя: +Добавлена поддержка серверов с модами на основе [ядра ZoteCore](https://github.com/Reider745/ZoteCoreLoader) от @reider745, что также включает в себя: - Исправления списка серверов (для модпаков список хранится в основной папке модпака) - Исправление не статичного uuid игрока (от параметров XUID и ника игрока), исправляет сохранения инвентаря в локальной игре @@ -118,9 +118,9 @@ - Добавлена синхронизация id биомов - Другие различные исправления для серверов -:::note Другие изменения ([@reider745](https://vk.com/id500917624)) +:::note Другие изменения (@reider745) -- Добавлен прокси в мод браузере, который включается при невозможности подключиться к основной игре ([@spawnrys](https://vk.com/id549824423)) +- Добавлен прокси в мод браузере, который включается при невозможности подключиться к основной игре (@spawnrys) - Исправления синхронизации [клиентской части TileEntity](/api/namespace/TileEntity#LocalTileEntityPrototype), добавлены новые методы [onConnectionPlayer](/api/namespace/TileEntity#onConnectionPlayer)/[onDisconnectionPlayer](/api/namespace/TileEntity#onDisconnectionPlayer) - Теперь в сохранениях вместо ошибки будет передаваться [пустой объект](/api/namespace/Saver#getDefaultSaves) - Добавлено условие [ICRender.BlockState(x, y, z, stateId, valueState)](/api/namespace/ICRender#BlockState) @@ -132,7 +132,7 @@ ::: -:::note Другие изменения ([@zheka_smirnov](https://vk.com/id24708057)) +:::note Другие изменения (@zheka2304) - Исправлены частые краши Inner Core при запуске - Обновлен до последней версии Rhino - движок javascript для модов diff --git a/src/components/GithubAuthors.tsx b/src/components/GithubAuthors.tsx new file mode 100644 index 0000000000..1e3b1bdbd5 --- /dev/null +++ b/src/components/GithubAuthors.tsx @@ -0,0 +1,25 @@ +import React from 'react'; + +export default function GithubAuthors({ authors }) { + const authorList = typeof authors === 'string' ? JSON.parse(authors) : authors; + + return ( + + {authorList.map((author: any) => ( + + {`@${author}`} + + ))} + + ); +} diff --git a/src/pages/changelog.md b/src/pages/changelog.md index ae5fb5ee23..f48103f20e 100644 --- a/src/pages/changelog.md +++ b/src/pages/changelog.md @@ -2,34 +2,34 @@ ## 3.1.0b126 -- Added methods for manipulating weather, atmosphere, and other [dimension properties](/api/namespace/Dimensions#CustomDimension) ([@rislaed](https://vk.com/id268478382)) -- Added support for custom [block sounds](/api/namespace/Block#sound) ([@rislaed](https://vk.com/id268478382)) -- Added support for blocks and items namespaces and methods for working with them ([@zheka2304](https://vk.com/id24708057), [@rislaed](https://vk.com/id268478382)) -- Added support for parsing HTML colors in [UI elements](/api/namespace/UI#FontColor) ([@rislaed](https://vk.com/id268478382)) -- Added a method to get the list of custom dimensions ([@rislaed](https://vk.com/id268478382)) +- Added methods for manipulating weather, atmosphere, and other [dimension properties](/api/namespace/Dimensions#CustomDimension) (@rislaed) +- Added support for custom [block sounds](/api/namespace/Block#sound) (@rislaed) +- Added support for blocks and items namespaces and methods for working with them (@zheka2304, @rislaed) +- Added support for parsing HTML colors in [UI elements](/api/namespace/UI#FontColor) (@rislaed) +- Added a method to get the list of custom dimensions (@rislaed) :::tip Implemented API code generation -Which will significantly improve performance and simplify the introduction of new API methods, including support for Java mods([@zheka2304](https://vk.com/id24708057), [@rislaed](https://vk.com/id268478382)). The legacy API will be gradually migrated to the new system. +Which will significantly improve performance and simplify the introduction of new API methods, including support for Java mods (@zheka2304, @rislaed). The legacy API will be gradually migrated to the new system. -- Restored functionality and migrated the PathNavigation module to code generation ([@zheka2304](https://vk.com/id24708057)) -- Migrated the [BlockSource](/api/class/BlockSource) module to code generation ([@reider745](https://vk.com/id500917624)) -- Added methods for API module manipulation: [injectBindingsIntoScope](/api/function/injectBindingsIntoScope), [injectModule(s)IntoScope](/api/function/injectModuleIntoScope) ([@rislaed](https://vk.com/id268478382)) +- Restored functionality and migrated the PathNavigation module to code generation (@zheka2304) +- Migrated the [BlockSource](/api/class/BlockSource) module to code generation (@reider745) +- Added methods for API module manipulation: [injectBindingsIntoScope](/api/function/injectBindingsIntoScope), [injectModule(s)IntoScope](/api/function/injectModuleIntoScope) (@rislaed) ::: -- Fixed the entity hurt event ([@zheka2304](https://vk.com/id24708057)) -- Fixed the [BlockSource.fetchEntitiesOfTypeInAABB](/api/class/BlockSource#fetchEntitiesOfTypeInAABB) method ([@zheka2304](https://vk.com/id24708057)) -- Fixed using items from mods on certain vanilla blocks ([@rislaed](https://vk.com/id268478382)) -- [getTileEntity](/api/namespace/TileEntity#getTileEntity) now guaranteed to return an already loaded TileEntity ([@reider745](https://vk.com/id500917624)) -- Fixed the display of certain items in containers ([@reider745](https://vk.com/id500917624)) -- Fixed player saturation changes ([@reider745](https://vk.com/id500917624)) -- Fixed emerald ore drops ([@mineexplorer](https://vk.com/id201975250)) -- Fixed nether fence models in interfaces ([@mineexplorer](https://vk.com/id201975250)) -- Fixed custom sky, sunset, and fog colors ([@zheka2304](https://vk.com/id24708057)) -- Disabled Realms support ([@rislaed](https://vk.com/id268478382)) +- Fixed the entity hurt event (@zheka2304) +- Fixed the [BlockSource.fetchEntitiesOfTypeInAABB](/api/class/BlockSource#fetchEntitiesOfTypeInAABB) method (@zheka2304) +- Fixed using items from mods on certain vanilla blocks (@rislaed) +- [getTileEntity](/api/namespace/TileEntity#getTileEntity) now guaranteed to return an already loaded TileEntity (@reider745) +- Fixed the display of certain items in containers (@reider745) +- Fixed player saturation changes (@reider745) +- Fixed emerald ore drops (@mineexplorer) +- Fixed nether fence models in interfaces (@mineexplorer) +- Fixed custom sky, sunset, and fog colors (@zheka2304) +- Disabled Realms support (@rislaed) -## 3.1.0b125 ([@reider745](https://vk.com/id500917624), [@rislaed](https://vk.com/id268478382)) +## 3.1.0b125 (@reider745, @rislaed) - Fixed saves were sometimes broken - Fixed custom colors for fog/water/sky @@ -51,7 +51,7 @@ Which will significantly improve performance and simplify the introduction of ne This version received support for 64-bit architectures (arm64-v8a), which also eliminated a number of crashes and increased overall stability. Some bugs are expected to be fixed with upcoming updates. -## 2.4.0b123 ([@rislaed](https://vk.com/id268478382)) +## 2.4.0b123 (@rislaed) Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). All subsequent updates are released for 64-bit devices and this packs will receive only critical bug fixes. @@ -78,7 +78,7 @@ Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). A - Minor tweaks & internal refactor -## 2.4.0b122 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b122 (@reider745) - Added [World.addListenerChunkStateChanged(listener, statesList)](/api/namespace/World#addListenerChunkStateChanged)/[addLocalListenerChunkStateChanged](/api/namespace/World#addLocalListenerChunkStateChanged) methods to track chunks loading and unloading - Added ability to get game settings via [Game.getOption(key)](/api/namespace/Game#getOption), use [Game.getOptions](/api/namespace/Game#getOptions) to list all available keys @@ -86,7 +86,7 @@ Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). A - Implemented binary data packets, pass an bytes array to send them - Fixed dispensers functionality with modded liquid buckets and also player identifier transfering to *CraftRecipePreProvided* callback -## 2.4.0b120-121 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b120-121 (@reider745) - Fixed mod browser proxy - Fixed broken saves bugs due to collision @@ -98,7 +98,7 @@ Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). A - Mod browser minor crash fixes - In-game minor crash fixes -## 2.4.0b118-119 ([@reider745](https://vk.com/id500917624)) +## 2.4.0b118-119 (@reider745) - Net protocol improvements - Added BlockSource methods for weather control @@ -108,7 +108,7 @@ Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). A ## 2.4.0b116-117 -Added modded server support based on [ZoteCore](https://github.com/Reider745/ZoteCoreLoader) by [@reider745](https://vk.com/id500917624), related changes: +Added modded server support based on [ZoteCore](https://github.com/Reider745/ZoteCoreLoader) by @reider745, related changes: - Fixed server list tab, modpacks can now have their own server list - Fixed player UUID was not stored, which broke local multiplayer inventory and servers @@ -116,9 +116,9 @@ Added modded server support based on [ZoteCore](https://github.com/Reider745/Zot - Added sync for biome ids - Other server-related fixes -:::note Other changes ([@reider745](https://vk.com/id500917624)) +:::note Other changes (@reider745) -- Added proxy to mod browser, which is used in case main url is not available (by [@spawnrys](https://vk.com/id549824423)) +- Added proxy to mod browser, which is used in case main url is not available (@spawnrys) - Fixed [client TileEntity sync](/api/namespace/TileEntity#LocalTileEntityPrototype), added methods [onConnectionPlayer](/api/namespace/TileEntity#onConnectionPlayer)/[onDisconnectionPlayer](/api/namespace/TileEntity#onDisconnectionPlayer) - In case of saves failture, they will now default to [empty js object](/api/namespace/Saver#getDefaultSaves) - Added ICRender condition [ICRender.BlockState(x, y, z, stateId, valueState)](/api/namespace/ICRender#BlockState) @@ -130,7 +130,7 @@ Added modded server support based on [ZoteCore](https://github.com/Reider745/Zot ::: -:::note Other changes ([@zheka_smirnov](https://vk.com/id24708057)) +:::note Other changes (@zheka2304) - Fixed frequent crashes when launching Inner Core - Updated Rhino to latest version - javascript engine for mods diff --git a/src/plugins/remark-authors.mjs b/src/plugins/remark-authors.mjs new file mode 100644 index 0000000000..d0a2ff438b --- /dev/null +++ b/src/plugins/remark-authors.mjs @@ -0,0 +1,61 @@ +// @ts-check +import { visit } from 'unist-util-visit'; + +async function processAuthors(node) { + let children = []; + let lastIndex = 0; + let match; + + const authorRegex = /\((@[\w\-]+(?:,\s*@[\w\-]+)*)\)/g; + while ((match = authorRegex.exec(node.value)) !== null) { + if (match.index > lastIndex) { + children.push({ + type: node.type, + value: node.value.slice(lastIndex, match.index) + }); + } + + const authors = match[1].split(',').map(s => s.trim().replace('@', '')); + + children.push({ + type: 'mdxJsxFlowElement', + name: 'GithubAuthors', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'authors', + value: JSON.stringify(authors) + } + ] + }); + + lastIndex = match.index + match[0].length; + } + + if (lastIndex > 0) { + if (lastIndex < node.value.length) { + children.push({ + type: node.type, + value: node.value.slice(lastIndex) + }); + } + + if (children.length > 0) { + node.type = 'root'; + node.children = children; + } + } +} + +export default function remarkAuthors() { + return async (tree) => { + const promises = []; + visit(tree, 'text', (node, index, parent) => { + if (!parent || index === undefined) { + return; + } + promises.push(processAuthors(node)); + }); + await Promise.all(promises); + }; +} diff --git a/src/theme/MDXComponents.tsx b/src/theme/MDXComponents.tsx index c0a0a5ece9..ef32520b78 100644 --- a/src/theme/MDXComponents.tsx +++ b/src/theme/MDXComponents.tsx @@ -1,9 +1,11 @@ import MDXComponents from '@theme-original/MDXComponents' import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import GithubAuthors from '../components/GithubAuthors'; export default { ...MDXComponents, Tabs, - TabItem + TabItem, + GithubAuthors }; From c04d5264ab1cda795d2490a5e15d2caa5198e0a8 Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Sat, 29 Nov 2025 20:28:33 +0300 Subject: [PATCH 2/2] Highly improved GithubAvatars styling, replacing in components --- docusaurus.config.ts | 6 +- .../changelog.md | 2 +- src/components/GithubAuthors.tsx | 13 ++-- src/css/custom.css | 53 +++++++++++++++ src/pages/changelog.md | 2 +- src/plugins/remark-authors.mjs | 61 ----------------- src/plugins/remark-authors.ts | 66 +++++++++++++++++++ 7 files changed, 133 insertions(+), 70 deletions(-) delete mode 100644 src/plugins/remark-authors.mjs create mode 100644 src/plugins/remark-authors.ts diff --git a/docusaurus.config.ts b/docusaurus.config.ts index d7ce983c1d..5c16b3af5e 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -24,7 +24,7 @@ import { Config } from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; import type * as Docs from '@docusaurus/plugin-content-docs'; import type * as Typedoc from './api/docusaurus-plugin'; -import remarkAuthors from './src/plugins/remark-authors.mjs'; +import remarkAuthors from './src/plugins/remark-authors'; import { readdirSync } from 'fs'; import path from 'path'; @@ -67,11 +67,11 @@ export default { editLocalizedFiles: true, editUrl: 'https://github.com/nernar/nernar.github.io/tree/master/', showLastUpdateTime: true, - remarkPlugins: [remarkAuthors] + beforeDefaultRemarkPlugins: [remarkAuthors] }, blog: false, pages: { - remarkPlugins: [remarkAuthors] + beforeDefaultRemarkPlugins: [remarkAuthors] }, theme: { customCss: require.resolve('./src/css/custom.css') diff --git a/i18n/ru/docusaurus-plugin-content-pages/changelog.md b/i18n/ru/docusaurus-plugin-content-pages/changelog.md index d8071139a2..96149b1f43 100644 --- a/i18n/ru/docusaurus-plugin-content-pages/changelog.md +++ b/i18n/ru/docusaurus-plugin-content-pages/changelog.md @@ -110,7 +110,7 @@ ## 2.4.0b116-117 -Добавлена поддержка серверов с модами на основе [ядра ZoteCore](https://github.com/Reider745/ZoteCoreLoader) от @reider745, что также включает в себя: +Добавлена поддержка серверов с модами на основе [ядра ZoteCore](https://github.com/Reider745/ZoteCoreLoader), что также включает в себя: - Исправления списка серверов (для модпаков список хранится в основной папке модпака) - Исправление не статичного uuid игрока (от параметров XUID и ника игрока), исправляет сохранения инвентаря в локальной игре diff --git a/src/components/GithubAuthors.tsx b/src/components/GithubAuthors.tsx index 1e3b1bdbd5..b4a3d1857c 100644 --- a/src/components/GithubAuthors.tsx +++ b/src/components/GithubAuthors.tsx @@ -2,22 +2,27 @@ import React from 'react'; export default function GithubAuthors({ authors }) { const authorList = typeof authors === 'string' ? JSON.parse(authors) : authors; + if (!Array.isArray(authorList) || authorList.length === 0) { + return null; + } return ( {authorList.map((author: any) => ( {`@${author}`} + loading="lazy" + onError={(e) => { + e.currentTarget.src = 'https://github.com/error.png?size=96'; + }} /> ))} diff --git a/src/css/custom.css b/src/css/custom.css index 1cd1af3c14..562601a7d5 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -434,3 +434,56 @@ details > div > div > div > :last-child { background-color: white; opacity: 8%; } + +/* src/components/GithubAuthors.tsx */ +.github-authors-inline { + display: inline-flex; + align-items: center; + position: relative; + height: 24px; + margin: 0 4px; + vertical-align: middle; +} + +.github-author-avatar { + position: relative; + display: inline-block; + width: 24px; + height: 24px; + border-radius: 50%; + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); +} + +.github-author-link:not(:first-child) { + margin-left: -12px; +} + +.github-authors-inline:hover .github-author-link { + margin-left: 0; + transform: translateX(0); +} + +.github-authors-inline .github-author-link:hover { + transform: scale(1.8) !important; + z-index: 10; +} + +.github-authors-inline .github-author-avatar:hover { + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); +} + +.github-authors-inline:hover .github-author-link { + transition-delay: 0.1s; +} + +.github-authors-inline .github-author-link { + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); +} + +.github-author-avatar[src=""] { + display: none; +} + +.github-author-link:has(.github-author-avatar[src=""]) { + display: none; +} diff --git a/src/pages/changelog.md b/src/pages/changelog.md index f48103f20e..0de3779665 100644 --- a/src/pages/changelog.md +++ b/src/pages/changelog.md @@ -108,7 +108,7 @@ Most likely, this is the latest version for ARM32 architectures (armeabi-v7a). A ## 2.4.0b116-117 -Added modded server support based on [ZoteCore](https://github.com/Reider745/ZoteCoreLoader) by @reider745, related changes: +Added modded server support based on [ZoteCore](https://github.com/Reider745/ZoteCoreLoader), related changes: - Fixed server list tab, modpacks can now have their own server list - Fixed player UUID was not stored, which broke local multiplayer inventory and servers diff --git a/src/plugins/remark-authors.mjs b/src/plugins/remark-authors.mjs deleted file mode 100644 index d0a2ff438b..0000000000 --- a/src/plugins/remark-authors.mjs +++ /dev/null @@ -1,61 +0,0 @@ -// @ts-check -import { visit } from 'unist-util-visit'; - -async function processAuthors(node) { - let children = []; - let lastIndex = 0; - let match; - - const authorRegex = /\((@[\w\-]+(?:,\s*@[\w\-]+)*)\)/g; - while ((match = authorRegex.exec(node.value)) !== null) { - if (match.index > lastIndex) { - children.push({ - type: node.type, - value: node.value.slice(lastIndex, match.index) - }); - } - - const authors = match[1].split(',').map(s => s.trim().replace('@', '')); - - children.push({ - type: 'mdxJsxFlowElement', - name: 'GithubAuthors', - attributes: [ - { - type: 'mdxJsxAttribute', - name: 'authors', - value: JSON.stringify(authors) - } - ] - }); - - lastIndex = match.index + match[0].length; - } - - if (lastIndex > 0) { - if (lastIndex < node.value.length) { - children.push({ - type: node.type, - value: node.value.slice(lastIndex) - }); - } - - if (children.length > 0) { - node.type = 'root'; - node.children = children; - } - } -} - -export default function remarkAuthors() { - return async (tree) => { - const promises = []; - visit(tree, 'text', (node, index, parent) => { - if (!parent || index === undefined) { - return; - } - promises.push(processAuthors(node)); - }); - await Promise.all(promises); - }; -} diff --git a/src/plugins/remark-authors.ts b/src/plugins/remark-authors.ts new file mode 100644 index 0000000000..3cc1bb1d80 --- /dev/null +++ b/src/plugins/remark-authors.ts @@ -0,0 +1,66 @@ +import type { Transformer } from 'unified'; +import type { Root, Text } from 'mdast'; + +async function processAuthors(text: Text) { + let children = []; + let lastIndex = 0; + let match; + + const authorRegex = /\((@[\w\-]+(?:,\s*@[\w\-]+)*)\)/g; + while ((match = authorRegex.exec(text.value)) !== null) { + if (match.index > lastIndex) { + children.push({ + type: text.type, + value: text.value.slice(lastIndex, match.index) + }); + } + + const authors = match[1].split(',') + .map(author => author.trim().replace('@', '')) + .filter(author => author.length > 0); + + if (authors.length > 0) { + children.push({ + type: 'mdxJsxFlowElement', + name: 'GithubAuthors', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'authors', + value: JSON.stringify(authors) + } + ] + }); + } + + lastIndex = match.index + match[0].length; + } + + if (lastIndex > 0) { + if (lastIndex < text.value.length) { + children.push({ + type: text.type, + value: text.value.slice(lastIndex) + }); + } + + if (children.length > 0) { + const node: Root = text as unknown as Root; + node.type = 'root'; + node.children = children; + } + } +} +export default function plugin(): Transformer { + return async (tree) => { + const promises = []; + const { visit } = await import('unist-util-visit'); + visit(tree, 'text', (node, index, parent) => { + if (!parent || index === undefined) { + return; + } + promises.push(processAuthors(node)); + }); + await Promise.all(promises); + }; +}