@do11y/docs 0.0.12 → 0.0.13

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 (2) hide show
  1. package/README.md +19 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,6 +5,7 @@ A very bare-bones tool to help document Vue components.
5
5
  - Write documentation in Markdown files that get treated as Vue components.
6
6
  - Import markdown files as routes.
7
7
  - Add sandbox components - e.g. `Button.sandbox.vue` will be available on the url `/sandbox?id=button`.
8
+ - Easily document components with [vue-component-meta](https://www.npmjs.com/package/vue-component-meta) using meta imports - e.g. `Button.vue?meta`.
8
9
 
9
10
  ## Setup
10
11
 
@@ -14,18 +15,12 @@ A very bare-bones tool to help document Vue components.
14
15
  import { fileURLToPath, URL } from 'node:url';
15
16
 
16
17
  import { defineConfig } from 'vite';
18
+ import { vueOptions } from '@do11y/docs';
17
19
 
18
20
  import vue from '@vitejs/plugin-vue';
19
- import vueDevTools from 'vite-plugin-vue-devtools';
20
21
 
21
22
  export default defineConfig({
22
- plugins: [vue({ include: [/\.vue$/, /\.md$/] }), vueDevTools()],
23
-
24
- resolve: {
25
- alias: {
26
- '@': fileURLToPath(new URL('./src', import.meta.url)),
27
- },
28
- },
23
+ plugins: [vue(vueOptions)],
29
24
  });
30
25
  ```
31
26
 
@@ -64,19 +59,24 @@ npm docs:dev
64
59
 
65
60
  ### `site/index.ts`
66
61
 
67
- This file will be used to configure the documentation site.
62
+ This file will be used to configure the site.
68
63
 
69
64
  > [!WARNING]
70
- > Both the documentation site and the sandbox uses the same `setup` function. This means importing styles or components directly in this file will also import them to the sandbox.
65
+ > Both the documentation site and the sandbox import this file - this is why it is recommended to import necessary files/components _inside_ the functions.
71
66
 
72
67
  ```ts
73
68
  import type { Site } from '@do11y/docs';
74
69
 
75
70
  export default {
71
+ // The main component for the site.
76
72
  Site: () => import('./Site.vue'),
77
73
 
78
- setup(app) {
79
- // App setup
74
+ async setup(app, router) {
75
+ // Additional setup for the app.
76
+ },
77
+
78
+ async setupSandbox(app) {
79
+ // Additional setup for the sandbox app.
80
80
  },
81
81
  } satisfies Site;
82
82
  ```
@@ -89,11 +89,12 @@ This file will be used to configure the different plugins available.
89
89
  import type { PluginOptions } from '@do11y/docs';
90
90
 
91
91
  export default {
92
- metaRenderer(meta, title) {
93
- return `
94
- <h3>${title}</h3>
95
- <pre><code>${JSON.stringify(meta, null, 2)}</code></pre>
96
- `;
97
- },
92
+ setup(md) {
93
+ // Additional markdown-it setup.
94
+ }
95
+
96
+ highlight(md, code, lang, attrs) {
97
+ // The highlight option for `markdown-it`.
98
+ }
98
99
  } satisfies PluginOptions;
99
100
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@do11y/docs",
3
3
  "description": "A very bare-bones tool to help document Vue components.",
4
- "version": "0.0.12",
4
+ "version": "0.0.13",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",