@ampernic/vitepress-theme-alt-docs 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +232 -0
- package/dist/components/ADAssetLink.vue +9 -0
- package/dist/components/ADBranding.vue +68 -0
- package/dist/components/ADInlineImage.vue +17 -0
- package/dist/components/ADNavBarSearch.vue +88 -0
- package/dist/components/ADProducts.vue +192 -0
- package/dist/components/ADProductsSidebar.vue +119 -0
- package/dist/components/ADSearch.vue +27 -0
- package/dist/composables/useEditLink.d.ts +1 -0
- package/dist/composables/useEditLink.mjs +8 -0
- package/dist/composables/useHashScroll.d.ts +14 -0
- package/dist/composables/useHashScroll.mjs +69 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.mjs +2 -0
- package/dist/config/ru-shared.d.ts +15 -0
- package/dist/config/ru-shared.js +78 -0
- package/dist/config/ru-shared.mjs +63 -0
- package/dist/config/shared.d.ts +37 -0
- package/dist/config/shared.js +115 -0
- package/dist/config/shared.mjs +105 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +44 -0
- package/dist/styles/custom.css +132 -0
- package/dist/styles/icons.css +37 -0
- package/dist/styles/print.css +36 -0
- package/dist/styles/theme.css +141 -0
- package/package.json +56 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="isLandingPage && origin" class="products-sidebar">
|
|
3
|
+
<div class="group">
|
|
4
|
+
<p class="group-title">Дистрибутивы</p>
|
|
5
|
+
<a
|
|
6
|
+
v-for="d in regular"
|
|
7
|
+
:key="d"
|
|
8
|
+
:href="`${origin}/${d}/`"
|
|
9
|
+
class="item"
|
|
10
|
+
:class="{ active: d === currentDistro }"
|
|
11
|
+
>{{ productName(d) }}</a>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="group">
|
|
14
|
+
<p class="group-title">Для Эльбрус</p>
|
|
15
|
+
<a
|
|
16
|
+
v-for="d in e2k"
|
|
17
|
+
:key="d"
|
|
18
|
+
:href="`${origin}/${d}/`"
|
|
19
|
+
class="item"
|
|
20
|
+
:class="{ active: d === currentDistro }"
|
|
21
|
+
>{{ productName(d) }}</a>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { computed, ref, onMounted } from 'vue'
|
|
28
|
+
import { useRoute, useData } from 'vitepress'
|
|
29
|
+
|
|
30
|
+
const route = useRoute()
|
|
31
|
+
const { site } = useData()
|
|
32
|
+
const origin = ref('')
|
|
33
|
+
onMounted(() => { origin.value = window.location.origin })
|
|
34
|
+
|
|
35
|
+
const ALL_DISTROS = [
|
|
36
|
+
'alt-domain', 'alt-education', 'alt-kworkstation', 'alt-mobile',
|
|
37
|
+
'alt-platform', 'alt-server', 'alt-server-v', 'alt-virtualisation-one',
|
|
38
|
+
'alt-virtualization-pve', 'alt-workstation', 'group-policy', 'simply-linux',
|
|
39
|
+
'alt-education-e2k', 'alt-server-e2k', 'alt-workstation-e2k', 'simply-linux-e2k',
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
const PRODUCT_NAMES: Record<string, string> = {
|
|
43
|
+
'alt-domain': 'Альт Домен',
|
|
44
|
+
'alt-education': 'Альт Образование',
|
|
45
|
+
'alt-education-e2k': 'Альт Образование для Эльбрус',
|
|
46
|
+
'alt-server': 'Альт Сервер',
|
|
47
|
+
'alt-server-e2k': 'Альт Сервер для Эльбрус',
|
|
48
|
+
'alt-server-v': 'Альт Сервер Виртуализации',
|
|
49
|
+
'alt-workstation': 'Альт Рабочая станция',
|
|
50
|
+
'alt-workstation-e2k': 'Альт Рабочая станция для Эльбрус',
|
|
51
|
+
'alt-kworkstation': 'Альт Рабочая станция K',
|
|
52
|
+
'alt-platform': 'Альт Платформа',
|
|
53
|
+
'alt-mobile': 'Альт Мобильный',
|
|
54
|
+
'alt-virtualisation-one': 'Альт Виртуализация ONE',
|
|
55
|
+
'alt-virtualization-pve': 'Альт Виртуализация PVE',
|
|
56
|
+
'simply-linux': 'Симпли Линукс',
|
|
57
|
+
'simply-linux-e2k': 'Симпли Линукс для Эльбрус',
|
|
58
|
+
'group-policy': 'Групповые политики',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const productName = (d: string) => PRODUCT_NAMES[d] ?? d
|
|
62
|
+
|
|
63
|
+
const regular = ALL_DISTROS.filter(d => !d.endsWith('-e2k'))
|
|
64
|
+
const e2k = ALL_DISTROS.filter(d => d.endsWith('-e2k'))
|
|
65
|
+
|
|
66
|
+
// Strip base from route.path to get content path
|
|
67
|
+
const contentPath = computed(() => {
|
|
68
|
+
const base = site.value.base
|
|
69
|
+
const path = route.path
|
|
70
|
+
return base.length > 1 && path.startsWith(base) ? path.slice(base.length - 1) : path
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// Show only on the landing page (no version in path like /11.0/...)
|
|
74
|
+
const isLandingPage = computed(() => {
|
|
75
|
+
const parts = contentPath.value.split('/').filter(Boolean)
|
|
76
|
+
return parts.length === 0 || !/^\d+\.\d+/.test(parts[0])
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Current distro is encoded in the base (per-distro mode)
|
|
80
|
+
const currentDistro = computed(() => {
|
|
81
|
+
const base = site.value.base // e.g. '/alt-domain/'
|
|
82
|
+
return base.length > 1 ? base.replace(/\//g, '') : null
|
|
83
|
+
})
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style scoped>
|
|
87
|
+
.products-sidebar {
|
|
88
|
+
padding: 12px 0;
|
|
89
|
+
}
|
|
90
|
+
.group {
|
|
91
|
+
margin-bottom: 16px;
|
|
92
|
+
}
|
|
93
|
+
.group-title {
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
color: var(--vp-c-text-2);
|
|
97
|
+
text-transform: uppercase;
|
|
98
|
+
letter-spacing: 0.05em;
|
|
99
|
+
padding: 0 24px;
|
|
100
|
+
margin: 0 0 6px;
|
|
101
|
+
}
|
|
102
|
+
.item {
|
|
103
|
+
display: block;
|
|
104
|
+
padding: 4px 24px;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
color: var(--vp-c-text-1);
|
|
107
|
+
text-decoration: none;
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
transition: color 0.2s, background 0.2s;
|
|
110
|
+
}
|
|
111
|
+
.item:hover {
|
|
112
|
+
color: var(--vp-c-brand-1);
|
|
113
|
+
background: var(--vp-c-default-soft);
|
|
114
|
+
}
|
|
115
|
+
.item.active {
|
|
116
|
+
color: var(--vp-c-brand-1);
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { PagefindSearch } from '@ampernic/vitepress-plugin-pagefind/client'
|
|
3
|
+
import { useRoute } from 'vitepress'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits<{ (e: 'close'): void }>()
|
|
7
|
+
|
|
8
|
+
const route = useRoute()
|
|
9
|
+
|
|
10
|
+
const filters = computed(() => {
|
|
11
|
+
const m = route.path.match(/^\/(\d+\.\d+(?:-\w+)?)\//)
|
|
12
|
+
const ver = m?.[1]
|
|
13
|
+
return ver ? { version: ver } : {}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const placeholder = computed(() =>
|
|
17
|
+
filters.value.version ? `Поиск в версии ${filters.value.version}…` : 'Поиск…',
|
|
18
|
+
)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<PagefindSearch
|
|
23
|
+
:filters="filters"
|
|
24
|
+
:placeholder="placeholder"
|
|
25
|
+
@close="emit('close')"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCurrentGitBranch(): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scrolls to the URL hash after the page is fully ready.
|
|
3
|
+
*
|
|
4
|
+
* Direct page load: wait for window.load (all images loaded) + nolebase
|
|
5
|
+
* transition (0.5s), then scroll once. This is the reliable path.
|
|
6
|
+
*
|
|
7
|
+
* SPA navigation: use ResizeObserver + MutationObserver as before.
|
|
8
|
+
*
|
|
9
|
+
* Layout switch: nolebase applies body class changes when user switches layout
|
|
10
|
+
* mode manually. Re-scroll to current hash after the transition settles.
|
|
11
|
+
*
|
|
12
|
+
* scroll-margin-top (theme.css) handles fixed navbar offset.
|
|
13
|
+
*/
|
|
14
|
+
export declare function installHashScrollFix(router: any): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const NOLEBASE_TRANSITION_MS = 600;
|
|
2
|
+
function scrollToHash(hash) {
|
|
3
|
+
const id = decodeURIComponent(hash.startsWith("#") ? hash.slice(1) : hash);
|
|
4
|
+
const target = document.getElementById(id) ?? document.querySelector(`[name="${CSS.escape(id)}"]`);
|
|
5
|
+
target?.scrollIntoView();
|
|
6
|
+
}
|
|
7
|
+
function trackHashSPA(hash) {
|
|
8
|
+
scrollToHash(hash);
|
|
9
|
+
let stopped = false;
|
|
10
|
+
let stableTimer = null;
|
|
11
|
+
function stop() {
|
|
12
|
+
stopped = true;
|
|
13
|
+
resizeObserver.disconnect();
|
|
14
|
+
mutationObserver.disconnect();
|
|
15
|
+
clearTimeout(totalTimer);
|
|
16
|
+
if (stableTimer) clearTimeout(stableTimer);
|
|
17
|
+
}
|
|
18
|
+
let nolebaseActive = false;
|
|
19
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
20
|
+
if (stopped) return;
|
|
21
|
+
if (stableTimer) clearTimeout(stableTimer);
|
|
22
|
+
stableTimer = setTimeout(
|
|
23
|
+
() => {
|
|
24
|
+
stop();
|
|
25
|
+
scrollToHash(hash);
|
|
26
|
+
},
|
|
27
|
+
nolebaseActive ? NOLEBASE_TRANSITION_MS : 300
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
resizeObserver.observe(document.body);
|
|
31
|
+
const mutationObserver = new MutationObserver(() => {
|
|
32
|
+
if (stopped) return;
|
|
33
|
+
nolebaseActive = true;
|
|
34
|
+
if (stableTimer) clearTimeout(stableTimer);
|
|
35
|
+
stableTimer = setTimeout(() => {
|
|
36
|
+
stop();
|
|
37
|
+
scrollToHash(hash);
|
|
38
|
+
}, NOLEBASE_TRANSITION_MS);
|
|
39
|
+
});
|
|
40
|
+
mutationObserver.observe(document.body, { attributes: true, attributeFilter: ["class"] });
|
|
41
|
+
const totalTimer = setTimeout(() => {
|
|
42
|
+
stop();
|
|
43
|
+
scrollToHash(hash);
|
|
44
|
+
}, 7e3);
|
|
45
|
+
}
|
|
46
|
+
export function installHashScrollFix(router) {
|
|
47
|
+
const prev = router.onAfterRouteChanged;
|
|
48
|
+
router.onAfterRouteChanged = (href) => {
|
|
49
|
+
prev?.(href);
|
|
50
|
+
if (typeof window === "undefined") return;
|
|
51
|
+
let hash = "";
|
|
52
|
+
try {
|
|
53
|
+
hash = new URL(href, window.location.origin).hash;
|
|
54
|
+
} catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (hash) trackHashSPA(hash);
|
|
58
|
+
};
|
|
59
|
+
if (typeof window !== "undefined" && window.location.hash) {
|
|
60
|
+
const hash = window.location.hash;
|
|
61
|
+
if (document.readyState === "complete") {
|
|
62
|
+
setTimeout(() => scrollToHash(hash), NOLEBASE_TRANSITION_MS);
|
|
63
|
+
} else {
|
|
64
|
+
window.addEventListener("load", () => {
|
|
65
|
+
setTimeout(() => scrollToHash(hash), NOLEBASE_TRANSITION_MS);
|
|
66
|
+
}, { once: true });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "createRuConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ruShared.createRuConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createSharedConfig", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _shared.createSharedConfig;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _shared = require("./shared");
|
|
19
|
+
var _ruShared = require("./ru-shared");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DefaultTheme } from 'vitepress';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a VitePress locale config for the Russian language.
|
|
4
|
+
*
|
|
5
|
+
* @param sidebar - Per-distro sidebar definition.
|
|
6
|
+
* @param editLinkRepo - Forgejo repository base URL for "suggest edits" links.
|
|
7
|
+
* Defaults to the BaseALT docs-vitepress repo.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // .vitepress/config/ru.ts
|
|
11
|
+
* import { createRuConfig } from '@ampernic/vitepress-theme-alt-docs/config'
|
|
12
|
+
* import { sidebar } from './sidebars'
|
|
13
|
+
* export const ru = createRuConfig(sidebar)
|
|
14
|
+
*/
|
|
15
|
+
export declare function createRuConfig(sidebar: DefaultTheme.Sidebar, editLinkRepo?: string): import("vitepress").UserConfig<DefaultTheme.Config>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRuConfig = createRuConfig;
|
|
7
|
+
var _child_process = require("child_process");
|
|
8
|
+
var _vitepress = require("vitepress");
|
|
9
|
+
function getCurrentGitBranch() {
|
|
10
|
+
try {
|
|
11
|
+
return (0, _child_process.execSync)("git branch --show-current", {
|
|
12
|
+
encoding: "utf-8"
|
|
13
|
+
}).trim() || "main";
|
|
14
|
+
} catch {
|
|
15
|
+
return "main";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const navbar = [{
|
|
19
|
+
component: "ADProducts"
|
|
20
|
+
}, {
|
|
21
|
+
component: "ADVersioning"
|
|
22
|
+
}];
|
|
23
|
+
function createRuConfig(sidebar, editLinkRepo = "https://altlinux.space/alt-docs/docs-vitepress") {
|
|
24
|
+
const branch = getCurrentGitBranch();
|
|
25
|
+
return (0, _vitepress.defineConfigWithTheme)({
|
|
26
|
+
lang: "ru-RU",
|
|
27
|
+
titleTemplate: ":title \u2014 ALT Linux Docs",
|
|
28
|
+
themeConfig: {
|
|
29
|
+
nav: navbar,
|
|
30
|
+
// The empty object at '/' forces VitePress hasSidebar=true on the landing
|
|
31
|
+
// page so that sidebar-nav-before slot (ADProductsSidebar) renders.
|
|
32
|
+
// VPSidebarItem skips rendering when text is falsy, so {} is invisible.
|
|
33
|
+
sidebar: {
|
|
34
|
+
"/": [{}],
|
|
35
|
+
...(Array.isArray(sidebar) ? {} : sidebar)
|
|
36
|
+
},
|
|
37
|
+
search: {
|
|
38
|
+
provider: "local",
|
|
39
|
+
options: {
|
|
40
|
+
translations: {
|
|
41
|
+
button: {
|
|
42
|
+
buttonText: "\u041F\u043E\u0438\u0441\u043A",
|
|
43
|
+
buttonAriaLabel: "\u041F\u043E\u0438\u0441\u043A"
|
|
44
|
+
},
|
|
45
|
+
modal: {
|
|
46
|
+
noResultsText: "\u041D\u0435\u0442 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432 \u043F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443",
|
|
47
|
+
resetButtonTitle: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",
|
|
48
|
+
footer: {
|
|
49
|
+
selectText: "\u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u0430",
|
|
50
|
+
navigateText: "\u0434\u043B\u044F \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438",
|
|
51
|
+
closeText: "\u0437\u0430\u043A\u0440\u044B\u0442\u044C"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
sidebarMenuLabel: "\u041C\u0435\u043D\u044E",
|
|
58
|
+
returnToTopLabel: "\u041D\u0430\u0432\u0435\u0440\u0445",
|
|
59
|
+
outline: {
|
|
60
|
+
label: "\u041E\u0433\u043B\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
|
|
61
|
+
level: [1, 3]
|
|
62
|
+
},
|
|
63
|
+
docFooter: {
|
|
64
|
+
prev: "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",
|
|
65
|
+
next: "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430"
|
|
66
|
+
},
|
|
67
|
+
notFound: {
|
|
68
|
+
title: "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430",
|
|
69
|
+
quote: "\u041F\u043E\u0445\u043E\u0436\u0435, \u0447\u0442\u043E \u0432\u044B \u043F\u0435\u0440\u0435\u0448\u043B\u0438 \u043F\u043E \u043D\u0435\u0432\u0435\u0440\u043D\u043E\u0439 \u0438\u043B\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0441\u0441\u044B\u043B\u043A\u0435. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u043F\u043E\u0438\u0441\u043A\u043E\u043C.",
|
|
70
|
+
linkText: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E"
|
|
71
|
+
},
|
|
72
|
+
editLink: {
|
|
73
|
+
pattern: `${editLinkRepo}/src/branch/${branch}/docs/:path`,
|
|
74
|
+
text: "\u041F\u0440\u0435\u0434\u043B\u043E\u0436\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043D\u0430 \u044D\u0442\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { defineConfigWithTheme } from "vitepress";
|
|
3
|
+
function getCurrentGitBranch() {
|
|
4
|
+
try {
|
|
5
|
+
return execSync("git branch --show-current", { encoding: "utf-8" }).trim() || "main";
|
|
6
|
+
} catch {
|
|
7
|
+
return "main";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const navbar = [
|
|
11
|
+
{ component: "ADProducts" },
|
|
12
|
+
{ component: "ADVersioning" }
|
|
13
|
+
];
|
|
14
|
+
export function createRuConfig(sidebar, editLinkRepo = "https://altlinux.space/alt-docs/docs-vitepress") {
|
|
15
|
+
const branch = getCurrentGitBranch();
|
|
16
|
+
return defineConfigWithTheme({
|
|
17
|
+
lang: "ru-RU",
|
|
18
|
+
titleTemplate: ":title \u2014 ALT Linux Docs",
|
|
19
|
+
themeConfig: {
|
|
20
|
+
nav: navbar,
|
|
21
|
+
// The empty object at '/' forces VitePress hasSidebar=true on the landing
|
|
22
|
+
// page so that sidebar-nav-before slot (ADProductsSidebar) renders.
|
|
23
|
+
// VPSidebarItem skips rendering when text is falsy, so {} is invisible.
|
|
24
|
+
sidebar: {
|
|
25
|
+
"/": [{}],
|
|
26
|
+
...Array.isArray(sidebar) ? {} : sidebar
|
|
27
|
+
},
|
|
28
|
+
search: {
|
|
29
|
+
provider: "local",
|
|
30
|
+
options: {
|
|
31
|
+
translations: {
|
|
32
|
+
button: { buttonText: "\u041F\u043E\u0438\u0441\u043A", buttonAriaLabel: "\u041F\u043E\u0438\u0441\u043A" },
|
|
33
|
+
modal: {
|
|
34
|
+
noResultsText: "\u041D\u0435\u0442 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432 \u043F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443",
|
|
35
|
+
resetButtonTitle: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",
|
|
36
|
+
footer: {
|
|
37
|
+
selectText: "\u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u0430",
|
|
38
|
+
navigateText: "\u0434\u043B\u044F \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438",
|
|
39
|
+
closeText: "\u0437\u0430\u043A\u0440\u044B\u0442\u044C"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
sidebarMenuLabel: "\u041C\u0435\u043D\u044E",
|
|
46
|
+
returnToTopLabel: "\u041D\u0430\u0432\u0435\u0440\u0445",
|
|
47
|
+
outline: { label: "\u041E\u0433\u043B\u0430\u0432\u043B\u0435\u043D\u0438\u0435", level: [1, 3] },
|
|
48
|
+
docFooter: {
|
|
49
|
+
prev: "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",
|
|
50
|
+
next: "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430"
|
|
51
|
+
},
|
|
52
|
+
notFound: {
|
|
53
|
+
title: "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430",
|
|
54
|
+
quote: "\u041F\u043E\u0445\u043E\u0436\u0435, \u0447\u0442\u043E \u0432\u044B \u043F\u0435\u0440\u0435\u0448\u043B\u0438 \u043F\u043E \u043D\u0435\u0432\u0435\u0440\u043D\u043E\u0439 \u0438\u043B\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0441\u0441\u044B\u043B\u043A\u0435. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u043F\u043E\u0438\u0441\u043A\u043E\u043C.",
|
|
55
|
+
linkText: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E"
|
|
56
|
+
},
|
|
57
|
+
editLink: {
|
|
58
|
+
pattern: `${editLinkRepo}/src/branch/${branch}/docs/:path`,
|
|
59
|
+
text: "\u041F\u0440\u0435\u0434\u043B\u043E\u0436\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043D\u0430 \u044D\u0442\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DefaultTheme } from 'vitepress';
|
|
2
|
+
export interface SharedConfigOptions {
|
|
3
|
+
/** Distro slug for this VitePress instance, e.g. `'alt-domain'`. */
|
|
4
|
+
distroName: string;
|
|
5
|
+
/**
|
|
6
|
+
* Full list of all distros to show in the ADProducts switcher.
|
|
7
|
+
* When omitted only the current distro appears in the menu — fine for local dev.
|
|
8
|
+
*/
|
|
9
|
+
allDistros?: string[];
|
|
10
|
+
/** Sitemap hostname, e.g. `'https://docs.altlinux.org'`. */
|
|
11
|
+
hostname?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Forgejo repository URL for "suggest edits" links.
|
|
14
|
+
* @default 'https://altlinux.space/alt-docs/docs-vitepress'
|
|
15
|
+
*/
|
|
16
|
+
editLinkRepo?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates the shared VitePress config for a single-distro instance.
|
|
20
|
+
* The `VersioningPlugin` handles all filesystem scanning in the Vite
|
|
21
|
+
* plugin hook (Node.js context) and injects `__VERSIONS_DATA__` via `define`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // .vitepress/config/index.mts
|
|
25
|
+
* import { defineConfigWithTheme } from 'vitepress'
|
|
26
|
+
* import { createSharedConfig } from '@ampernic/vitepress-theme-alt-docs/config'
|
|
27
|
+
* import { ru } from './ru'
|
|
28
|
+
*
|
|
29
|
+
* const shared = createSharedConfig({ distroName: 'alt-domain', allDistros: [...] })
|
|
30
|
+
*
|
|
31
|
+
* export default defineConfigWithTheme({
|
|
32
|
+
* ...shared,
|
|
33
|
+
* rewrites: { 'ru/:slug*': ':slug*' },
|
|
34
|
+
* locales: { root: { label: 'Русский', ...ru } },
|
|
35
|
+
* })
|
|
36
|
+
*/
|
|
37
|
+
export declare function createSharedConfig(options: SharedConfigOptions): import("vitepress").UserConfig<DefaultTheme.Config>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSharedConfig = createSharedConfig;
|
|
7
|
+
var _vitepress = require("vitepress");
|
|
8
|
+
var _vitepressPluginTabs = require("vitepress-plugin-tabs");
|
|
9
|
+
var _markdownItCustomContainers = require("@alt-gnome/markdown-it-custom-containers");
|
|
10
|
+
var _markdownItKbd = _interopRequireDefault(require("markdown-it-kbd"));
|
|
11
|
+
var _vitepressPluginAltDocsVersioning = require("@ampernic/vitepress-plugin-alt-docs-versioning");
|
|
12
|
+
var _vitepressPluginHtmlImage = require("@ampernic/vitepress-plugin-html-image");
|
|
13
|
+
var _vitepressPluginPagefind = require("@ampernic/vitepress-plugin-pagefind");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function createSharedConfig(options) {
|
|
16
|
+
const base = process.env.VITE_BASE ?? "/";
|
|
17
|
+
const pagefind = (0, _vitepressPluginPagefind.PagefindPlugin)({
|
|
18
|
+
extractFilters: id => {
|
|
19
|
+
const m = id.match(/[/\\](\d+\.\d+(?:-\w+)?)[/\\]/);
|
|
20
|
+
return m ? {
|
|
21
|
+
version: m[1]
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return (0, _vitepress.defineConfigWithTheme)({
|
|
26
|
+
...pagefind,
|
|
27
|
+
vue: {
|
|
28
|
+
template: {
|
|
29
|
+
transformAssetUrls: {
|
|
30
|
+
video: ["src", "poster"],
|
|
31
|
+
source: ["src"],
|
|
32
|
+
img: ["src"],
|
|
33
|
+
image: ["xlink:href", "href"],
|
|
34
|
+
use: ["xlink:href", "href"],
|
|
35
|
+
InlineImage: ["src"],
|
|
36
|
+
AssetLink: ["href"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
vite: {
|
|
41
|
+
assetsInclude: ["**/*.sh"],
|
|
42
|
+
optimizeDeps: {
|
|
43
|
+
include: ["@ampernic/vitepress-plugin-alt-docs-versioning"],
|
|
44
|
+
exclude: ["@nolebase/vitepress-plugin-enhanced-readabilities/client", "vitepress", "@nolebase/ui", "@ampernic/vitepress-theme-alt-docs"]
|
|
45
|
+
},
|
|
46
|
+
ssr: {
|
|
47
|
+
noExternal: ["@nolebase/vitepress-plugin-enhanced-readabilities", "@nolebase/ui", "@ampernic/vitepress-plugin-alt-docs-versioning", "@ampernic/vitepress-theme-alt-docs"]
|
|
48
|
+
},
|
|
49
|
+
plugins: [...pagefind.vite.plugins, (0, _vitepressPluginAltDocsVersioning.VersioningPlugin)({
|
|
50
|
+
distroName: options.distroName,
|
|
51
|
+
allDistros: options.allDistros
|
|
52
|
+
})]
|
|
53
|
+
},
|
|
54
|
+
srcDir: "docs",
|
|
55
|
+
// @ts-ignore — publicDir not in VitePress 1.x types but valid at runtime
|
|
56
|
+
publicDir: "docs/public",
|
|
57
|
+
base,
|
|
58
|
+
head: [["link", {
|
|
59
|
+
rel: "icon",
|
|
60
|
+
type: "image/x-icon",
|
|
61
|
+
href: `${base}favicon.ico`
|
|
62
|
+
}]],
|
|
63
|
+
cleanUrls: true,
|
|
64
|
+
ignoreDeadLinks: true,
|
|
65
|
+
...(options.hostname && {
|
|
66
|
+
sitemap: {
|
|
67
|
+
hostname: options.hostname
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
themeConfig: {
|
|
71
|
+
logo: {
|
|
72
|
+
dark: "/branding/basealt/logo-dark.svg",
|
|
73
|
+
light: "/branding/basealt/logo-col.svg",
|
|
74
|
+
alt: "ALT Linux Documentation"
|
|
75
|
+
},
|
|
76
|
+
siteTitle: "ALT Linux Docs",
|
|
77
|
+
outline: {
|
|
78
|
+
level: [2, 3]
|
|
79
|
+
},
|
|
80
|
+
socialLinks: [{
|
|
81
|
+
icon: "altlinux-space",
|
|
82
|
+
link: "https://altlinux.space/alt-docs/docs-vitepress"
|
|
83
|
+
}]
|
|
84
|
+
},
|
|
85
|
+
markdown: {
|
|
86
|
+
container: {
|
|
87
|
+
tipLabel: "\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430",
|
|
88
|
+
warningLabel: "\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435",
|
|
89
|
+
dangerLabel: "\u041E\u0441\u0442\u043E\u0440\u043E\u0436\u043D\u043E",
|
|
90
|
+
infoLabel: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F",
|
|
91
|
+
detailsLabel: "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435"
|
|
92
|
+
},
|
|
93
|
+
config: md => {
|
|
94
|
+
md.use(_markdownItKbd.default);
|
|
95
|
+
md.use(_markdownItCustomContainers.createContainerPlugin, {
|
|
96
|
+
containers: [{
|
|
97
|
+
type: "left",
|
|
98
|
+
customClass: "left custom-block",
|
|
99
|
+
renderTitle: false
|
|
100
|
+
}, {
|
|
101
|
+
type: "center",
|
|
102
|
+
customClass: "center custom-block",
|
|
103
|
+
renderTitle: false
|
|
104
|
+
}, {
|
|
105
|
+
type: "right",
|
|
106
|
+
customClass: "right custom-block",
|
|
107
|
+
renderTitle: false
|
|
108
|
+
}]
|
|
109
|
+
});
|
|
110
|
+
md.use(_vitepressPluginTabs.tabsMarkdownPlugin);
|
|
111
|
+
md.use(_vitepressPluginHtmlImage.htmlImagePlugin);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|