docus 5.4.2 → 5.4.4
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.
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { kebabCase } from 'scule'
|
|
3
3
|
import type { ContentNavigationItem, Collections, DocsCollectionItem } from '@nuxt/content'
|
|
4
4
|
import { findPageHeadline } from '@nuxt/content/utils'
|
|
5
|
-
import { addPrerenderPath } from '../../utils/prerender'
|
|
6
5
|
|
|
7
6
|
definePageMeta({
|
|
8
7
|
layout: 'docs',
|
|
@@ -28,9 +27,6 @@ if (!page.value) {
|
|
|
28
27
|
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
// Add the page path to the prerender list
|
|
32
|
-
addPrerenderPath(`/raw${route.path}.md`)
|
|
33
|
-
|
|
34
30
|
const title = page.value.seo?.title || page.value.title
|
|
35
31
|
const description = page.value.seo?.description || page.value.description
|
|
36
32
|
|
package/content.config.ts
CHANGED
|
@@ -21,7 +21,7 @@ let collections: Record<string, DefinedCollection>
|
|
|
21
21
|
if (locales && Array.isArray(locales)) {
|
|
22
22
|
collections = {}
|
|
23
23
|
for (const locale of locales) {
|
|
24
|
-
const code = typeof locale === 'string' ? locale : locale.code
|
|
24
|
+
const code = (typeof locale === 'string' ? locale : locale.code).replace('-', '_')
|
|
25
25
|
|
|
26
26
|
collections[`landing_${code}`] = defineCollection({
|
|
27
27
|
type: 'page',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docus",
|
|
3
3
|
"description": "Nuxt layer for Docus documentation theme",
|
|
4
|
-
"version": "5.4.
|
|
4
|
+
"version": "5.4.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
7
7
|
"repository": {
|
|
@@ -22,29 +22,29 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@iconify-json/lucide": "^1.2.
|
|
26
|
-
"@iconify-json/simple-icons": "^1.2.
|
|
27
|
-
"@iconify-json/vscode-icons": "^1.2.
|
|
28
|
-
"@nuxt/content": "^3.
|
|
25
|
+
"@iconify-json/lucide": "^1.2.86",
|
|
26
|
+
"@iconify-json/simple-icons": "^1.2.67",
|
|
27
|
+
"@iconify-json/vscode-icons": "^1.2.40",
|
|
28
|
+
"@nuxt/content": "^3.11.0",
|
|
29
29
|
"@nuxt/image": "^2.0.0",
|
|
30
30
|
"@nuxt/kit": "^4.2.2",
|
|
31
31
|
"@nuxt/ui": "^4.3.0",
|
|
32
32
|
"@nuxtjs/i18n": "^10.2.1",
|
|
33
|
-
"@nuxtjs/mcp-toolkit": "^0.6.
|
|
34
|
-
"@nuxtjs/mdc": "^0.
|
|
33
|
+
"@nuxtjs/mcp-toolkit": "^0.6.2",
|
|
34
|
+
"@nuxtjs/mdc": "^0.20.0",
|
|
35
35
|
"@nuxtjs/robots": "^5.6.7",
|
|
36
36
|
"@vueuse/core": "^14.1.0",
|
|
37
37
|
"defu": "^6.1.4",
|
|
38
38
|
"exsolve": "^1.0.8",
|
|
39
39
|
"git-url-parse": "^16.1.0",
|
|
40
40
|
"minimark": "^0.2.0",
|
|
41
|
-
"motion-v": "^1.
|
|
42
|
-
"nuxt-llms": "^0.
|
|
41
|
+
"motion-v": "^1.9.0",
|
|
42
|
+
"nuxt-llms": "^0.2.0",
|
|
43
43
|
"nuxt-og-image": "^5.1.13",
|
|
44
44
|
"pkg-types": "^2.3.0",
|
|
45
45
|
"scule": "^1.3.0",
|
|
46
46
|
"tailwindcss": "^4.1.18",
|
|
47
|
-
"ufo": "^1.6.
|
|
47
|
+
"ufo": "^1.6.3",
|
|
48
48
|
"zod": "^4.3.5",
|
|
49
49
|
"zod-to-json-schema": "^3.25.1"
|
|
50
50
|
},
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { withLeadingSlash } from 'ufo'
|
|
2
|
-
import { stringify } from 'minimark/stringify'
|
|
3
|
-
import { queryCollection } from '@nuxt/content/server'
|
|
4
|
-
import type { Collections } from '@nuxt/content'
|
|
5
|
-
|
|
6
|
-
export default eventHandler(async (event) => {
|
|
7
|
-
const slug = getRouterParams(event)['slug.md']
|
|
8
|
-
if (!slug?.endsWith('.md')) {
|
|
9
|
-
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const path = withLeadingSlash(slug.replace('.md', ''))
|
|
13
|
-
const config = useRuntimeConfig(event).public
|
|
14
|
-
|
|
15
|
-
let collectionName = 'docs'
|
|
16
|
-
if (config.i18n?.locales) {
|
|
17
|
-
const pathSegments = path.split('/').filter(Boolean)
|
|
18
|
-
const firstSegment = pathSegments[0]
|
|
19
|
-
|
|
20
|
-
const availableLocales = config.i18n.locales.map((locale: string | { code: string }) =>
|
|
21
|
-
typeof locale === 'string' ? locale : locale.code,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
if (firstSegment && availableLocales.includes(firstSegment)) {
|
|
25
|
-
collectionName = `docs_${firstSegment}`
|
|
26
|
-
}
|
|
27
|
-
else if (config.i18n.defaultLocale) {
|
|
28
|
-
collectionName = `docs_${config.i18n.defaultLocale}`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const page = await queryCollection(event, collectionName as keyof Collections).path(path).first()
|
|
33
|
-
if (!page) {
|
|
34
|
-
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Add title and description to the top of the page if missing
|
|
38
|
-
if (page.body.value[0]?.[0] !== 'h1') {
|
|
39
|
-
page.body.value.unshift(['blockquote', {}, page.description])
|
|
40
|
-
page.body.value.unshift(['h1', {}, page.title])
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
setHeader(event, 'Content-Type', 'text/markdown; charset=utf-8')
|
|
44
|
-
return stringify({ ...page.body, type: 'minimark' }, { format: 'markdown/html' })
|
|
45
|
-
})
|