@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,126 @@
1
+ ---
2
+ title: Link Plugin
3
+ desc: Link plugin for Markdown.
4
+ ---
5
+
6
+ Welcome to the Link Plugin documentation! This guide will provide you with an overview of the Link plugin and its features.
7
+
8
+ ## What is the Link Plugin?
9
+
10
+ The Link Plugin is a powerful tool that enhances the standard link functionality in Markdown. It allows you to customize the rendering of links, making it easier to manage internal links and add necessary import statements for custom link components.
11
+
12
+ ## Key Features
13
+
14
+ - **Custom Link Tag**: Use a custom tag for internal links.
15
+ - **Custom Link Keyword**: Customize the keyword used for the link destination.
16
+ - **Automatic Import Statements**: Automatically add import statements for custom link components.
17
+
18
+ ## Examples
19
+
20
+ Here are some examples of what you can achieve with the Link Plugin:
21
+
22
+ ### Standard Link
23
+
24
+ ```markup
25
+ [Link Text](https://example.com)
26
+ ```
27
+
28
+ ### Custom Link Tag and Keyword
29
+
30
+ You can customize the link tag and keyword:
31
+
32
+ ```javascript
33
+ import MarkdownIt from 'markdown-it'
34
+ import { linkPlugin } from '@md-plugins/md-plugin-link'
35
+
36
+ const md = new MarkdownIt()
37
+
38
+ md.use(linkPlugin, {
39
+ linkTag: 'CustomLink', // Optional: Customize the link tag
40
+ linkToKeyword: 'href', // Optional: Customize the link keyword
41
+ pageScript: 'import CustomLink from "src/components/CustomLink.vue"', // Optional: Add import statement
42
+ })
43
+
44
+ // Now you can use the Link plugin in your Markdown content
45
+ const result = md.render('[Link Text](https://example.com)')
46
+ console.log(result)
47
+ ```
48
+
49
+ ## Name
50
+
51
+ The official NPM name is `@md-plugins/md-plugin-link`.
52
+
53
+ ## Installation
54
+
55
+ You can install the Link plugin using npm, yarn, or pnpm. Choose your preferred method below:
56
+
57
+ ```tabs
58
+ <<| bash npm |>>
59
+ npm install @md-plugins/md-plugin-link
60
+ <<| bash yarn |>>
61
+ yarn add @md-plugins/md-plugin-link
62
+ <<| bash pnpm |>>
63
+ pnpm add @md-plugins/md-plugin-link
64
+ ```
65
+
66
+ ## Configuration
67
+
68
+ After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
69
+
70
+ ```javascript
71
+ import MarkdownIt from 'markdown-it'
72
+ import { linkPlugin } from '@md-plugins/md-plugin-link'
73
+
74
+ const md = new MarkdownIt()
75
+
76
+ md.use(linkPlugin, {
77
+ linkTag: 'CustomLink', // Optional: Customize the link tag
78
+ linkToKeyword: 'href', // Optional: Customize the link keyword
79
+ pageScript: 'import CustomLink from "src/components/CustomLink.vue"', // Optional: Add import statement
80
+ })
81
+
82
+ // Now you can use the Link plugin in your Markdown content
83
+ const result = md.render('[Link Text](https://example.com)')
84
+ console.log(result)
85
+ ```
86
+
87
+ ### Options
88
+
89
+ The Link plugin accepts the following options:
90
+
91
+ - **linkTag**: The tag for the internal link. Default is `'MarkdownLink'`.
92
+ - **linkToKeyword**: The keyword for the internal link destination. Default is `'to'`.
93
+ - **pageScript**: Add import statements to the page.
94
+
95
+ ## Advanced Configuration
96
+
97
+ For more advanced configurations, you can combine the Link plugin with other Markdown-It plugins to enhance your Markdown content further. Here's an example:
98
+
99
+ ```javascript
100
+ import MarkdownIt from 'markdown-it'
101
+ import { linkPlugin } from '@md-plugins/md-plugin-link'
102
+ import markdownItAnchor from 'markdown-it-anchor'
103
+ import markdownItToc from 'markdown-it-toc-done-right'
104
+
105
+ const md = new MarkdownIt()
106
+
107
+ md.use(linkPlugin, {
108
+ linkTag: 'CustomLink', // Customize the link tag
109
+ linkToKeyword: 'href', // Customize the link keyword
110
+ pageScript: 'import CustomLink from "src/components/CustomLink.vue"', // Add import statement
111
+ })
112
+ .use(markdownItAnchor)
113
+ .use(markdownItToc)
114
+
115
+ // Now you can use the Link plugin along with other plugins in your Markdown content
116
+ const result = md.render(
117
+ '[Link Text](https://example.com)\n\n# Table of Contents\n\n[[toc]]\n\n[Another Link](https://example.com)',
118
+ )
119
+ console.log(result)
120
+ ```
121
+
122
+ ## Support
123
+
124
+ If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
125
+
126
+ Happy coding!
@@ -0,0 +1,175 @@
1
+ ---
2
+ title: Shared Plugin Overview
3
+ desc: Overview of the shared utilities and types for MD-Plugins plugins.
4
+ ---
5
+
6
+ The `shared` plugin provides a set of utilities and types that are used across various MD-Plugins plugins. It serves as a common foundation, ensuring consistency and reducing duplication of code across the different plugins.
7
+
8
+ ## Key Features
9
+
10
+ - **Common Utilities**: Provides utility functions that are commonly used across multiple plugins.
11
+ - **Type Definitions**: Includes TypeScript type definitions to ensure type safety and consistency.
12
+ - **Helper Functions**: Offers helper functions to simplify common tasks and operations.
13
+ - **Reusable Components**: Contains reusable components that can be leveraged by other plugins.
14
+
15
+ ## Utilities
16
+
17
+ The `shared` plugin includes a variety of utility functions that can be used to perform common tasks. Some of the key utilities include:
18
+
19
+ - **String Manipulation**: Functions for manipulating and formatting strings.
20
+ - **Array Operations**: Functions for performing common array operations.
21
+ - **Object Handling**: Functions for handling and manipulating objects.
22
+ - **Validation**: Functions for validating data and inputs.
23
+
24
+ ## Type Definitions
25
+
26
+ The `shared` plugin provides TypeScript type definitions that are used across the MD-Plugins project. These type definitions help ensure type safety and consistency. Some of the key type definitions include:
27
+
28
+ - **MarkdownItEnv**: Defines the structure of the environment object used by MD-Plugins plugins.
29
+ - **PluginOptions**: Defines the structure of the options object passed to plugins.
30
+
31
+ ```ts
32
+ import Token from 'markdown-it/lib/token.mjs'
33
+
34
+ /**
35
+ * Escape html chars
36
+ */
37
+ declare const htmlEscape: (str: string) => string
38
+
39
+ /**
40
+ * Unescape html chars
41
+ */
42
+ declare const htmlUnescape: (str: string) => string
43
+
44
+ interface MarkdownItEnv {
45
+ plugins?: Record<string, unknown>
46
+ }
47
+
48
+ interface MarkdownItHeader {
49
+ /**
50
+ * The slug of the header
51
+ *
52
+ * Typically the `id` attr of the header anchor
53
+ */
54
+ id: string
55
+ /**
56
+ * The level of the header
57
+ *
58
+ * `1` to `6` for `<h1>` to `<h6>`
59
+ */
60
+ level: number
61
+ /**
62
+ * The title of the header
63
+ */
64
+ title: string
65
+ /**
66
+ * Link of the header
67
+ *
68
+ * Typically using `#${slug}` as the anchor hash
69
+ */
70
+ link: string
71
+ /**
72
+ * The children of the header
73
+ */
74
+ children: MarkdownItHeader[]
75
+ }
76
+
77
+ interface ResolveTitleOptions {
78
+ /**
79
+ * Should allow inline HTML tags or not.
80
+ *
81
+ * If the result is going to be used as Vue template, it should allow inline
82
+ * HTML tags so that Vue custom components would be kept.
83
+ */
84
+ shouldAllowHtml: boolean
85
+ /**
86
+ * Should escape the text content or not.
87
+ *
88
+ * If the result is going to be used in HTML directly, it should be escaped
89
+ * so that the text content won't be wrongly treated as HTML tags.
90
+ */
91
+ shouldEscapeText: boolean
92
+ }
93
+
94
+ /**
95
+ * Resolve header title from markdown-it token
96
+ *
97
+ * Typically using the next token of `heading_open` token
98
+ */
99
+ declare const resolveTitleFromToken: (
100
+ token: Token,
101
+ { shouldAllowHtml, shouldEscapeText }: ResolveTitleOptions,
102
+ ) => string
103
+
104
+ interface ResolveHeadersOptions extends ResolveTitleOptions {
105
+ /**
106
+ * Heading level that is going to be resolved; ie: `1` to `6`
107
+ */
108
+ level: number[]
109
+ /**
110
+ * Should allow headers inside nested blocks or not
111
+ *
112
+ * If set to `true`, headers inside blockquote, list, etc. would also be resolved.
113
+ */
114
+ shouldAllowNested: boolean
115
+ /**
116
+ * A custom slugification function
117
+ *
118
+ * Would be ignored if the `id` attr of the token is set.
119
+ */
120
+ slugify?: (str: string) => string
121
+ /**
122
+ * A function for formatting headings
123
+ */
124
+ format?: (str: string) => string | undefined
125
+ }
126
+
127
+ /**
128
+ * Resolve headers from markdown-it tokens
129
+ */
130
+ declare const resolveHeadersFromTokens: (
131
+ tokens: Token[],
132
+ {
133
+ level,
134
+ shouldAllowHtml,
135
+ shouldAllowNested,
136
+ shouldEscapeText,
137
+ slugify,
138
+ format,
139
+ }?: Partial<ResolveHeadersOptions>,
140
+ ) => MarkdownItHeader[]
141
+
142
+ /**
143
+ * Default slugification function
144
+ */
145
+ declare const slugify: (str: string) => string
146
+
147
+ export {
148
+ type MarkdownItEnv,
149
+ type MarkdownItHeader,
150
+ type ResolveHeadersOptions,
151
+ type ResolveTitleOptions,
152
+ htmlEscape,
153
+ htmlUnescape,
154
+ resolveHeadersFromTokens,
155
+ resolveTitleFromToken,
156
+ slugify,
157
+ }
158
+ ```
159
+
160
+ ## Helper Functions
161
+
162
+ The `shared` plugin includes a variety of helper functions that simplify common tasks and operations. Some of the key helper functions include:
163
+
164
+ - **resolveTitleFromToken**: Extracts the title from a Markdown token.
165
+ - **parseFrontmatter**: Parses frontmatter content from a Markdown file.
166
+ - **generateSlug**: Generates a slug from a given string.
167
+ - **htmlEscape**: Escapes HTML characters in a string.
168
+ - **htmlUnescape**: Unescapes HTML characters in a string.
169
+ - **slugify**: Slugifies a string using a custom function.
170
+
171
+ ## Conclusion
172
+
173
+ The `shared` plugin is an essential part of the MD-Plugins project, providing common utilities, type definitions, helper functions, and reusable components. By leveraging the `shared` plugin, you can ensure consistency and reduce duplication of code across your plugins.
174
+
175
+ Happy coding!
@@ -0,0 +1,190 @@
1
+ ---
2
+ title: Table Plugin Advanced Topics
3
+ desc: Table plugin advanced topics for Markdown.
4
+ ---
5
+
6
+ ## Table Plugin
7
+
8
+ The `table` plugin allows you to customize the rendering of tables in your Markdown content by adding custom classes and attributes. This section will cover how the plugin works, the available options for customization, and examples of how to use it effectively.
9
+
10
+ ### Type Information
11
+
12
+ ```ts
13
+ import { PluginWithOptions } from 'markdown-it'
14
+
15
+ interface TablePluginOptions {
16
+ /**
17
+ * The class for the table
18
+ *
19
+ * @default 'markdown-table'
20
+ */
21
+ tableClass?: string
22
+ /**
23
+ * The class for the table header
24
+ *
25
+ * @default 'text-left'
26
+ */
27
+ tableHeaderClass?: string
28
+ /**
29
+ * The class for the table row
30
+ *
31
+ * @default ''
32
+ */
33
+ tableRowClass?: string
34
+ /**
35
+ * The class for the table cell
36
+ *
37
+ * @default ''
38
+ */
39
+ tableCellClass?: string
40
+ /**
41
+ * The token for the table
42
+ *
43
+ * @default 'q-markup-table' (replaces 'table')
44
+ */
45
+ tableToken?: string
46
+ /**
47
+ * The attributes for the table
48
+ *
49
+ * @default [ [':wrap-cells', 'true'],[':flat', 'true'],[':bordered', 'true'] ]
50
+ */
51
+ tableAttributes?: [string, any][]
52
+ }
53
+
54
+ declare const tablePlugin: PluginWithOptions<TablePluginOptions>
55
+
56
+ export { type TablePluginOptions, tablePlugin }
57
+ ```
58
+
59
+ ### How It Works
60
+
61
+ The `table` plugin processes table tokens in your Markdown content, adding custom classes and attributes to them. This helps improve the styling and functionality of tables in your Markdown content.
62
+
63
+ ### Default Behavior
64
+
65
+ By default, the `table` plugin adds the `markdown-table` class to all tables and applies additional classes and attributes as specified. Here is an example of a Markdown file with a table:
66
+
67
+ | Header 1 | Header 2 |
68
+ | -------- | -------- |
69
+ | Cell 1 | Cell 2 |
70
+
71
+ ```markdown
72
+ | Header 1 | Header 2 |
73
+ | -------- | -------- |
74
+ | Cell 1 | Cell 2 |
75
+ ```
76
+
77
+ ### Plugin Options
78
+
79
+ The `table` plugin provides several options for customization. Here are the available options and their descriptions:
80
+
81
+ #### tableClass
82
+
83
+ - **Type**: `string`
84
+ - **Default**: `'markdown-table'`
85
+ - **Description**: The class to be added to all tables.
86
+
87
+ #### tableHeaderClass
88
+
89
+ - **Type**: `string`
90
+ - **Default**: `'text-left'`
91
+ - **Description**: The class to be added to table headers (`<th>` elements).
92
+
93
+ #### tableRowClass
94
+
95
+ - **Type**: `string`
96
+ - **Default**: `''`
97
+ - **Description**: The class to be added to table rows (`<tr>` elements).
98
+
99
+ #### tableCellClass
100
+
101
+ - **Type**: `string`
102
+ - **Default**: `''`
103
+ - **Description**: The class to be added to table cells (`<td>` elements).
104
+
105
+ #### tableToken
106
+
107
+ - **Type**: `string`
108
+ - **Default**: `'q-markup-table'`
109
+ - **Description**: The custom token to replace the default table tag.
110
+
111
+ #### tableAttributes
112
+
113
+ - **Type**: `Array<[string, string]>`
114
+ - **Default**: `[]`
115
+ - **Description**: Additional attributes to be added to the table.
116
+
117
+ ### Example Configuration
118
+
119
+ Here is an example of how you can configure the `table` plugin with custom options:
120
+
121
+ ```typescript
122
+ import MarkdownIt from 'markdown-it'
123
+ import { tablePlugin } from '@md-plugins/md-plugin-table'
124
+
125
+ const md = new MarkdownIt()
126
+
127
+ md.use(tablePlugin, {
128
+ tableClass: 'custom-table-class',
129
+ tableHeaderClass: 'custom-header-class',
130
+ tableRowClass: 'custom-row-class',
131
+ tableCellClass: 'custom-cell-class',
132
+ tableToken: 'custom-table-token',
133
+ tableAttributes: [['data-custom', 'value']],
134
+ })
135
+ ```
136
+
137
+ ### Customizing the CSS
138
+
139
+ You can customize the appearance of tables by overriding the default CSS class. Here are some examples of how you can customize the tables:
140
+
141
+ #### Default CSS
142
+
143
+ By default, the `table` plugin applies the following CSS class to tables. You can add this class in your CSS to customize the appearance of tables.
144
+
145
+ ```scss
146
+ .markdown-table {
147
+ width: fit-content;
148
+ max-width: 100%;
149
+ }
150
+ ```
151
+
152
+ #### Example 1: Customizing the Border
153
+
154
+ ```css
155
+ .custom-table-class {
156
+ border: 1px solid #dfe2e5; /* Add a border to tables */
157
+ }
158
+ ```
159
+
160
+ #### Example 2: Adding a Background Color
161
+
162
+ ```css
163
+ .custom-table-class {
164
+ background-color: #f0f0f0; /* Add a background color to tables */
165
+ }
166
+ ```
167
+
168
+ #### Example 3: Changing the Font Style
169
+
170
+ ```css
171
+ .custom-table-class {
172
+ font-family: 'Courier New', Courier, monospace; /* Change the font style */
173
+ }
174
+ ```
175
+
176
+ ### Handling the tableAttributes
177
+
178
+ The `table` plugin allows you to add custom attributes to tables. Here is an example of how to add a custom data attribute to tables:
179
+
180
+ ```typescript
181
+ md.use(tablePlugin, {
182
+ tableAttributes: [['data-custom', 'value']],
183
+ })
184
+ ```
185
+
186
+ ### Conclusion
187
+
188
+ The `table` plugin is a powerful tool for customizing the rendering of tables in your Markdown content. By customizing the classes, attributes, and CSS, you can tailor the appearance and functionality of tables to match the style of your project. Experiment with different configurations and find the one that works best for you.
189
+
190
+ Happy coding!
@@ -0,0 +1,186 @@
1
+ ---
2
+ title: Table Plugin
3
+ desc: Table plugin for Markdown.
4
+ ---
5
+
6
+ Welcome to the Table Plugin documentation! This guide will provide you with an overview of the Table plugin and its features.
7
+
8
+ ## What is the Table Plugin?
9
+
10
+ The Table Plugin is a powerful tool that enhances the standard table functionality in Markdown. It allows you to customize the rendering of tables, making it easier to apply consistent styles and attributes to tables in your documentation.
11
+
12
+ ## Key Features
13
+
14
+ - **Custom Table Class**: Apply a custom CSS class to tables.
15
+ - **Custom Header Class**: Apply a custom CSS class to table headers.
16
+ - **Custom Row and Cell Classes**: Apply custom CSS classes to table rows and cells.
17
+ - **Custom Table Token**: Replace the default table tag with a custom token.
18
+ - **Custom Table Attributes**: Add custom attributes to tables.
19
+
20
+ ## Examples
21
+
22
+ Here are some examples of what you can achieve with the Table Plugin:
23
+
24
+ ### Standard Table
25
+
26
+ | Header 1 | Header 2 | Header 3 |
27
+ | -------- | -------- | -------- |
28
+ | Cell 1 | Cell 2 | Cell 3 |
29
+
30
+ ```markup
31
+ | Header 1 | Header 2 | Header 3 |
32
+ | -------- | -------- | -------- |
33
+ | Cell 1 | Cell 2 | Cell 3 |
34
+ ```
35
+
36
+ ### Right-aligned Columns
37
+
38
+ | Header 1 | Header 2 | Header 3 |
39
+ | -------: | -------: | -------: |
40
+ | Cell 1 | Cell 2 | Cell 3 |
41
+
42
+ ```markup
43
+ | Header 1 | Header 2 | Header 3 |
44
+ | -------: | -------: | -------: |
45
+ | Cell 1 | Cell 2 | Cell 3 |
46
+ ```
47
+
48
+ ### Cenetered-aligned Columns
49
+
50
+ | Header 1 | Header 2 | Header 3 |
51
+ | :------: | :------: | :------: |
52
+ | Cell 1 | Cell 2 | Cell 3 |
53
+
54
+ ```markup
55
+ | Header 1 | Header 2 | Header 3 |
56
+ | :------: | :------: | :------: |
57
+ | Cell 1 | Cell 2 | Cell 3 |
58
+ ```
59
+
60
+ ### Left-aligned Columns (default)
61
+
62
+ | Header 1 | Header 2 | Header 3 |
63
+ | :------- | :------- | :------- |
64
+ | Cell 1 | Cell 2 | Cell 3 |
65
+
66
+ ```markup
67
+ | Header 1 | Header 2 | Header 3 |
68
+ | :------- | :------- | :------- |
69
+ | Cell 1 | Cell 2 | Cell 3 |
70
+ ```
71
+
72
+ ### Custom Table Class and Attributes
73
+
74
+ You can customize the table class and attributes:
75
+
76
+ ```javascript
77
+ import MarkdownIt from 'markdown-it'
78
+ import { tablePlugin } from '@md-plugins/md-plugin-table'
79
+
80
+ const md = new MarkdownIt()
81
+
82
+ md.use(tablePlugin, {
83
+ tableClass: 'custom-table-class', // Optional: Customize the table class
84
+ tableHeaderClass: 'custom-header-class', // Optional: Customize the table header class
85
+ tableRowClass: 'custom-row-class', // Optional: Customize the table row class
86
+ tableCellClass: 'custom-cell-class', // Optional: Customize the table cell class
87
+ tableToken: 'custom-table-token', // Optional: Customize the table token
88
+ tableAttributes: [['data-custom-attr', 'value']], // Optional: Add custom attributes
89
+ })
90
+
91
+ // Now you can use the Table plugin in your Markdown content
92
+ const result = md.render(
93
+ '| Header 1 | Header 2 |\n| -------- | -------- |\n| Cell 1 | Cell 2 |',
94
+ )
95
+ console.log(result)
96
+ ```
97
+
98
+ ## Name
99
+
100
+ The official NPM name is `@md-plugins/md-plugin-table`.
101
+
102
+ ## Installation
103
+
104
+ You can install the Table plugin using npm, yarn, or pnpm. Choose your preferred method below:
105
+
106
+ ```tabs
107
+ <<| bash npm |>>
108
+ npm install @md-plugins/md-plugin-table
109
+ <<| bash yarn |>>
110
+ yarn add @md-plugins/md-plugin-table
111
+ <<| bash pnpm |>>
112
+ pnpm add @md-plugins/md-plugin-table
113
+ ```
114
+
115
+ ## Configuration
116
+
117
+ After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
118
+
119
+ ```javascript
120
+ import MarkdownIt from 'markdown-it'
121
+ import { tablePlugin } from '@md-plugins/md-plugin-table'
122
+
123
+ const md = new MarkdownIt()
124
+
125
+ md.use(tablePlugin, {
126
+ tableClass: 'custom-table-class', // Optional: Customize the table class
127
+ tableHeaderClass: 'custom-header-class', // Optional: Customize the table header class
128
+ tableRowClass: 'custom-row-class', // Optional: Customize the table row class
129
+ tableCellClass: 'custom-cell-class', // Optional: Customize the table cell class
130
+ tableToken: 'custom-table-token', // Optional: Customize the table token
131
+ tableAttributes: [['data-custom-attr', 'value']], // Optional: Add custom attributes
132
+ })
133
+
134
+ // Now you can use the Table plugin in your Markdown content
135
+ const result = md.render(
136
+ '| Header 1 | Header 2 |\n| -------- | -------- |\n| Cell 1 | Cell 2 |',
137
+ )
138
+ console.log(result)
139
+ ```
140
+
141
+ ### Options
142
+
143
+ The Table plugin accepts the following options:
144
+
145
+ - **tableClass**: The class for the table. Default is `'markdown-table'`.
146
+ - **tableHeaderClass**: The class for the table header. Default is `'text-left'`.
147
+ - **tableRowClass**: The class for the table row. Default is `''`.
148
+ - **tableCellClass**: The class for the table cell. Default is `''`.
149
+ - **tableToken**: The token for the table. Default is `'q-markup-table'`.
150
+ - **tableAttributes**: The attributes for the table. Default is `[ [':wrap-cells', 'true'],[':flat', 'true'],[':bordered', 'true'] ]`.
151
+
152
+ ## Advanced Configuration
153
+
154
+ For more advanced configurations, you can combine the Table plugin with other Markdown-It plugins to enhance your Markdown content further. Here's an example:
155
+
156
+ ```javascript
157
+ import MarkdownIt from 'markdown-it'
158
+ import { tablePlugin } from '@md-plugins/md-plugin-table'
159
+ import markdownItAnchor from 'markdown-it-anchor'
160
+ import markdownItToc from 'markdown-it-toc-done-right'
161
+
162
+ const md = new MarkdownIt()
163
+
164
+ md.use(tablePlugin, {
165
+ tableClass: 'custom-table-class', // Customize the table class
166
+ tableHeaderClass: 'custom-header-class', // Customize the table header class
167
+ tableRowClass: 'custom-row-class', // Customize the table row class
168
+ tableCellClass: 'custom-cell-class', // Customize the table cell class
169
+ tableToken: 'custom-table-token', // Customize the table token
170
+ tableAttributes: [['data-custom-attr', 'value']], // Add custom attributes
171
+ })
172
+ .use(markdownItAnchor)
173
+ .use(markdownItToc)
174
+
175
+ // Now you can use the Table plugin along with other plugins in your Markdown content
176
+ const result = md.render(
177
+ '| Header 1 | Header 2 |\n| -------- | -------- |\n| Cell 1 | Cell 2 |\n\n# Table of Contents\n\n[[toc]]\n\n| Header 3 | Header 4 |\n| -------- | -------- |\n| Cell 3 | Cell 4 |',
178
+ )
179
+ console.log(result)
180
+ ```
181
+
182
+ ## Support
183
+
184
+ If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
185
+
186
+ Happy coding!