@md-plugins/quasar-app-extension-vite-md-plugin 0.1.0-alpha.10
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/LICENSE.md +21 -0
- package/README.md +88 -0
- package/package.json +31 -0
- package/src/index.js +38 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present, MD-PLUGINS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# viteMdPluginAppExt
|
|
2
|
+
|
|
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.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
- [Configuration](#configuration)
|
|
11
|
+
- [Contributing](#contributing)
|
|
12
|
+
- [License](#license)
|
|
13
|
+
|
|
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:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @md-plugins/vite-md-plugin-app-ext
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## What It Does
|
|
29
|
+
|
|
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
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@md-plugins/quasar-app-extension-vite-md-plugin",
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
|
+
"description": "A Quasar app-ext for @md-plugins/viteMdPlugin",
|
|
5
|
+
"author": "Jeff <galbraith64@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">= 20",
|
|
10
|
+
"npm": ">= 5.6.0",
|
|
11
|
+
"yarn": ">= 1.6.0"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"quasar",
|
|
18
|
+
"app",
|
|
19
|
+
"app extension",
|
|
20
|
+
"extension",
|
|
21
|
+
"markdown",
|
|
22
|
+
"md-plugins",
|
|
23
|
+
"viteMdPlugin"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@md-plugins/vite-md-plugin": "0.1.0-alpha.10"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "echo \"No test specified\" && exit 0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*global console*/
|
|
2
|
+
/**
|
|
3
|
+
* Quasar App Extension index/runner script
|
|
4
|
+
* (runs on each dev/build)
|
|
5
|
+
*
|
|
6
|
+
* Docs: https://quasar.dev/app-extensions/development-guide/index-api
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function extendConfig(config) {
|
|
10
|
+
// make sure 'vueRouterMode' has 'history' mode
|
|
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
|
+
}
|
|
15
|
+
|
|
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)$/)
|
|
19
|
+
|
|
20
|
+
// let Vue know to auto import md files
|
|
21
|
+
const extensions = new Set(config.framework.autoImportVueExtensions || [])
|
|
22
|
+
extensions.add('md')
|
|
23
|
+
extensions.add('vue')
|
|
24
|
+
config.framework.autoImportVueExtensions = Array.from(extensions)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default function (api) {
|
|
28
|
+
// verify this is a Vite project
|
|
29
|
+
if (!api.hasVite) {
|
|
30
|
+
throw new Error('This extension requires Vite')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
api.compatibleWith('quasar', '^2.0.0')
|
|
34
|
+
api.compatibleWith('@quasar/app-vite', '^2.0.0')
|
|
35
|
+
|
|
36
|
+
// here we extend /quasar.config, so we can add some Vite/Vue stuff
|
|
37
|
+
api.extendQuasarConf(extendConfig)
|
|
38
|
+
}
|