Skip to content

Commit f6e71a2

Browse files
Add docs route link resolution and update VueForge codeblock
1 parent 77f7f79 commit f6e71a2

11 files changed

Lines changed: 120 additions & 14 deletions

File tree

apps/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
},
1717
"dependencies": {
1818
"@codemonster-ru/vue-codeblock": "^2.2.0",
19-
"@codemonster-ru/vue-ssg-core": "^2.0.4",
20-
"@codemonster-ru/vueforge-codeblock": "^3.4.2",
19+
"@codemonster-ru/vue-ssg-core": "^2.1.0",
20+
"@codemonster-ru/vueforge-codeblock": "^3.5.0",
2121
"@codemonster-ru/vueforge-core": "^1.22.2",
2222
"@codemonster-ru/vueforge-icons": "^1.4.0",
2323
"@codemonster-ru/vueforge-layouts": "^1.13.2",

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/create-vue-ssg/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
<!-- markdownlint-disable MD024 -->
44

5+
## 2.0.7 - 2026-06-12
6+
7+
### Patch Changes
8+
9+
- Update generated templates to depend on
10+
`@codemonster-ru/vue-ssg-core@^2.1.0`.
11+
- Update the generated docs template to depend on
12+
`@codemonster-ru/vueforge-codeblock@^3.5.0`.
13+
514
## 2.0.6 - 2026-06-03
615

716
### Patch Changes

packages/create-vue-ssg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codemonster-ru/create-vue-ssg",
3-
"version": "2.0.6",
3+
"version": "2.0.7",
44
"description": "Scaffold a Codemonster SSG project.",
55
"keywords": [
66
"create",

packages/create-vue-ssg/templates/default/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"typecheck": "vue-tsc --noEmit"
1212
},
1313
"dependencies": {
14-
"@codemonster-ru/vue-ssg-core": "^2.0.4",
14+
"@codemonster-ru/vue-ssg-core": "^2.1.0",
1515
"vite-ssg": "^28.3.0",
1616
"vue": "^3.5.13",
1717
"vue-router": "^5.0.4"

packages/create-vue-ssg/templates/docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"check": "npm run typecheck && npm run build"
1616
},
1717
"dependencies": {
18-
"@codemonster-ru/vue-ssg-core": "^2.0.4",
19-
"@codemonster-ru/vueforge-codeblock": "^3.4.2",
18+
"@codemonster-ru/vue-ssg-core": "^2.1.0",
19+
"@codemonster-ru/vueforge-codeblock": "^3.5.0",
2020
"@codemonster-ru/vueforge-core": "^1.22.2",
2121
"@codemonster-ru/vueforge-icons": "^1.4.0",
2222
"@codemonster-ru/vueforge-layouts": "^1.13.2",

packages/vue-ssg-core/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
<!-- markdownlint-disable MD024 -->
44

5+
## 2.1.0 - 2026-06-12
6+
7+
### Minor Changes
8+
9+
- Add the public `resolveDocsRouteHref` helper for resolving relative Markdown
10+
links against the current docs route, normalizing `.md`/`.mdx` targets, and
11+
rejecting external or non-navigation URLs.
12+
513
## 2.0.4 - 2026-06-03
614

715
### Patch Changes

packages/vue-ssg-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codemonster-ru/vue-ssg-core",
3-
"version": "2.0.4",
3+
"version": "2.1.0",
44
"description": "Core APIs for Codemonster SSG apps.",
55
"keywords": [
66
"vue",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const DOCS_URL_ORIGIN = 'https://docs.local'
2+
3+
export function resolveDocsRouteHref(href: string, pagePath: string): string | null {
4+
const normalizedHref = href.trim()
5+
6+
if (!normalizedHref) {
7+
return null
8+
}
9+
10+
if (normalizedHref.startsWith('#')) {
11+
return normalizedHref
12+
}
13+
14+
if (
15+
normalizedHref.startsWith('//') ||
16+
/^[a-z][a-z\d+.-]*:/i.test(normalizedHref)
17+
) {
18+
return null
19+
}
20+
21+
const baseUrl = new URL(pagePath, DOCS_URL_ORIGIN)
22+
const targetUrl = new URL(normalizedHref, baseUrl)
23+
24+
if (targetUrl.origin !== DOCS_URL_ORIGIN) {
25+
return null
26+
}
27+
28+
targetUrl.pathname = targetUrl.pathname
29+
.replace(/\/index\.(?:md|mdx)$/i, '/')
30+
.replace(/\.(?:md|mdx)$/i, '')
31+
32+
return `${targetUrl.pathname}${targetUrl.search}${targetUrl.hash}`
33+
}

packages/vue-ssg-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export {
2121
createDocsRoutesFromManifest,
2222
type CreateDocsRoutesFromManifestInput
2323
} from './routes'
24+
export { resolveDocsRouteHref } from './docsLinks'
2425
export {
2526
defineDocsConfig,
2627
type DocsAsideProps,

0 commit comments

Comments
 (0)