@md-plugins/quasar-app-extension-vite-md-plugin 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (3) hide show
  1. package/README.md +75 -18
  2. package/package.json +3 -3
  3. package/src/index.js +12 -10
package/README.md CHANGED
@@ -1,31 +1,88 @@
1
- Quasar App Extension md-plugin
2
- ===
1
+ # viteMdPluginAppExt
3
2
 
4
- _Be sure to change this readme as appropriate for your app extension._
3
+ The `viteMdPluginAppExt` is a Quasar App Extension that integrates the `viteMdPlugin` into your Quasar project. This extension allows you to use Markdown files as Vue components, enabling a seamless integration of Markdown content into your Quasar application.
5
4
 
6
- _Think about the organization of this file and how the information will be beneficial to the user._
5
+ ## Table of Contents
7
6
 
8
- > Add a short description of your App Extension. What does it do? How is it beneficial? Why would someone want to use it?
7
+ - [Overview](#overview)
8
+ - [Installation](#installation)
9
+ - [Usage](#usage)
10
+ - [Configuration](#configuration)
11
+ - [Contributing](#contributing)
12
+ - [License](#license)
9
13
 
10
- A Quasar Project
14
+ ## Overview
15
+
16
+ The `viteMdPluginAppExt` extension provides a convenient way to use Markdown files in your Quasar project. It leverages the `viteMdPlugin` to transform Markdown content into Vue components, allowing you to write and manage content in Markdown while benefiting from the power of Vue and Quasar.
17
+
18
+ This App-Extension (app-ext) is for convenience only. For more granular control, you can use the `viteMdPlugin` directly in your Vite configuration. For more information, refer to the [viteMdPlugin documentation](https://github.com/md-plugins/md-plugins/tree/dev/packages/viteMdPlugin).
19
+
20
+ ## Installation
21
+
22
+ To install the `viteMdPluginAppExt` extension, use the following command:
11
23
 
12
- # Install
13
24
  ```bash
14
- quasar ext add md-plugin
25
+ pnpm add @md-plugins/vite-md-plugin-app-ext
15
26
  ```
16
- Quasar CLI will retrieve it from the NPM registry and install the extension to your project.
17
27
 
28
+ ## What It Does
18
29
 
19
- # Uninstall
20
- ```bash
21
- quasar ext remove md-plugin
30
+ The `viteMdPluginAppExt` extension does the following:
31
+
32
+ - Integrates the `viteMdPlugin` into your Quasar project.
33
+ - Allows you to use Markdown files as Vue components.
34
+ - Provides a convenient way to manage and render Markdown content in your Quasar application.
35
+ - Provides `quasar.config` changes so you don't have to manage the small things. Here is what it changes:
36
+
37
+ ```javascript
38
+ build: {
39
+ vueRouterMode: 'history', // Required for proper hash link handling
40
+ viteVuePluginOptions.include: [/\.(vue|md)$/], // Include Markdown files
41
+ },
42
+ framework: {
43
+ framework.autoImportVueExtensions: ['md', 'vue'], // Include Markdown files
44
+ }
22
45
  ```
23
46
 
24
- # Info
25
- > Add longer information here that will help the user of your app extension.
47
+ ## Usage
48
+
49
+ After installing the extension, you need to configure it in your Quasar project. Here are the steps to get started:
50
+
51
+ 1. **Import `@md-plugins/vite-md-plugin`:**
52
+
53
+ Update your `quasar.config.js` or `quasar.config.ts` to include the `@md-plugins/vite-md-plugin` extension:
54
+
55
+ ```js
56
+ import { viteMdPlugin, type MenuItem } from '@md-plugins/vite-md-plugin'
57
+ ```
58
+
59
+ 2. **Import Your Sidebar Menu:**
60
+
61
+ ```js
62
+ import siteConfig from './src/siteConfig'
63
+ const { sidebar } = siteConfig
64
+ ```
65
+
66
+ 3. **Add the `viteMdPlugin` to the `vitePlugins` array:**
67
+
68
+ ```js
69
+ vitePlugins: [
70
+ viteMdPlugin(ctx.appPaths.srcDir + '/markdown', sidebar as MenuItem[]),
71
+ // ...
72
+ ```
73
+
74
+ ## Configuration
75
+
76
+ The `viteMdPluginAppExt` extension can be customized through various options. Here are some of the key configuration options:
77
+
78
+ - **`vueRouterMode`**: Set to `'history'` for proper hash link handling.
79
+ - **`viteVuePluginOptions.include`**: Include Markdown files for Vite to transpile.
80
+ - **`framework.autoImportVueExtensions`**: Enable auto-import for Markdown extensions.
81
+
82
+ ## Documentation
83
+
84
+ In case this README falls out of date, please refer to the [documentation](https://md-plugins.netlify.app/quasar-app-extensions/vitemdpluginappext/overview) for the latest information.
26
85
 
27
- # Other Info
28
- > Add other information that's not as important to know
86
+ ## License
29
87
 
30
- # Donate
31
- If you appreciate the work that went into this App Extension, please consider [donating to Quasar](https://donate.quasar.dev).
88
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/quasar-app-extension-vite-md-plugin",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.20",
4
4
  "description": "A Quasar app-ext for @md-plugins/viteMdPlugin",
5
5
  "author": "Jeff <galbraith64@gmail.com>",
6
6
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  "md-plugins",
23
23
  "viteMdPlugin"
24
24
  ],
25
- "dependencies": {
26
- "@md-plugins/viteMdPlugin": "^0.1.0-alpha.2"
25
+ "devDependencies": {
26
+ "@md-plugins/vite-md-plugin": "0.1.0-alpha.20"
27
27
  },
28
28
  "scripts": {
29
29
  "test": "echo \"No test specified\" && exit 0"
package/src/index.js CHANGED
@@ -6,31 +6,33 @@
6
6
  * Docs: https://quasar.dev/app-extensions/development-guide/index-api
7
7
  */
8
8
 
9
- function extendConfig(config, api) {
9
+ function extendConfig(config) {
10
10
  // make sure 'vueRouterMode' has 'history' mode
11
- if (api.ctx.build.vueRouterMode !== 'history') {
12
- console.log('Changing vueRouterMode to "history"')
13
- api.ctx.build.vueRouterMode = 'history'
11
+ if (config.build.vueRouterMode !== 'history') {
12
+ console.log('Changing vueRouterMode to "history" - required for hash links to work correctly')
13
+ config.build.vueRouterMode = 'history'
14
14
  }
15
15
 
16
- api.ctx.build.viteVuePluginOptions.include = api.ctx.build.viteVuePluginOptions.include || []
17
- api.ctx.build.viteVuePluginOptions.include.push(/\.(vue|md)$/)
16
+ // let Vite know to transpile md files
17
+ config.build.viteVuePluginOptions.include = config.build.viteVuePluginOptions.include || []
18
+ config.build.viteVuePluginOptions.include.push(/\.(vue|md)$/)
18
19
 
19
- const extensions = new Set(api.ctx.framework.autoImportVueExtensions || [])
20
+ // let Vue know to auto import md files
21
+ const extensions = new Set(config.framework.autoImportVueExtensions || [])
20
22
  extensions.add('md')
21
23
  extensions.add('vue')
22
- api.ctx.framework.autoImportVueExtensions = Array.from(extensions)
24
+ config.framework.autoImportVueExtensions = Array.from(extensions)
23
25
  }
24
26
 
25
27
  export default function (api) {
26
28
  // verify this is a Vite project
27
29
  if (!api.hasVite) {
28
- console.error('This extension requires Vite')
30
+ throw new Error('This extension requires Vite')
29
31
  }
30
32
 
31
33
  api.compatibleWith('quasar', '^2.0.0')
32
34
  api.compatibleWith('@quasar/app-vite', '^2.0.0')
33
35
 
34
- // here we extend /quasar.config, so we can add some Vite stuff
36
+ // here we extend /quasar.config, so we can add some Vite/Vue stuff
35
37
  api.extendQuasarConf(extendConfig)
36
38
  }