valaxy 1.2.1 → 1.3.0

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.
Files changed (39) hide show
  1. package/client/components/ValaxyDecrypt.vue +6 -25
  2. package/client/components/ValaxyDynamicComponent.vue +13 -34
  3. package/client/components/ValaxyFootnoteTooltip.vue +140 -11
  4. package/client/composables/app/index.ts +1 -0
  5. package/client/composables/app/usePageSeo.ts +40 -0
  6. package/client/composables/app/useValaxyApp.ts +24 -23
  7. package/client/composables/app/useValaxyHead.ts +5 -12
  8. package/client/composables/dark.ts +8 -1
  9. package/client/composables/post/filter.ts +1 -1
  10. package/client/composables/post/index.ts +4 -4
  11. package/client/composables/search/index.ts +2 -0
  12. package/client/composables/search/package.json +4 -0
  13. package/client/composables/search/useFuseSearch.ts +1 -1
  14. package/client/composables/widgets/backToTop.ts +30 -6
  15. package/client/main.ts +6 -6
  16. package/client/runtime/ValaxyRuntimeTemplate.vue +26 -0
  17. package/client/setup/main.ts +0 -2
  18. package/client/shims.d.ts +4 -0
  19. package/client/stores/router.ts +12 -0
  20. package/client/stores/site.ts +5 -50
  21. package/client/utils/index.ts +1 -0
  22. package/client/utils/seo.ts +79 -0
  23. package/client/utils/time.ts +7 -4
  24. package/dist/node/cli/index.mjs +3 -4
  25. package/dist/node/index.d.mts +295 -48
  26. package/dist/node/index.mjs +3 -4
  27. package/dist/shared/{valaxy.DvkRJomf.mjs → valaxy.BrBGPvyF.mjs} +1251 -209
  28. package/dist/shared/{valaxy.EzGcrVef.d.mts → valaxy.Jqi53gnQ.d.mts} +42 -15
  29. package/dist/types/index.d.mts +2 -2
  30. package/package.json +5 -6
  31. package/shared/index.ts +2 -0
  32. package/shared/page-policy.ts +123 -0
  33. package/shared/seo.ts +182 -0
  34. package/types/config.ts +39 -17
  35. package/types/vue-router.d.ts +4 -0
  36. package/vendor/README.md +5 -0
  37. package/client/components/footnote/FootnotePopover.vue +0 -146
  38. package/client/components/footnote/LegacyFootnoteTooltip.vue +0 -25
  39. package/client/modules/floating-vue.ts +0 -11
@@ -429,6 +429,10 @@ declare module 'vue-router' {
429
429
  * Excerpt from markdown content
430
430
  */
431
431
  excerpt?: string
432
+ /**
433
+ * Plain-text summary used when the page has no frontmatter description.
434
+ */
435
+ seoDescription?: string
432
436
  /**
433
437
  * Layout name
434
438
  */
@@ -521,6 +525,11 @@ interface SocialLink {
521
525
  */
522
526
  name: string;
523
527
  link: string;
528
+ /**
529
+ * @description:en-US Set false for navigation links that do not identify the author (e.g. groups or custom subscriptions).
530
+ * @description:zh-CN 非作者身份主页(如群聊、自定义订阅入口)设为 false,仅从 JSON-LD sameAs 中排除,不影响导航。
531
+ */
532
+ sameAs?: boolean;
524
533
  /**
525
534
  * 图标名称
526
535
  * https://icones.js.org/
@@ -599,7 +608,15 @@ interface SiteConfig {
599
608
  * @description 你的名字
600
609
  */
601
610
  name: string;
611
+ /**
612
+ * @description:en-US Public email. Omitted from RSS and JSON-LD when empty. Valaxy does not fill this in.
613
+ * @description:zh-CN 公开邮箱。留空时不会写入 RSS 和 JSON-LD,框架不会代填。
614
+ */
602
615
  email: string;
616
+ /**
617
+ * @description:en-US Author URL. Omitted from RSS and JSON-LD when empty. Valaxy does not fill this in.
618
+ * @description:zh-CN 作者链接。留空时不会写入 RSS 和 JSON-LD,框架不会代填。
619
+ */
603
620
  link: string;
604
621
  avatar: string;
605
622
  /**
@@ -737,6 +754,31 @@ interface SiteConfig {
737
754
  */
738
755
  length: number;
739
756
  };
757
+ /**
758
+ * Which source files are published.
759
+ * @description:en-US Controls drafts, underscore paths, and README pages. Development still previews `draft: true`.
760
+ * @description:zh-CN 控制草稿、下划线路径和 README 页面。开发模式仍会预览 `draft: true`。
761
+ */
762
+ publishing: {
763
+ /**
764
+ * @description:en-US Include `draft: true` pages in production HTML, the sitemap, RSS, and llms output.
765
+ * @description:zh-CN 在生产 HTML、sitemap、RSS 和 llms 中包含 `draft: true` 的页面。
766
+ * @default false
767
+ */
768
+ drafts: boolean;
769
+ /**
770
+ * @description:en-US Publish files and directories under `pages/` whose names start with `_`, including `pages/_drafts`.
771
+ * @description:zh-CN 发布 `pages/` 下名称以 `_` 开头的文件和目录,包括 `pages/_drafts`。
772
+ * @default false
773
+ */
774
+ underscore: boolean;
775
+ /**
776
+ * @description:en-US Publish `README.md` files under `pages/` as routes.
777
+ * @description:zh-CN 将 `pages/` 下的 `README.md` 发布为路由。
778
+ * @default false
779
+ */
780
+ readme: boolean;
781
+ };
740
782
  /**
741
783
  * set post default frontmatter
742
784
  */
@@ -842,21 +884,6 @@ interface SiteConfig {
842
884
  enable: boolean;
843
885
  options: ILazyLoadOptions;
844
886
  };
845
- /**
846
- * Footnote preview implementation. Existing Floating Vue configuration
847
- * selects the legacy implementation unless preview is explicitly set.
848
- */
849
- footnote: {
850
- /** @default 'reka' */
851
- preview: 'reka' | 'floating-vue';
852
- };
853
- /**
854
- * Legacy Floating Vue configuration, also used by global v-tooltip.
855
- * @deprecated For footnotes, migrate to footnote.preview: 'reka' and style
856
- * .va-footnote-popover. Global Floating Vue APIs remain available during migration.
857
- * @see https://floating-vue.starpad.dev/guide/config
858
- */
859
- floatingVue: any;
860
887
  /**
861
888
  * displayed posts length in every page
862
889
  * @default 7
@@ -1,5 +1,5 @@
1
- import { c as Post } from '../shared/valaxy.EzGcrVef.mjs';
2
- export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, L as LlmsCollapse, d as LlmsFeatured, e as Page, f as PageFrontMatter, P as PartialDeep, g as Photo, h as Pkg, i as PostFrontMatter, a as RedirectItem, j as RedirectRule, R as RuntimeConfig, S as SiteConfig, k as SocialLink, U as UserSiteConfig, l as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.EzGcrVef.mjs';
1
+ import { c as Post } from '../shared/valaxy.Jqi53gnQ.mjs';
2
+ export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, L as LlmsCollapse, d as LlmsFeatured, e as Page, f as PageFrontMatter, P as PartialDeep, g as Photo, h as Pkg, i as PostFrontMatter, a as RedirectItem, j as RedirectRule, R as RuntimeConfig, S as SiteConfig, k as SocialLink, U as UserSiteConfig, l as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.Jqi53gnQ.mjs';
3
3
  import { Header } from '@valaxyjs/utils';
4
4
  import '@vueuse/integrations/useFuse';
5
5
  import 'medium-zoom';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.3.0",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -65,6 +65,7 @@
65
65
  "vue-router": "^5.0.0"
66
66
  },
67
67
  "dependencies": {
68
+ "@11ty/gray-matter": "^3.0.0",
68
69
  "@antfu/install-pkg": "^2.1.0",
69
70
  "@antfu/utils": "^9.3.0",
70
71
  "@clack/prompts": "^1.8.1",
@@ -75,8 +76,8 @@
75
76
  "@unhead/bundler": "^3.4.1",
76
77
  "@unhead/schema-org": "^3.4.1",
77
78
  "@unhead/vue": "^3.4.1",
78
- "@valaxyjs/devtools": "1.2.1",
79
- "@valaxyjs/utils": "1.2.1",
79
+ "@valaxyjs/devtools": "1.3.0",
80
+ "@valaxyjs/utils": "1.3.0",
80
81
  "@vitejs/devtools": "0.8.0",
81
82
  "@vitejs/plugin-vue": "^6.0.9",
82
83
  "@vueuse/core": "^15.0.0",
@@ -92,10 +93,8 @@
92
93
  "ejs": "^6.0.1",
93
94
  "escape-html": "^1.0.3",
94
95
  "feed": "^6.0.0",
95
- "floating-vue": "^5.4.0",
96
96
  "fs-extra": "^11.4.0",
97
97
  "fuse.js": "^7.5.0",
98
- "gray-matter": "^4.0.3",
99
98
  "hookable": "^6.1.2",
100
99
  "html-to-text": "^10.0.1",
101
100
  "jiti": "^2.7.0",
@@ -140,7 +139,6 @@
140
139
  "unplugin": "^3.0.0",
141
140
  "unplugin-utils": "^0.3.1",
142
141
  "unplugin-vue-components": "32.1.0",
143
- "unplugin-vue-markdown": "^32.1.1",
144
142
  "vanilla-lazyload": "^19.1.3",
145
143
  "vite": "^8.3.6",
146
144
  "vite-plugin-vue-devtools": "^8.2.1",
@@ -171,6 +169,7 @@
171
169
  "nanoid": "^6.0.1",
172
170
  "rollup-plugin-visualizer": "^7.1.1",
173
171
  "unbuild": "^3.6.1",
172
+ "unplugin-vue-markdown": "^32.1.1",
174
173
  "vue": "^3.5.43",
175
174
  "vue-router": "^5.3.1"
176
175
  },
package/shared/index.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './constants'
2
+ export * from './page-policy'
3
+ export * from './seo'
2
4
  export * from './utils'
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Production publishing rules for files under `pages/`.
3
+ * `draft: true` stays routable in development and is omitted from production
4
+ * unless `publishing.drafts` is set. Underscore paths and README.md are not
5
+ * routes unless the matching flag is set.
6
+ */
7
+ export interface PagePublishing {
8
+ /** Publish `draft: true` pages in production output. */
9
+ drafts?: boolean
10
+ /** Publish files and directories whose names start with `_`. */
11
+ underscore?: boolean
12
+ /** Publish `README.md` files under `pages/`. */
13
+ readme?: boolean
14
+ }
15
+
16
+ export function normalizePagePath(filePath: string): string {
17
+ return filePath.replace(/\\/g, '/').replace(/^\.\//, '')
18
+ }
19
+
20
+ /**
21
+ * Page path relative to a `pages/` directory.
22
+ * `pages/posts/hello.md` and `/abs/pages/posts/hello.md` both become `posts/hello.md`.
23
+ */
24
+ export function relativePagePath(filePath: string, userRoot?: string): string | undefined {
25
+ const normalized = normalizePagePath(filePath)
26
+ if (userRoot) {
27
+ const root = normalizePagePath(userRoot).replace(/\/$/, '')
28
+ const prefixes = [`${root}/pages/`, `${root}/.valaxy/content/pages/`]
29
+ for (const prefix of prefixes) {
30
+ if (normalized.startsWith(prefix))
31
+ return normalized.slice(prefix.length)
32
+ }
33
+ }
34
+
35
+ const markers = ['/.valaxy/content/pages/', '/pages/']
36
+ for (const marker of markers) {
37
+ const index = normalized.lastIndexOf(marker)
38
+ if (index >= 0)
39
+ return normalized.slice(index + marker.length)
40
+ }
41
+
42
+ if (normalized.startsWith('pages/'))
43
+ return normalized.slice('pages/'.length)
44
+ }
45
+
46
+ export function isUnderscorePage(relativePath: string): boolean {
47
+ return normalizePagePath(relativePath)
48
+ .split('/')
49
+ .some(segment => segment.startsWith('_'))
50
+ }
51
+
52
+ export function isReadmePage(relativePath: string): boolean {
53
+ const base = normalizePagePath(relativePath).split('/').pop() || ''
54
+ return /^readme\.md$/i.test(base)
55
+ }
56
+
57
+ /** True when this source file must not become a public route. */
58
+ export function isUnpublishedPage(relativePath: string, publishing: PagePublishing = {}): boolean {
59
+ if (!publishing.underscore && isUnderscorePage(relativePath))
60
+ return true
61
+ if (!publishing.readme && isReadmePage(relativePath))
62
+ return true
63
+ return false
64
+ }
65
+
66
+ /**
67
+ * Picomatch globs for the file router. They are a fast path; route extension
68
+ * also drops these files so a custom exclude list cannot publish them by accident.
69
+ */
70
+ export function pageExcludeGlobs(publishing: PagePublishing = {}): string[] {
71
+ const globs: string[] = []
72
+ if (!publishing.underscore)
73
+ globs.push('**/_*/**', '**/_*')
74
+ if (!publishing.readme)
75
+ globs.push('**/[Rr][Ee][Aa][Dd][Mm][Ee].[Mm][Dd]')
76
+ return globs
77
+ }
78
+
79
+ export function normalizeExcludeGlobs(exclude: unknown): string[] {
80
+ if (typeof exclude === 'string')
81
+ return [exclude]
82
+ if (Array.isArray(exclude))
83
+ return exclude.filter((item): item is string => typeof item === 'string')
84
+ return []
85
+ }
86
+
87
+ export function mergePageExcludes(publishing: PagePublishing | undefined, userExclude: unknown): string[] {
88
+ const defaults = pageExcludeGlobs(publishing)
89
+ if (typeof userExclude === 'function')
90
+ return userExclude(defaults)
91
+ return [...defaults, ...normalizeExcludeGlobs(userExclude)]
92
+ }
93
+
94
+ interface DraftRoute {
95
+ meta?: { frontmatter?: { draft?: boolean } }
96
+ children?: DraftRoute[]
97
+ }
98
+
99
+ /**
100
+ * Drop `draft: true` routes from a production route tree.
101
+ * Development keeps them so authors can preview. Mutates child arrays the same way the router setup always has.
102
+ */
103
+ export function omitProductionDraftRoutes<T extends DraftRoute>(routes: T[], includeDrafts = false): T[] {
104
+ if (includeDrafts)
105
+ return routes
106
+
107
+ return routes.filter((route) => {
108
+ if (route.children?.length)
109
+ route.children = omitProductionDraftRoutes(route.children, includeDrafts)
110
+ return !route.meta?.frontmatter?.draft
111
+ })
112
+ }
113
+
114
+ /** Sitemap paths for generated not-found pages, such as `/404`. */
115
+ export function notFoundSitemapPaths(routes: string[]): string[] {
116
+ const paths = new Set<string>()
117
+ for (const route of routes) {
118
+ const path = route.length > 1 && route.endsWith('/') ? route.slice(0, -1) : route
119
+ if (path === '/404' || path.endsWith('/404'))
120
+ paths.add(path)
121
+ }
122
+ return [...paths]
123
+ }
package/shared/seo.ts ADDED
@@ -0,0 +1,182 @@
1
+ export interface PublicAuthor {
2
+ name?: string
3
+ email?: string
4
+ link?: string
5
+ }
6
+
7
+ /**
8
+ * Author fields safe to publish on a site that did not set them.
9
+ * Empty email and link are omitted. Callers pass the resolved site author,
10
+ * so an address the site set explicitly is kept.
11
+ */
12
+ export function publicAuthor(author: { name?: string, email?: string, link?: string } | undefined): PublicAuthor {
13
+ const result: PublicAuthor = {}
14
+ const name = author?.name?.trim()
15
+ const email = author?.email?.trim()
16
+ const link = author?.link?.trim()
17
+ if (name)
18
+ result.name = name
19
+ if (email)
20
+ result.email = email
21
+ if (link)
22
+ result.link = link
23
+ return result
24
+ }
25
+
26
+ /** Open Graph type for a Valaxy route. Posts are articles; other pages stay websites. */
27
+ export function openGraphType(path: string, layout?: string | false): 'article' | 'website' {
28
+ if (layout === 'post')
29
+ return 'article'
30
+ const normalized = path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path
31
+ return /^\/posts\/.+/.test(normalized) ? 'article' : 'website'
32
+ }
33
+
34
+ const SHARE_IMAGE = /\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/i
35
+
36
+ /**
37
+ * First usable share image. The site favicon is not a candidate: it is often an SVG
38
+ * and is the same for every page.
39
+ */
40
+ export function pickShareImage(candidates: unknown[]): string | undefined {
41
+ for (const candidate of candidates) {
42
+ const value = typeof candidate === 'string' ? candidate.trim() : ''
43
+ if (!value || Array.from(value).some(char => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
44
+ continue
45
+ // Spaces may be part of a quoted HTML src or a real filename. Only remove
46
+ // an actual trailing Markdown title, rather than truncating at whitespace.
47
+ const url = value.startsWith('<')
48
+ ? value.match(/^<([^>]+)>/)?.[1]
49
+ : value.replace(/\s+(?:"[^"]*"|'[^']*'|\([^)]*\))$/, '')
50
+ if (!url || url.includes('\\'))
51
+ continue
52
+
53
+ const pathname = url.split(/[?#]/)[0]
54
+ // Components are not image resources; URL schemes must be HTTP(S).
55
+ if (/\.vue$/i.test(pathname) || (/^[a-z][a-z\d+.-]*:/i.test(url) && !/^https?:\/\//i.test(url)))
56
+ continue
57
+ if (/^(?:https?:)?\/\//i.test(url)) {
58
+ try {
59
+ if (new URL(url, 'https://valaxy.local').hostname)
60
+ return url
61
+ }
62
+ catch {}
63
+ continue
64
+ }
65
+ // A path is unambiguous; a bare filename needs a known image extension
66
+ // so PascalCase cover component names do not become broken share URLs.
67
+ if (/^(?:\/|\.\.?\/)/.test(url) || pathname.includes('/') || SHARE_IMAGE.test(pathname))
68
+ return url
69
+ }
70
+ }
71
+
72
+ /** Keep explicit legacy `image` ahead of the cover, as Yun's article schema did. */
73
+ export function pickPageShareImage(frontmatter: { ogImage?: unknown, image?: unknown, cover?: unknown, firstImage?: unknown }): string | undefined {
74
+ return pickShareImage([frontmatter.ogImage, frontmatter.image, frontmatter.cover, frontmatter.firstImage])
75
+ }
76
+
77
+ /** Remove private blocks before extracting any public text or image metadata. */
78
+ export function stripEncryptedContent(markdown: string): string {
79
+ // Match the encryptor's exact closing marker; a lookalike must not expose the remaining block.
80
+ // Also discard an unterminated block, e.g. an excerpt cut inside encrypted text.
81
+ return markdown.replace(/<!--\s*valaxy-encrypt-start:[\s\S]*?(?:<!-- valaxy-encrypt-end -->|$)/g, '\n')
82
+ }
83
+
84
+ /**
85
+ * Plain-text summary for meta descriptions and share cards.
86
+ * Fenced code, HTML comments, and images are removed. Headings are skipped so the
87
+ * title is not repeated as the description. Longer text is cut on a space when
88
+ * one is near the end, otherwise on the character limit, then marked with an ellipsis.
89
+ */
90
+ export function plainSeoDescription(markdown: string, maxLength = 200): string {
91
+ if (!markdown || maxLength <= 0)
92
+ return ''
93
+
94
+ let text = stripEncryptedContent(markdown).replace(/\r\n/g, '\n')
95
+ text = text.replace(/```[\s\S]*?```/g, '\n')
96
+ text = text.replace(/~~~[\s\S]*?~~~/g, '\n')
97
+ text = text.replace(/```[\s\S]*$/g, '\n')
98
+ text = text.replace(/~~~[\s\S]*$/g, '\n')
99
+ text = text.replace(/<!--[\s\S]*?-->/g, '\n')
100
+ text = text.replace(/<script[\s\S]*?<\/script>/gi, '\n')
101
+ text = text.replace(/<style[\s\S]*?<\/style>/gi, '\n')
102
+ text = text.replace(/!\[[^\]]*\]\([^)]*\)/g, '\n')
103
+ text = text.replace(/<[^>]+>/g, ' ')
104
+
105
+ const paragraphs: string[] = []
106
+ for (const block of text.split(/\n\s*\n/)) {
107
+ const lines = block.split('\n').map(line => line.trim()).filter(Boolean)
108
+ const prose = lines.filter(line =>
109
+ !/^#{1,6}\s/.test(line)
110
+ && !/^```|^~~~/.test(line)
111
+ && !/^(?:-{3,}|\*{3,}|_{3,})$/.test(line)
112
+ && !line.startsWith(':::')
113
+ && !/^(?:import|export)\s/.test(line),
114
+ )
115
+ const paragraph = prose.map(stripInlineMarkdown).join(' ').replace(/\s+/g, ' ').trim()
116
+ if (!paragraph)
117
+ continue
118
+ paragraphs.push(paragraph)
119
+ if (paragraphs.join(' ').length >= maxLength)
120
+ break
121
+ }
122
+
123
+ const combined = paragraphs.join(' ').replace(/\s+/g, ' ').trim()
124
+ if (!combined || combined.length <= maxLength)
125
+ return combined
126
+
127
+ const slice = combined.slice(0, maxLength + 1)
128
+ const windowStart = Math.floor(maxLength * 0.6)
129
+ const space = slice.lastIndexOf(' ')
130
+ const end = space >= windowStart ? space : maxLength
131
+ const trimmed = combined.slice(0, end).replace(/[\s,;:]+$/u, '').trim()
132
+ return trimmed ? `${trimmed}…` : ''
133
+ }
134
+
135
+ function stripInlineMarkdown(line: string): string {
136
+ // Code spans and escaped punctuation are literal text, not emphasis delimiters.
137
+ const literals: string[] = []
138
+ const protect = (value: string) => `\u0000${literals.push(value) - 1}\u0000`
139
+ let text = line
140
+ .replace(/(`+)(.*?)\1/g, (_, _fence, code: string) => protect(code))
141
+ .replace(/\\([\\`*_~[\]{}()#+\-.!|>])/g, (_, char: string) => protect(char))
142
+ .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
143
+ .replace(/\[([^\]]+)\]\[[^\]]*\]/g, '$1')
144
+
145
+ // Underscores inside identifiers are not Markdown emphasis; spaces around a
146
+ // star (e.g. "2 * 3 * 4") do not form an emphasis pair either.
147
+ for (let depth = 0; depth < 3; depth++) {
148
+ text = text
149
+ .replace(/(?<![\p{L}\p{N}_])(_{1,3})(?=\S)(.+?\S|\S)\1(?![\p{L}\p{N}_])/gu, '$2')
150
+ .replace(/(?<!\*)(\*{1,3})(?=\S)(.+?\S|\S)\1(?!\*)/g, '$2')
151
+ .replace(/~~(?=\S)(.+?\S|\S)~~/g, '$1')
152
+ }
153
+
154
+ return text
155
+ .replace(/^>\s?/, '')
156
+ .replace(/^[-*+]\s+/, '')
157
+ .replace(/^\d+\.\s+/, '')
158
+ .replace(/\|/g, ' ')
159
+ .replace(/\0(\d+)\0/g, (_, index: string) => literals[Number(index)])
160
+ }
161
+
162
+ /**
163
+ * First content image, ignoring fenced code and the optional markdown title.
164
+ */
165
+ export function extractMarkdownImage(code: string): string | undefined {
166
+ const withoutFence = stripEncryptedContent(code)
167
+ .replace(/```[\s\S]*?```/g, '')
168
+ .replace(/~~~[\s\S]*?~~~/g, '')
169
+ const markdown = withoutFence.match(/!\[[^\]]*\]\(\s*<?([^\s)>]+)>?/)
170
+ if (markdown)
171
+ return markdown[1]
172
+ const html = withoutFence.match(/<img\s[^>]*?\bsrc=(?:"([^"]+)"|'([^']+)')/i)
173
+ // Markdown's rendered attributes escape URL query separators (and quotes).
174
+ // Decode once: an original literal &amp; remains &amp;, not a second ampersand.
175
+ return (html?.[1] || html?.[2])?.replace(/&(amp|lt|gt|quot|apos|#(?:x[\da-f]+|\d+));/gi, (entity, name: string) => {
176
+ if (name.startsWith('#')) {
177
+ const value = name[1].toLowerCase() === 'x' ? Number.parseInt(name.slice(2), 16) : Number.parseInt(name.slice(1), 10)
178
+ return value > 0 && value <= 0x10FFFF ? String.fromCodePoint(value) : entity
179
+ }
180
+ return ({ amp: '&', lt: '<', gt: '>', quot: '"', apos: '\'' } as Record<string, string>)[name.toLowerCase()]
181
+ })
182
+ }
package/types/config.ts CHANGED
@@ -19,6 +19,11 @@ export interface SocialLink {
19
19
  */
20
20
  name: string
21
21
  link: string
22
+ /**
23
+ * @description:en-US Set false for navigation links that do not identify the author (e.g. groups or custom subscriptions).
24
+ * @description:zh-CN 非作者身份主页(如群聊、自定义订阅入口)设为 false,仅从 JSON-LD sameAs 中排除,不影响导航。
25
+ */
26
+ sameAs?: boolean
22
27
  /**
23
28
  * 图标名称
24
29
  * https://icones.js.org/
@@ -101,7 +106,15 @@ export interface SiteConfig {
101
106
  * @description 你的名字
102
107
  */
103
108
  name: string
109
+ /**
110
+ * @description:en-US Public email. Omitted from RSS and JSON-LD when empty. Valaxy does not fill this in.
111
+ * @description:zh-CN 公开邮箱。留空时不会写入 RSS 和 JSON-LD,框架不会代填。
112
+ */
104
113
  email: string
114
+ /**
115
+ * @description:en-US Author URL. Omitted from RSS and JSON-LD when empty. Valaxy does not fill this in.
116
+ * @description:zh-CN 作者链接。留空时不会写入 RSS 和 JSON-LD,框架不会代填。
117
+ */
105
118
  link: string
106
119
  avatar: string
107
120
  /**
@@ -248,6 +261,32 @@ export interface SiteConfig {
248
261
  length: number
249
262
  }
250
263
 
264
+ /**
265
+ * Which source files are published.
266
+ * @description:en-US Controls drafts, underscore paths, and README pages. Development still previews `draft: true`.
267
+ * @description:zh-CN 控制草稿、下划线路径和 README 页面。开发模式仍会预览 `draft: true`。
268
+ */
269
+ publishing: {
270
+ /**
271
+ * @description:en-US Include `draft: true` pages in production HTML, the sitemap, RSS, and llms output.
272
+ * @description:zh-CN 在生产 HTML、sitemap、RSS 和 llms 中包含 `draft: true` 的页面。
273
+ * @default false
274
+ */
275
+ drafts: boolean
276
+ /**
277
+ * @description:en-US Publish files and directories under `pages/` whose names start with `_`, including `pages/_drafts`.
278
+ * @description:zh-CN 发布 `pages/` 下名称以 `_` 开头的文件和目录,包括 `pages/_drafts`。
279
+ * @default false
280
+ */
281
+ underscore: boolean
282
+ /**
283
+ * @description:en-US Publish `README.md` files under `pages/` as routes.
284
+ * @description:zh-CN 将 `pages/` 下的 `README.md` 发布为路由。
285
+ * @default false
286
+ */
287
+ readme: boolean
288
+ }
289
+
251
290
  /**
252
291
  * set post default frontmatter
253
292
  */
@@ -360,23 +399,6 @@ export interface SiteConfig {
360
399
  options: ILazyLoadOptions
361
400
  }
362
401
 
363
- /**
364
- * Footnote preview implementation. Existing Floating Vue configuration
365
- * selects the legacy implementation unless preview is explicitly set.
366
- */
367
- footnote: {
368
- /** @default 'reka' */
369
- preview: 'reka' | 'floating-vue'
370
- }
371
-
372
- /**
373
- * Legacy Floating Vue configuration, also used by global v-tooltip.
374
- * @deprecated For footnotes, migrate to footnote.preview: 'reka' and style
375
- * .va-footnote-popover. Global Floating Vue APIs remain available during migration.
376
- * @see https://floating-vue.starpad.dev/guide/config
377
- */
378
- floatingVue: any // FloatingVueConfig is an alias of any, consult the documentation for actual type
379
-
380
402
  /**
381
403
  * displayed posts length in every page
382
404
  * @default 7
@@ -21,6 +21,10 @@ declare module 'vue-router' {
21
21
  * Excerpt from markdown content
22
22
  */
23
23
  excerpt?: string
24
+ /**
25
+ * Plain-text summary used when the page has no frontmatter description.
26
+ */
27
+ seoDescription?: string
24
28
  /**
25
29
  * Layout name
26
30
  */
package/vendor/README.md CHANGED
@@ -27,3 +27,8 @@ which keep that plugin's options, layout-name normalization and runtime behavior
27
27
 
28
28
  `@intlify/unplugin-vue-i18n` was vendored at 11.2.5 until upstream 11.2.7 adopted
29
29
  `tinyglobby` with absolute paths; Valaxy now depends on the npm release directly.
30
+
31
+ The Markdown adapter is bundled from `unplugin-vue-markdown` during Valaxy's
32
+ build. Its frontmatter plugin's `gray-matter` import resolves to
33
+ `@11ty/gray-matter` at build time, so published packages need no Node loader hook
34
+ or consumer override. The workspace override serves source development and tests.