@frontfactory/vitepress-theme 1.4.2 → 1.5.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/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @frontfactory/vitepress-theme
2
2
 
3
+ [![Version](https://flat.badgen.net/npm/v/@frontfactory/vitepress-theme)](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
4
+ [![Downloads](https://flat.badgen.net/npm/dt/@frontfactory/vitepress-theme)](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
5
+ [![License](https://flat.badgen.net/npm/license/@frontfactory/vitepress-theme)](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
6
+
3
7
  Editorial VitePress theme — hairline rules, numbered sections and monospaced metadata. One accent
4
8
  token to make it yours.
5
9
 
@@ -12,7 +16,7 @@ every markdown feature keep working, while the whole surface is redrawn.
12
16
  npm install @frontfactory/vitepress-theme
13
17
  ```
14
18
 
15
- Requires Node 20+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
19
+ Requires Node 24+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
16
20
  shipped compiled, so Sass is not needed downstream.
17
21
 
18
22
  ## Use
@@ -132,6 +136,13 @@ themeConfig: {
132
136
  Per page, `docMeta: false` in the frontmatter drops the kicker, and `section: Guide` overrides the
133
137
  section name.
134
138
 
139
+ Banner text, hero title/tagline/quote, feature title/details, footer message/copyright and card icon
140
+ all render as HTML (`v-html`), not escaped text — a `<strong>` or a hand-written `<a>` in any of them
141
+ shows up as markup. The trust boundary is the config file itself: these strings are meant to come
142
+ from whoever writes `themeConfig.ff` in the VitePress config, not from a reader, a comment, or a CMS
143
+ field someone else can edit. If a site ever pipes such input into these fields, sanitize it before it
144
+ reaches the config — the theme does not.
145
+
135
146
  ## Translating
136
147
 
137
148
  Every string the theme adds sits in `themeConfig.ff.labels`, so it is translated the same way as any
package/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { UserConfig } from 'vitepress'
2
- import type { ThemeConfig } from './src/types'
1
+ import type { UserConfig } from 'vitepress';
2
+ import type { ThemeConfig } from './src/types';
3
3
 
4
- declare const config: UserConfig<ThemeConfig>
4
+ declare const config: UserConfig<ThemeConfig>;
5
5
 
6
- export default config
6
+ export default config;
package/config.js CHANGED
@@ -1,8 +1,8 @@
1
- import { resolve } from 'node:path'
2
- import { searchForWorkspaceRoot } from 'vite'
1
+ import { resolve } from 'node:path';
2
+ import { searchForWorkspaceRoot } from 'vite';
3
3
 
4
- const dir = import.meta.dirname
5
- const pkg = '@frontfactory/vitepress-theme'
4
+ const dir = import.meta.dirname;
5
+ const pkg = '@frontfactory/vitepress-theme';
6
6
 
7
7
  /**
8
8
  * Default theme components this theme replaces wholesale. VitePress resolves them by path, so the
@@ -11,13 +11,17 @@ const pkg = '@frontfactory/vitepress-theme'
11
11
  const overrides = {
12
12
  VPHero: 'src/components/FfHero.vue',
13
13
  VPFeature: 'src/components/FfFeature.vue',
14
- VPFooter: 'src/components/FfFooter.vue'
15
- }
14
+ VPFooter: 'src/components/FfFooter.vue',
15
+ VPHomeSponsors: 'src/components/FfHomeSponsors.vue'
16
+ };
16
17
 
17
- const alias = Object.entries(overrides).map(([name, file]) => ({
18
+ const alias = Object.entries(overrides).map(([
19
+ name,
20
+ file
21
+ ]) => ({
18
22
  find: new RegExp(`^.*\\/${name}\\.vue$`),
19
23
  replacement: resolve(dir, file)
20
- }))
24
+ }));
21
25
 
22
26
  /**
23
27
  * Base config for `extends`, per
@@ -36,25 +40,44 @@ const alias = Object.entries(overrides).map(([name, file]) => ({
36
40
  */
37
41
  const config = {
38
42
  vite: {
39
- resolve: { alias },
40
- optimizeDeps: { exclude: [pkg] },
41
- ssr: { noExternal: [pkg] },
42
- server: { fs: { allow: [dir, searchForWorkspaceRoot(process.cwd())] } }
43
+ resolve: {
44
+ alias
45
+ },
46
+ optimizeDeps: {
47
+ exclude: [
48
+ pkg
49
+ ]
50
+ },
51
+ ssr: {
52
+ noExternal: [
53
+ pkg
54
+ ]
55
+ },
56
+ server: {
57
+ fs: {
58
+ allow: [
59
+ dir,
60
+ searchForWorkspaceRoot(process.cwd())
61
+ ]
62
+ }
63
+ }
43
64
  },
44
65
  transformHead({ siteData }) {
45
- const id = siteData.themeConfig?.ff?.banner?.id
66
+ const id = siteData.themeConfig?.ff?.banner?.id;
46
67
 
47
- if (!id) return []
68
+ if (!id) {
69
+ return [];
70
+ }
48
71
 
49
72
  return [
50
73
  [
51
74
  'script',
52
75
  {},
53
76
  `try{if(localStorage.getItem('ff-banner-${id}'))` +
54
- `document.documentElement.classList.add('ff-banner-dismissed')}catch(e){}`
77
+ 'document.documentElement.classList.add(\'ff-banner-dismissed\')}catch(e){}'
55
78
  ]
56
- ]
79
+ ];
57
80
  }
58
- }
81
+ };
59
82
 
60
- export default config
83
+ export default config;