@frontfactory/vitepress-theme 1.5.0 → 1.5.2

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,18 +1,28 @@
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
 
6
10
  It extends the VitePress default theme rather than forking it: search, i18n, mobile navigation and
7
11
  every markdown feature keep working, while the whole surface is redrawn.
8
12
 
13
+ ## Playground
14
+
15
+ Try it live on StackBlitz — no installation required:
16
+
17
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/~/github.com/front-factory/vitepress-theme?startScript=dev:playground)
18
+
9
19
  ## Install
10
20
 
11
21
  ```bash
12
22
  npm install @frontfactory/vitepress-theme
13
23
  ```
14
24
 
15
- Requires Node 20+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
25
+ Requires Node 24+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
16
26
  shipped compiled, so Sass is not needed downstream.
17
27
 
18
28
  ## Use
@@ -132,6 +142,13 @@ themeConfig: {
132
142
  Per page, `docMeta: false` in the frontmatter drops the kicker, and `section: Guide` overrides the
133
143
  section name.
134
144
 
145
+ Banner text, hero title/tagline/quote, feature title/details, footer message/copyright and card icon
146
+ all render as HTML (`v-html`), not escaped text — a `<strong>` or a hand-written `<a>` in any of them
147
+ shows up as markup. The trust boundary is the config file itself: these strings are meant to come
148
+ from whoever writes `themeConfig.ff` in the VitePress config, not from a reader, a comment, or a CMS
149
+ field someone else can edit. If a site ever pipes such input into these fields, sanitize it before it
150
+ reaches the config — the theme does not.
151
+
135
152
  ## Translating
136
153
 
137
154
  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
@@ -13,12 +13,15 @@ const overrides = {
13
13
  VPFeature: 'src/components/FfFeature.vue',
14
14
  VPFooter: 'src/components/FfFooter.vue',
15
15
  VPHomeSponsors: 'src/components/FfHomeSponsors.vue'
16
- }
16
+ };
17
17
 
18
- const alias = Object.entries(overrides).map(([name, file]) => ({
18
+ const alias = Object.entries(overrides).map(([
19
+ name,
20
+ file
21
+ ]) => ({
19
22
  find: new RegExp(`^.*\\/${name}\\.vue$`),
20
23
  replacement: resolve(dir, file)
21
- }))
24
+ }));
22
25
 
23
26
  /**
24
27
  * Base config for `extends`, per
@@ -37,25 +40,44 @@ const alias = Object.entries(overrides).map(([name, file]) => ({
37
40
  */
38
41
  const config = {
39
42
  vite: {
40
- resolve: { alias },
41
- optimizeDeps: { exclude: [pkg] },
42
- ssr: { noExternal: [pkg] },
43
- 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
+ }
44
64
  },
45
65
  transformHead({ siteData }) {
46
- const id = siteData.themeConfig?.ff?.banner?.id
66
+ const id = siteData.themeConfig?.ff?.banner?.id;
47
67
 
48
- if (!id) return []
68
+ if (!id) {
69
+ return [];
70
+ }
49
71
 
50
72
  return [
51
73
  [
52
74
  'script',
53
75
  {},
54
76
  `try{if(localStorage.getItem('ff-banner-${id}'))` +
55
- `document.documentElement.classList.add('ff-banner-dismissed')}catch(e){}`
77
+ 'document.documentElement.classList.add(\'ff-banner-dismissed\')}catch(e){}'
56
78
  ]
57
- ]
79
+ ];
58
80
  }
59
- }
81
+ };
60
82
 
61
- export default config
83
+ export default config;