Closed addshore closed 3 weeks ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
vitepress-theme-openapi | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 16, 2024 10:22am |
Los cambios realizados en la función useSidebar
permiten una mayor flexibilidad en la generación de elementos y grupos del sidebar al introducir un prefijo de enlace personalizable. Se ha modificado la forma en que se generan los enlaces para cada operación, permitiendo que el prefijo se ajuste según el contexto. Esto se logra mediante la adición de un parámetro linkPrefix
en las funciones generateSidebarItem
, generateSidebarGroup
y generateSidebarGroups
, manteniendo la compatibilidad con el comportamiento predeterminado existente.
Archivos | Resumen de cambios |
---|---|
src/composables/useSidebar.ts |
Se modificaron las funciones generateSidebarItem , generateSidebarGroup y generateSidebarGroups para aceptar un parámetro adicional linkPrefix , que permite la personalización de los enlaces generados. Se estableció un valor predeterminado para este prefijo y se mantuvo la lógica existente. |
Objetivo | Abordado | Explicación |
---|---|---|
Personalizar el enlace del elemento del menú del sidebar (38) | ✅ | |
Permitir enlaces a diferentes especificaciones bajo diferentes prefijos de URL (38) | ✅ |
src/composables/useSidebar.ts (3)
Line range hint `8-24`: **¡Buen trabajo! Los cambios en la función `generateSidebarItem` mejoran la flexibilidad.** La adición del parámetro `linkPrefix` con un valor predeterminado permite generar enlaces de elementos de la barra lateral personalizados sin afectar el comportamiento existente. Esto facilita la adaptación de la barra lateral a diferentes estructuras de URL manteniendo la compatibilidad hacia atrás. --- Line range hint `26-51`: **¡Excelente! La función `generateSidebarGroup` ahora acepta un prefijo de enlace personalizado.** Al pasar el parámetro `linkPrefix` a la función `generateSidebarItem`, se asegura que todos los elementos de la barra lateral generados dentro de un grupo utilicen el mismo prefijo de enlace. Esto mejora la coherencia y flexibilidad en la generación de enlaces para los grupos de la barra lateral. --- Line range hint `53-69`: **¡Fantástico! La función `generateSidebarGroups` propaga el prefijo de enlace a todos los grupos.** Al pasar el parámetro `linkPrefix` a las llamadas de `generateSidebarGroup`, se garantiza que todos los grupos de la barra lateral y sus elementos internos utilicen el mismo prefijo de enlace. Esto mejora la coherencia y adaptabilidad de la estructura general de la barra lateral a diferentes esquemas de URL.
pnpm add https://pkg.pr.new/vitepress-theme-openapi@41
pnpm add https://pkg.pr.new/vitepress-theme-openapi@41
commit: 849c5aa
Hi @addshore , thanks for working on this, however I think we have to be prepared for eventually more customizations, like to generate sidebar items for specific tags, with specific linkPrefix, and so on...
So, I've made another PR #44 that implements it via object args. It allows to globally configure a linkPrefix, or to override it in generateSidebarGroups
.
Can you please check it and evaluate if is a better alternative? In that case, we will close this PR in favor of #44 .
Fixes #38
Summary by CodeRabbit