@md-plugins/quasar-app-extension-q-press 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.
Files changed (200) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +230 -0
  3. package/old/prompts.js +44 -0
  4. package/old/uninstall.js +9 -0
  5. package/package.json +60 -0
  6. package/scripts/build.js +33 -0
  7. package/src/index.js +63 -0
  8. package/src/install.js +49 -0
  9. package/src/templates/.gitkeep +0 -0
  10. package/src/templates/init/src/_q-press/.gitkeep +0 -0
  11. package/src/templates/init/src/_q-press/api/components/DarkModeToggle.json +37 -0
  12. package/src/templates/init/src/_q-press/api/components/MarkdownApi.json +67 -0
  13. package/src/templates/init/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
  14. package/src/templates/init/src/_q-press/api/components/MarkdownCardLink.json +28 -0
  15. package/src/templates/init/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
  16. package/src/templates/init/src/_q-press/api/components/MarkdownCode.json +37 -0
  17. package/src/templates/init/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
  18. package/src/templates/init/src/_q-press/api/components/MarkdownCodepen.json +21 -0
  19. package/src/templates/init/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
  20. package/src/templates/init/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
  21. package/src/templates/init/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
  22. package/src/templates/init/src/_q-press/api/components/MarkdownExample.json +22 -0
  23. package/src/templates/init/src/_q-press/api/components/MarkdownHeader.json +28 -0
  24. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
  25. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
  26. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
  27. package/src/templates/init/src/_q-press/api/components/MarkdownInstallation.json +33 -0
  28. package/src/templates/init/src/_q-press/api/components/MarkdownLayout.json +52 -0
  29. package/src/templates/init/src/_q-press/api/components/MarkdownLink.json +23 -0
  30. package/src/templates/init/src/_q-press/api/components/MarkdownPage.json +71 -0
  31. package/src/templates/init/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
  32. package/src/templates/init/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
  33. package/src/templates/init/src/_q-press/api/components/MarkdownPageToc.json +17 -0
  34. package/src/templates/init/src/_q-press/api/components/MarkdownPrerender.json +25 -0
  35. package/src/templates/init/src/_q-press/api/components/MarkdownTree.json +27 -0
  36. package/src/templates/init/src/_q-press/api/composables/dark.json +29 -0
  37. package/src/templates/init/src/_q-press/api/composables/scroll.json +34 -0
  38. package/src/templates/init/src/_q-press/assets/get-meta.ts +29 -0
  39. package/src/templates/init/src/_q-press/components/DarkModeToggle.vue +105 -0
  40. package/src/templates/init/src/_q-press/components/MarkdownApi.vue +588 -0
  41. package/src/templates/init/src/_q-press/components/MarkdownApiEntry.ts +594 -0
  42. package/src/templates/init/src/_q-press/components/MarkdownCardLink.vue +25 -0
  43. package/src/templates/init/src/_q-press/components/MarkdownCardTitle.vue +21 -0
  44. package/src/templates/init/src/_q-press/components/MarkdownCode.vue +25 -0
  45. package/src/templates/init/src/_q-press/components/MarkdownCodePrism.ts +36 -0
  46. package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +183 -0
  47. package/src/templates/init/src/_q-press/components/MarkdownCopyButton.vue +104 -0
  48. package/src/templates/init/src/_q-press/components/MarkdownExample.vue +221 -0
  49. package/src/templates/init/src/_q-press/components/MarkdownInstallation.vue +166 -0
  50. package/src/templates/init/src/_q-press/components/MarkdownLink.vue +38 -0
  51. package/src/templates/init/src/_q-press/components/MarkdownPrerender.ts +82 -0
  52. package/src/templates/init/src/_q-press/components/MarkdownTree.vue +105 -0
  53. package/src/templates/init/src/_q-press/components/markdown-utils.ts +105 -0
  54. package/src/templates/init/src/_q-press/composables/dark.ts +39 -0
  55. package/src/templates/init/src/_q-press/composables/scroll.ts +115 -0
  56. package/src/templates/init/src/_q-press/css/app.scss +662 -0
  57. package/src/templates/init/src/_q-press/css/fonts.scss +100 -0
  58. package/src/templates/init/src/_q-press/css/prism-theme.scss +298 -0
  59. package/src/templates/init/src/_q-press/css/themes/default.scss +68 -0
  60. package/src/templates/init/src/_q-press/css/themes/newspaper.scss +69 -0
  61. package/src/templates/init/src/_q-press/css/themes/sunrise.scss +67 -0
  62. package/src/templates/init/src/_q-press/css/themes/tawny.scss +69 -0
  63. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
  64. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
  65. package/src/templates/init/src/_q-press/layouts/MarkdownHeader.vue +412 -0
  66. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
  67. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
  68. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
  69. package/src/templates/init/src/_q-press/layouts/MarkdownLayout.vue +239 -0
  70. package/src/templates/init/src/_q-press/layouts/MarkdownPage.vue +307 -0
  71. package/src/templates/init/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
  72. package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
  73. package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
  74. package/src/templates/init/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
  75. package/src/templates/init/src/_q-press/layouts/MarkdownSearch.vue +449 -0
  76. package/src/templates/init/src/_q-press/stores/markdown.ts +101 -0
  77. package/src/templates/init/src/components/LandingPage/LandingPage.vue +341 -0
  78. package/src/templates/init/src/components/Releases/PackageReleases.vue +164 -0
  79. package/src/templates/init/src/components/Releases/PublicReleases.vue +149 -0
  80. package/src/templates/init/src/components/Releases/ReleasesAvailable.vue +74 -0
  81. package/src/templates/init/src/examples/QAvatar/BasicExample.vue +11 -0
  82. package/src/templates/init/src/markdown/__elements.md +548 -0
  83. package/src/templates/init/src/markdown/__elements2.md +347 -0
  84. package/src/templates/init/src/markdown/faq/best-practices.md +0 -0
  85. package/src/templates/init/src/markdown/faq/general.md +0 -0
  86. package/src/templates/init/src/markdown/faq/troubleshooting.md +0 -0
  87. package/src/templates/init/src/markdown/getting-started/introduction.md +67 -0
  88. package/src/templates/init/src/markdown/guides/contributing.md +101 -0
  89. package/src/templates/init/src/markdown/guides/faq.md +115 -0
  90. package/src/templates/init/src/markdown/guides/release-notes.md +0 -0
  91. package/src/templates/init/src/markdown/guides/style-guide.md +0 -0
  92. package/src/templates/init/src/markdown/landing-page.md +11 -0
  93. package/src/templates/init/src/markdown/listing.ts +3 -0
  94. package/src/templates/init/src/markdown/md-plugins/blockquote/advanced.md +83 -0
  95. package/src/templates/init/src/markdown/md-plugins/blockquote/overview.md +183 -0
  96. package/src/templates/init/src/markdown/md-plugins/codeblocks/advanced.md +210 -0
  97. package/src/templates/init/src/markdown/md-plugins/codeblocks/overview.md +616 -0
  98. package/src/templates/init/src/markdown/md-plugins/containers/advanced.md +301 -0
  99. package/src/templates/init/src/markdown/md-plugins/containers/overview.md +206 -0
  100. package/src/templates/init/src/markdown/md-plugins/frontmatter/advanced.md +164 -0
  101. package/src/templates/init/src/markdown/md-plugins/frontmatter/overview.md +131 -0
  102. package/src/templates/init/src/markdown/md-plugins/headers/advanced.md +236 -0
  103. package/src/templates/init/src/markdown/md-plugins/headers/overview.md +134 -0
  104. package/src/templates/init/src/markdown/md-plugins/image/advanced.md +114 -0
  105. package/src/templates/init/src/markdown/md-plugins/image/overview.md +124 -0
  106. package/src/templates/init/src/markdown/md-plugins/imports/advanced.md +105 -0
  107. package/src/templates/init/src/markdown/md-plugins/imports/overview.md +80 -0
  108. package/src/templates/init/src/markdown/md-plugins/inline-code/advanced.md +133 -0
  109. package/src/templates/init/src/markdown/md-plugins/inline-code/overview.md +101 -0
  110. package/src/templates/init/src/markdown/md-plugins/link/advanced.md +157 -0
  111. package/src/templates/init/src/markdown/md-plugins/link/overview.md +126 -0
  112. package/src/templates/init/src/markdown/md-plugins/shared/overview.md +175 -0
  113. package/src/templates/init/src/markdown/md-plugins/table/advanced.md +190 -0
  114. package/src/templates/init/src/markdown/md-plugins/table/overview.md +186 -0
  115. package/src/templates/init/src/markdown/md-plugins/title/advanced.md +88 -0
  116. package/src/templates/init/src/markdown/md-plugins/title/overview.md +99 -0
  117. package/src/templates/init/src/markdown/other/release-notes.md +12 -0
  118. package/src/templates/init/src/markdown/privacy-policy.md +12 -0
  119. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +101 -0
  120. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/components.md +69 -0
  121. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +254 -0
  122. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/themes.md +4 -0
  123. package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/advanced.md +4 -0
  124. package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/overview.md +103 -0
  125. package/src/templates/init/src/markdown/vite-plugins/index.md +6 -0
  126. package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/advanced.md +138 -0
  127. package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/overview.md +88 -0
  128. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/advanced.md +226 -0
  129. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/index.md +6 -0
  130. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/overview.md +166 -0
  131. package/src/templates/init/src/q-press.globals.d.ts +36 -0
  132. package/src/templates/init/src/siteConfig/index.ts +440 -0
  133. package/src/templates/update/src/_q-press/.gitkeep +0 -0
  134. package/src/templates/update/src/_q-press/api/components/DarkModeToggle.json +37 -0
  135. package/src/templates/update/src/_q-press/api/components/MarkdownApi.json +67 -0
  136. package/src/templates/update/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
  137. package/src/templates/update/src/_q-press/api/components/MarkdownCardLink.json +28 -0
  138. package/src/templates/update/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
  139. package/src/templates/update/src/_q-press/api/components/MarkdownCode.json +37 -0
  140. package/src/templates/update/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
  141. package/src/templates/update/src/_q-press/api/components/MarkdownCodepen.json +21 -0
  142. package/src/templates/update/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
  143. package/src/templates/update/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
  144. package/src/templates/update/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
  145. package/src/templates/update/src/_q-press/api/components/MarkdownExample.json +22 -0
  146. package/src/templates/update/src/_q-press/api/components/MarkdownHeader.json +28 -0
  147. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
  148. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
  149. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
  150. package/src/templates/update/src/_q-press/api/components/MarkdownInstallation.json +33 -0
  151. package/src/templates/update/src/_q-press/api/components/MarkdownLayout.json +52 -0
  152. package/src/templates/update/src/_q-press/api/components/MarkdownLink.json +23 -0
  153. package/src/templates/update/src/_q-press/api/components/MarkdownPage.json +71 -0
  154. package/src/templates/update/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
  155. package/src/templates/update/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
  156. package/src/templates/update/src/_q-press/api/components/MarkdownPageToc.json +17 -0
  157. package/src/templates/update/src/_q-press/api/components/MarkdownPrerender.json +25 -0
  158. package/src/templates/update/src/_q-press/api/components/MarkdownTree.json +27 -0
  159. package/src/templates/update/src/_q-press/api/composables/dark.json +29 -0
  160. package/src/templates/update/src/_q-press/api/composables/scroll.json +34 -0
  161. package/src/templates/update/src/_q-press/assets/get-meta.ts +29 -0
  162. package/src/templates/update/src/_q-press/components/DarkModeToggle.vue +105 -0
  163. package/src/templates/update/src/_q-press/components/MarkdownApi.vue +588 -0
  164. package/src/templates/update/src/_q-press/components/MarkdownApiEntry.ts +594 -0
  165. package/src/templates/update/src/_q-press/components/MarkdownCardLink.vue +25 -0
  166. package/src/templates/update/src/_q-press/components/MarkdownCardTitle.vue +21 -0
  167. package/src/templates/update/src/_q-press/components/MarkdownCode.vue +25 -0
  168. package/src/templates/update/src/_q-press/components/MarkdownCodePrism.ts +36 -0
  169. package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +183 -0
  170. package/src/templates/update/src/_q-press/components/MarkdownCopyButton.vue +104 -0
  171. package/src/templates/update/src/_q-press/components/MarkdownExample.vue +221 -0
  172. package/src/templates/update/src/_q-press/components/MarkdownInstallation.vue +166 -0
  173. package/src/templates/update/src/_q-press/components/MarkdownLink.vue +38 -0
  174. package/src/templates/update/src/_q-press/components/MarkdownPrerender.ts +82 -0
  175. package/src/templates/update/src/_q-press/components/MarkdownTree.vue +105 -0
  176. package/src/templates/update/src/_q-press/components/markdown-utils.ts +105 -0
  177. package/src/templates/update/src/_q-press/composables/dark.ts +39 -0
  178. package/src/templates/update/src/_q-press/composables/scroll.ts +115 -0
  179. package/src/templates/update/src/_q-press/css/app.scss +662 -0
  180. package/src/templates/update/src/_q-press/css/fonts.scss +100 -0
  181. package/src/templates/update/src/_q-press/css/prism-theme.scss +298 -0
  182. package/src/templates/update/src/_q-press/css/themes/default.scss +68 -0
  183. package/src/templates/update/src/_q-press/css/themes/newspaper.scss +69 -0
  184. package/src/templates/update/src/_q-press/css/themes/sunrise.scss +67 -0
  185. package/src/templates/update/src/_q-press/css/themes/tawny.scss +69 -0
  186. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
  187. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
  188. package/src/templates/update/src/_q-press/layouts/MarkdownHeader.vue +412 -0
  189. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
  190. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
  191. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
  192. package/src/templates/update/src/_q-press/layouts/MarkdownLayout.vue +239 -0
  193. package/src/templates/update/src/_q-press/layouts/MarkdownPage.vue +307 -0
  194. package/src/templates/update/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
  195. package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
  196. package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
  197. package/src/templates/update/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
  198. package/src/templates/update/src/_q-press/layouts/MarkdownSearch.vue +449 -0
  199. package/src/templates/update/src/_q-press/stores/markdown.ts +101 -0
  200. package/src/templates/update/src/q-press.globals.d.ts +36 -0
@@ -0,0 +1,166 @@
1
+ ---
2
+ title: Vite Markdown Plugin
3
+ desc: Vite plugin for transforming Markdown content into Vue Single File Components.
4
+ related:
5
+ - vite-plugins/viteexamplesplugin/overview
6
+ - quasar-app-extensions/vitemdpluginappext/overview
7
+ ---
8
+
9
+ Welcome to the Vite Markdown Plugin documentation! This guide will provide you with an overview of the Vite Markdown plugin and its features.
10
+
11
+ ## What is the Vite Markdown Plugin?
12
+
13
+ The Vite Markdown Plugin is a powerful tool that transforms Markdown content into Vue Single File Components (SFCs). It integrates seamlessly with Vite to provide a flexible and customizable way to handle Markdown files in your Vue projects.
14
+
15
+ ## Key Features
16
+
17
+ - **Markdown to Vue SFC Transformation**: Converts Markdown files into Vue Single File Components, enabling dynamic content rendering.
18
+ - **Navigation Menu Integration**: Supports generating a navigation structure based on your Markdown files.
19
+ - **Configurable Path Prefix**: Allows setting a base path for routing or file resolution.
20
+ - **Opinionated and Minimal**: Focuses on simplicity, leveraging the power of Vue and Markdown for content-driven applications.
21
+
22
+ ## md-plugins Used
23
+
24
+ The `viteMdPlugin` is built on top of the following plugins:
25
+
26
+ | Plugin | Description | Readme | Docs |
27
+ | ----------------------------------- | ----------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------- |
28
+ | `@md-plugins/md-plugin-codeblocks` | Enhances code block rendering with syntax highlighting, tabs, and more. | [README](packages/md-plugin-codeblocks/README.md) | [Docs](/md-plugins/codeblocks/overview) |
29
+ | `@md-plugins/md-plugin-blockquote` | Adds customizable CSS classes to blockquotes. | [README](packages/md-plugin-blockquote/README.md) | [Docs](/md-plugins/blockquote/overview) |
30
+ | `@md-plugins/md-plugin-headers` | Extracts and processes headers for generating ToCs or managing headers. | [README](packages/md-plugin-headers/README.md) | [Docs](/md-plugins/headers/overview) |
31
+ | `@md-plugins/md-plugin-inlinecode` | Adds a custom class to inline code blocks for styling. | [README](packages/md-plugin-inlinecode/README.md) | [Docs](/md-plugins/inline-code/overview) |
32
+ | `@md-plugins/md-plugin-imports` | Extracts and processes `<script import>` blocks from Markdown. | [README](packages/md-plugin-imports/README.md) | [Docs](/md-plugins/imports/overview) |
33
+ | `@md-plugins/md-plugin-link` | Converts Markdown links into Vue components for SPA-friendly routing. | [README](packages/md-plugin-link/README.md) | [Docs](/md-plugins/link/overview) |
34
+ | `@md-plugins/md-plugin-table` | Adds custom classes and attributes to Markdown tables. | [README](packages/md-plugin-table/README.md) | [Docs](/md-plugins/table/overview) |
35
+ | `@md-plugins/md-plugin-title` | Extracts the first header in Markdown as the page title. | [README](packages/md-plugin-title/README.md) | [Docs](/md-plugins/title/overview) |
36
+ | `@md-plugins/md-plugin-frontmatter` | Extracts and processes frontmatter content from Markdown files. | [README](packages/md-plugin-frontmatter/README.md) | [Docs](/md-plugins/frontmatter/overview) |
37
+ | `@md-plugins/md-plugin-containers` | Adds custom containers for callouts, warnings, and more. | [README](packages/md-plugin-containers/README.md) | [Docs](/md-plugins/containers/overview) |
38
+ | `@md-plugins/shared` | Shared utilities and types for the plugins. | [README](packages/shared/README.md) | [Docs](/md-plugins/shared/overview) |
39
+
40
+ ## Installation
41
+
42
+ You can install the Vite MD plugin using npm, yarn, or pnpm. Choose your preferred method below:
43
+
44
+ ```tabs
45
+ <<| bash npm |>>
46
+ npm install @md-plugins/vite-md-plugin
47
+ <<| bash yarn |>>
48
+ yarn add @md-plugins/vite-md-plugin
49
+ <<| bash pnpm |>>
50
+ pnpm add @md-plugins/vite-md-plugin
51
+ ```
52
+
53
+ ## Usage
54
+
55
+ ### Basic Setup with Vite
56
+
57
+ To use the `viteMdPlugin`, configure it in your Vite project:
58
+
59
+ ```typescript
60
+ import { defineConfig } from 'vite'
61
+ import vue from '@vitejs/plugin-vue'
62
+ import { viteMdPlugin } from 'vite-md-plugin'
63
+
64
+ const menu = [] // Define your navigation menu structure here
65
+ const basePath = '/docs' // Base path prefix
66
+
67
+ export default defineConfig({
68
+ plugins: [vue(), viteMdPlugin({ path: basePath, menu })],
69
+ })
70
+ ```
71
+
72
+ ## Quasar Framework Configuration
73
+
74
+ If you’re using the Quasar Framework, additional configuration is needed to enable support for `.md` files:
75
+
76
+ 1. Update `quasar.config.(js|ts)`:
77
+
78
+ ```typescript
79
+ import { viteMdPlugin } from '@md-plugins/vite-md-plugin';
80
+ import { menu } from './src/assets/menu'; // be sure to create this file
81
+
82
+ export default defineConfig((ctx) => {
83
+ // ...
84
+ ```
85
+
86
+ 2. Add the following configuration:
87
+
88
+ ```typescript
89
+ build: {
90
+ vueRouterMode: 'history', // Required for proper hash link handling
91
+
92
+ viteVuePluginOptions: {
93
+ include: [/\.(vue|md)$/], // Include Markdown files
94
+ },
95
+
96
+ vitePlugins: [
97
+ [
98
+ viteMdPlugin,
99
+ {
100
+ path: ctx.appPaths.srcDir + '/markdown',
101
+ menu: sidebar as MenuItem[],
102
+ },
103
+ ],
104
+ // ...
105
+ ],
106
+ },
107
+
108
+ framework: {
109
+ autoImportVueExtensions: ['vue', 'md'], // Enable auto-import for Markdown extensions
110
+ },
111
+ ```
112
+
113
+ 3. Ensure that your routes and hash links are compatible with Vue Router's history mode.
114
+
115
+ ## Navigation Menu Integration
116
+
117
+ The `viteMdPlugin` allows you to define a navigation structure that can be updated dynamically based on the Markdown files in your project:
118
+
119
+ ```typescript
120
+ const menu = [
121
+ { title: 'Home', path: '/home' },
122
+ { title: 'About', path: '/about' },
123
+ ]
124
+ ```
125
+
126
+ This menu is passed as a parameter to the plugin and can be used to build a dynamic sidebar or navigation bar in your application.
127
+
128
+ ## Options
129
+
130
+ The `viteMdPlugin` accepts the following parameters:
131
+
132
+ | Parameter | Type | Description |
133
+ | --------- | ---------- | ------------------------------------------------------------------------------------------ |
134
+ | path | string | The base path prefix for routing or file resolution. |
135
+ | menu | MenuItem[] | An array representing the navigation menu structure. Each item should have title and path. |
136
+
137
+ ## MenuItem Type
138
+
139
+ The `menu` parameter should conform to the following structure:
140
+
141
+ ```typescript
142
+ export interface MenuItem {
143
+ name: string
144
+ path?: string
145
+ icon?: string
146
+ iconColor?: string
147
+ rightIcon?: string
148
+ rightIconColor?: string
149
+ badge?: string
150
+ children?: MenuItem[]
151
+ external?: boolean
152
+ expanded?: boolean
153
+ }
154
+ ```
155
+
156
+ ## Testing
157
+
158
+ To run the tests for this plugin, use the following command:
159
+
160
+ ```bash
161
+ pnpm test
162
+ ```
163
+
164
+ ## License
165
+
166
+ This project is licensed under the MIT License. See the LICENSE file for details.
@@ -0,0 +1,36 @@
1
+ declare module '*.md'
2
+
3
+ // Define types for headers
4
+ interface TocMenuItem {
5
+ id: string
6
+ level: number
7
+ title: string
8
+ link?: string
9
+ deep?: boolean
10
+ sub?: boolean
11
+ onClick?: () => void
12
+ children?: TocMenuItem[]
13
+ }
14
+
15
+ // Define types for Markdown modules
16
+ interface MarkdownModule {
17
+ title?: string
18
+ headers?: TocMenuItem[]
19
+ frontmatter?: Record<string, unknown>
20
+ filename?: string
21
+ render: (...args: unknown[]) => unknown
22
+ }
23
+
24
+ // Define types for menu items
25
+ interface MenuItem {
26
+ name: string
27
+ path?: string
28
+ icon?: string
29
+ iconColor?: string
30
+ rightIcon?: string
31
+ rightIconColor?: string
32
+ badge?: string
33
+ children?: MenuItem[] | undefined
34
+ external?: boolean
35
+ expanded?: boolean
36
+ }
@@ -0,0 +1,440 @@
1
+ import { fabGithub, fabXTwitter } from '@quasar/extras/fontawesome-v6'
2
+ import { slugify } from '@md-plugins/shared'
3
+ import { version, productName } from '../../package.json'
4
+
5
+ export interface SocialLink {
6
+ name: string
7
+ icon: string
8
+ path: string
9
+ external?: boolean
10
+ }
11
+
12
+ export interface SiteMenuItem extends MenuItem {
13
+ about?: string
14
+ expanded?: boolean
15
+ external?: boolean
16
+ children?: SiteMenuItem[]
17
+ separator?: boolean
18
+ header?: string
19
+ mq?: number
20
+ extract?: string
21
+ image?: string
22
+ maxWidth?: string
23
+ }
24
+
25
+ export interface LinksConfig {
26
+ primaryHeaderLinks: SiteMenuItem[]
27
+ secondaryHeaderLinks: SiteMenuItem[]
28
+ moreLinks: SiteMenuItem[]
29
+ footerLinks: SiteMenuItem[]
30
+ socialLinks: SocialLink[]
31
+ ecoSystemLinks?: SiteMenuItem[]
32
+ }
33
+
34
+ export interface LogoConfig {
35
+ showLogo: boolean
36
+ logoLight: string
37
+ logoDark: string
38
+ logoAlt: string
39
+ }
40
+
41
+ export interface versionConfig {
42
+ showTitle: boolean
43
+ showVersion: boolean
44
+ showOnHeader: boolean
45
+ showOnSidebar: boolean
46
+ }
47
+
48
+ export interface UIConfig {
49
+ usePrimaryHeader: boolean // typically 72px
50
+ useSecondaryHeader: boolean // typically 55px
51
+ headerHeightHint: number // typically 128 for both headers
52
+ useMoreLinks: boolean
53
+ useFooter: boolean
54
+ useSidebar: boolean
55
+ useToc: boolean
56
+ }
57
+
58
+ export interface CopyrightConfig {
59
+ line1: string
60
+ line2: string
61
+ }
62
+
63
+ export interface LicenseConfig {
64
+ label: string
65
+ link: string
66
+ }
67
+
68
+ export interface PrivacyConfig {
69
+ label: string
70
+ link: string
71
+ }
72
+
73
+ export interface SiteConfig {
74
+ lang: string
75
+ title: string
76
+ description: string
77
+ theme: string
78
+ version: string
79
+ copyright: CopyrightConfig
80
+ githubEditRoot: string
81
+ license: LicenseConfig
82
+ privacy: PrivacyConfig
83
+ logoConfig: LogoConfig
84
+ versionConfig: versionConfig
85
+ config: UIConfig
86
+ links: LinksConfig
87
+ sidebar: MenuItem[]
88
+ }
89
+
90
+ function processMenuItem(item: MenuItem): MenuItem {
91
+ return {
92
+ name: item.name,
93
+ path: slugify(item.name),
94
+ expanded: item.expanded ?? false,
95
+ children: item.children ? item.children.map(processMenuItem) : undefined,
96
+ }
97
+ }
98
+
99
+ const socialLinks = {
100
+ name: 'Social',
101
+ mq: 1400, // media query breakpoint
102
+ children: [
103
+ {
104
+ name: 'GitHub',
105
+ icon: fabGithub,
106
+ path: 'https://github.com/md-plugins/md-plugins/tree/dev',
107
+ external: true,
108
+ },
109
+ {
110
+ name: 'X (Twitter)',
111
+ icon: fabXTwitter,
112
+ path: 'https://twitter.com/md_plugins',
113
+ external: true,
114
+ },
115
+ ],
116
+ }
117
+
118
+ const netlifyLink = {
119
+ path: 'https://www.netlify.com',
120
+ external: true,
121
+ image: 'https://www.netlify.com/img/global/badges/netlify-color-accent.svg',
122
+ name: 'Deploys by Netlify',
123
+ maxWidth: '120px',
124
+ }
125
+
126
+ const SponsorsLinks = {
127
+ name: 'Sponsors',
128
+ children: [
129
+ {
130
+ name: netlifyLink.name,
131
+ path: netlifyLink.path,
132
+ external: netlifyLink.external,
133
+ image: netlifyLink.image,
134
+ },
135
+ ],
136
+ }
137
+
138
+ const footerLinks = [
139
+ {
140
+ name: SponsorsLinks.name,
141
+ children: [...SponsorsLinks.children],
142
+ },
143
+ {
144
+ name: socialLinks.name,
145
+ children: [...socialLinks.children],
146
+ },
147
+ ]
148
+
149
+ const gettingStartedMenu = {
150
+ name: 'Getting Started',
151
+ mq: 470, // media query breakpoint
152
+ children: [{ name: 'Introduction', path: '/getting-started/introduction' }],
153
+ }
154
+
155
+ const mdPluginsMenu = {
156
+ name: 'MD Plugins',
157
+ mq: 600, // media query breakpoint
158
+ children: [
159
+ {
160
+ name: 'Blockquote',
161
+ children: [
162
+ { name: 'Overview', path: '/md-plugins/blockquote/overview' },
163
+ { name: 'Advanced', path: '/md-plugins/blockquote/advanced' },
164
+ ],
165
+ },
166
+ {
167
+ name: 'Codeblocks',
168
+ children: [
169
+ { name: 'Overview', path: '/md-plugins/codeblocks/overview' },
170
+ { name: 'Advanced', path: '/md-plugins/codeblocks/advanced' },
171
+ ],
172
+ },
173
+ {
174
+ name: 'Containers',
175
+ children: [
176
+ { name: 'Overview', path: '/md-plugins/containers/overview' },
177
+ { name: 'Advanced', path: '/md-plugins/containers/advanced' },
178
+ ],
179
+ },
180
+ {
181
+ name: 'Frontmatter',
182
+ children: [
183
+ { name: 'Overview', path: '/md-plugins/frontmatter/overview' },
184
+ { name: 'Advanced', path: '/md-plugins/frontmatter/advanced' },
185
+ ],
186
+ },
187
+ {
188
+ name: 'Headers',
189
+ children: [
190
+ { name: 'Overview', path: '/md-plugins/headers/overview' },
191
+ { name: 'Advanced', path: '/md-plugins/headers/advanced' },
192
+ ],
193
+ },
194
+ {
195
+ name: 'Image',
196
+ children: [
197
+ { name: 'Overview', path: '/md-plugins/image/overview' },
198
+ { name: 'Advanced', path: '/md-plugins/image/advanced' },
199
+ ],
200
+ },
201
+ {
202
+ name: 'Imports',
203
+ children: [
204
+ { name: 'Overview', path: '/md-plugins/imports/overview' },
205
+ { name: 'Advanced', path: '/md-plugins/imports/advanced' },
206
+ ],
207
+ },
208
+ {
209
+ name: 'Inline Code',
210
+ children: [
211
+ { name: 'Overview', path: '/md-plugins/inlinecode/overview' },
212
+ { name: 'Advanced', path: '/md-plugins/inlinecode/advanced' },
213
+ ],
214
+ },
215
+ {
216
+ name: 'Link',
217
+ children: [
218
+ { name: 'Overview', path: '/md-plugins/link/overview' },
219
+ { name: 'Advanced', path: '/md-plugins/link/advanced' },
220
+ ],
221
+ },
222
+ {
223
+ name: 'Table',
224
+ children: [
225
+ { name: 'Overview', path: '/md-plugins/table/overview' },
226
+ { name: 'Advanced', path: '/md-plugins/table/advanced' },
227
+ ],
228
+ },
229
+ {
230
+ name: 'Title',
231
+ children: [
232
+ { name: 'Overview', path: '/md-plugins/title/overview' },
233
+ { name: 'Advanced', path: '/md-plugins/title/advanced' },
234
+ ],
235
+ },
236
+ {
237
+ name: 'Shared',
238
+ children: [{ name: 'Overview', path: '/md-plugins/shared/overview' }],
239
+ },
240
+ ],
241
+ }
242
+
243
+ const vitePluginsMenu = {
244
+ name: 'Vite Plugins',
245
+ mq: 780, // media query breakpoint
246
+ children: [
247
+ {
248
+ name: 'viteMdPlugin',
249
+ children: [
250
+ { name: 'Overview', path: '/vite-plugins/vitemdplugin/overview' },
251
+ { name: 'Advanced', path: '/vite-plugins/vitemdplugin/advanced' },
252
+ ],
253
+ },
254
+ {
255
+ name: 'viteExamplesPlugin',
256
+ children: [
257
+ { name: 'Overview', path: '/vite-plugins/viteexamplesplugin/overview' },
258
+ { name: 'Advanced', path: '/vite-plugins/viteexamplesplugin/advanced' },
259
+ ],
260
+ },
261
+ ],
262
+ }
263
+
264
+ const QuasarAppExts = {
265
+ name: 'Quasar App Extensions',
266
+ mq: 1020, // media query breakpoint
267
+ children: [
268
+ {
269
+ name: 'viteMdPluginAppExt',
270
+ children: [
271
+ { name: 'Overview', path: '/quasar-app-extensions/vitemdpluginappext/overview' },
272
+ { name: 'Advanced', path: '/quasar-app-extensions/vitemdpluginappext/advanced' },
273
+ ],
274
+ },
275
+ {
276
+ name: 'QPress',
277
+ children: [
278
+ { name: 'Overview', path: '/quasar-app-extensions/qpress/overview' },
279
+ { name: 'Advanced', path: '/quasar-app-extensions/qpress/advanced' },
280
+ { name: 'Themes', path: '/quasar-app-extensions/qpress/themes' },
281
+ { name: 'Components', path: '/quasar-app-extensions/qpress/components' },
282
+ ],
283
+ },
284
+ ],
285
+ }
286
+
287
+ const guidesMenu = {
288
+ name: 'Guides',
289
+ mq: 1100, // media query breakpoint
290
+ children: [
291
+ {
292
+ name: 'FAQ',
293
+ path: '/guides/faq',
294
+ },
295
+ {
296
+ name: 'Contributing',
297
+ path: '/guides/contributing',
298
+ },
299
+ ],
300
+ }
301
+
302
+ const otherMenu = {
303
+ name: 'Other',
304
+ mq: 1190, // media query breakpoint
305
+ children: [
306
+ {
307
+ name: 'Releases',
308
+ path: '/other/release-notes',
309
+ },
310
+ ],
311
+ }
312
+
313
+ const processedMdPluginsMenu = {
314
+ name: mdPluginsMenu.name,
315
+ path: slugify(mdPluginsMenu.name),
316
+ expanded: false,
317
+ children: mdPluginsMenu.children.map(processMenuItem),
318
+ }
319
+
320
+ const processedVitePluginsMenu = {
321
+ name: vitePluginsMenu.name,
322
+ path: slugify(vitePluginsMenu.name),
323
+ expanded: false,
324
+ children: vitePluginsMenu.children.map(processMenuItem),
325
+ }
326
+
327
+ const processedQuasarAppExts = {
328
+ name: QuasarAppExts.name,
329
+ path: slugify(QuasarAppExts.name),
330
+ expanded: false,
331
+ children: QuasarAppExts.children.map(processMenuItem),
332
+ }
333
+
334
+ const processedGuidesMenu = {
335
+ name: guidesMenu.name,
336
+ path: slugify(guidesMenu.name),
337
+ expanded: false,
338
+ children: guidesMenu.children.map(processMenuItem),
339
+ }
340
+
341
+ const secondaryToolbarLinks = [
342
+ gettingStartedMenu,
343
+ mdPluginsMenu,
344
+ vitePluginsMenu,
345
+ QuasarAppExts,
346
+ guidesMenu,
347
+ otherMenu,
348
+ ]
349
+
350
+ export const moreLinks = [
351
+ {
352
+ name: 'More',
353
+ // children: [...primaryToolbarLinks, { separator: true }, ...secondaryToolbarLinks, socialLinks],
354
+ children: [...secondaryToolbarLinks, socialLinks],
355
+ },
356
+ ]
357
+
358
+ export const sidebar = [
359
+ {
360
+ name: gettingStartedMenu.name,
361
+ path: slugify(gettingStartedMenu.name),
362
+ expanded: false,
363
+ children: gettingStartedMenu.children.map((item) => ({
364
+ name: item.name,
365
+ path: slugify(item.name),
366
+ })),
367
+ },
368
+ processedMdPluginsMenu,
369
+ processedVitePluginsMenu,
370
+ processedQuasarAppExts,
371
+ processedGuidesMenu,
372
+ ]
373
+
374
+ const config = {
375
+ lang: 'en-US',
376
+ title: productName,
377
+ description:
378
+ 'MD-Plugins is a collection of Markdown and Vite plugins that make it easy to build markdown user interfaces in Vue and Quasar applications.',
379
+ theme: 'doc',
380
+ version: version,
381
+ copyright: {
382
+ line1: `Copyright © 2024-${new Date().getFullYear()} MD-PLUGINS`,
383
+ line2: '',
384
+ } as CopyrightConfig,
385
+ githubEditRoot: 'https://github.com/md-plugins/md-plugins/edit/dev/packages/docs/src/markdown/',
386
+ license: {
387
+ label: 'MIT License',
388
+ link: 'https://github.com/md-plugins/md-plugins/blob/dev/LICENSE.md',
389
+ } as LicenseConfig,
390
+ privacy: {
391
+ label: 'Privacy Policy',
392
+ link: '/privacy-policy',
393
+ } as PrivacyConfig,
394
+ logoConfig: {
395
+ showLogo: true,
396
+ logoLight:
397
+ 'https://raw.githubusercontent.com/md-plugins/md-plugins/refs/heads/main/media/markdown-1024x1024.png',
398
+ logoDark:
399
+ 'https://raw.githubusercontent.com/md-plugins/md-plugins/refs/heads/main/media/markdown-1024x1024.png',
400
+ logoAlt: '@md-plugins',
401
+ } as LogoConfig,
402
+ versionConfig: {
403
+ showTitle: true,
404
+ showVersion: true,
405
+ showOnHeader: false,
406
+ showOnSidebar: true,
407
+ } as versionConfig,
408
+ config: {
409
+ usePrimaryHeader: false,
410
+ useSecondaryHeader: true,
411
+ headerHeightHint: 55,
412
+ useMoreLinks: true,
413
+ useFooter: true,
414
+ // useFooterLinks: true,
415
+ useSidebar: true,
416
+ useSidebarVersion: true,
417
+ useToc: true,
418
+ } as UIConfig,
419
+ links: {
420
+ primaryHeaderLinks: [] as SiteMenuItem[], // [...primaryToolbarLinks],
421
+ secondaryHeaderLinks: [...secondaryToolbarLinks] as SiteMenuItem[],
422
+ moreLinks: [
423
+ {
424
+ name: 'More',
425
+ children: [
426
+ // ...primaryToolbarLinks,
427
+ // { separator: true },
428
+ ...secondaryToolbarLinks,
429
+ socialLinks,
430
+ ],
431
+ },
432
+ ] as SiteMenuItem[],
433
+ footerLinks: [...footerLinks] as SiteMenuItem[],
434
+ socialLinks: [...socialLinks.children] as SocialLink[],
435
+ },
436
+ sidebar,
437
+ } as SiteConfig
438
+
439
+ export { sidebar as menu }
440
+ export default config
File without changes
@@ -0,0 +1,37 @@
1
+ {
2
+ "type": "component",
3
+ "meta": {
4
+ "docsUrl": "https://path-to-your-docs/dark-mode-toggle"
5
+ },
6
+ "props": {
7
+ "darkIcon": {
8
+ "type": "String",
9
+ "desc": "Icon name for dark mode",
10
+ "examples": [
11
+ "mdiMoonWaningCrescent"
12
+ ],
13
+ "default": "mdiMoonWaningCrescent",
14
+ "category": "content"
15
+ },
16
+ "lightIcon": {
17
+ "type": "String",
18
+ "desc": "Icon name for light mode",
19
+ "examples": [
20
+ "mdiWhiteBalanceSunny"
21
+ ],
22
+ "default": "mdiWhiteBalanceSunny",
23
+ "category": "content"
24
+ }
25
+ },
26
+ "events": {
27
+ "update:mode": {
28
+ "desc": "Emitted when the mode is toggled",
29
+ "params": {
30
+ "mode": {
31
+ "type": "String",
32
+ "desc": "The current mode ('dark' or 'light')"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }