@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.
- package/LICENSE.md +21 -0
- package/README.md +230 -0
- package/old/prompts.js +44 -0
- package/old/uninstall.js +9 -0
- package/package.json +60 -0
- package/scripts/build.js +33 -0
- package/src/index.js +63 -0
- package/src/install.js +49 -0
- package/src/templates/.gitkeep +0 -0
- package/src/templates/init/src/_q-press/.gitkeep +0 -0
- package/src/templates/init/src/_q-press/api/components/DarkModeToggle.json +37 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownApi.json +67 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCardLink.json +28 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCode.json +37 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCodepen.json +21 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownExample.json +22 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownHeader.json +28 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownInstallation.json +33 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownLayout.json +52 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownLink.json +23 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownPage.json +71 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownPageToc.json +17 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownPrerender.json +25 -0
- package/src/templates/init/src/_q-press/api/components/MarkdownTree.json +27 -0
- package/src/templates/init/src/_q-press/api/composables/dark.json +29 -0
- package/src/templates/init/src/_q-press/api/composables/scroll.json +34 -0
- package/src/templates/init/src/_q-press/assets/get-meta.ts +29 -0
- package/src/templates/init/src/_q-press/components/DarkModeToggle.vue +105 -0
- package/src/templates/init/src/_q-press/components/MarkdownApi.vue +588 -0
- package/src/templates/init/src/_q-press/components/MarkdownApiEntry.ts +594 -0
- package/src/templates/init/src/_q-press/components/MarkdownCardLink.vue +25 -0
- package/src/templates/init/src/_q-press/components/MarkdownCardTitle.vue +21 -0
- package/src/templates/init/src/_q-press/components/MarkdownCode.vue +25 -0
- package/src/templates/init/src/_q-press/components/MarkdownCodePrism.ts +36 -0
- package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +183 -0
- package/src/templates/init/src/_q-press/components/MarkdownCopyButton.vue +104 -0
- package/src/templates/init/src/_q-press/components/MarkdownExample.vue +221 -0
- package/src/templates/init/src/_q-press/components/MarkdownInstallation.vue +166 -0
- package/src/templates/init/src/_q-press/components/MarkdownLink.vue +38 -0
- package/src/templates/init/src/_q-press/components/MarkdownPrerender.ts +82 -0
- package/src/templates/init/src/_q-press/components/MarkdownTree.vue +105 -0
- package/src/templates/init/src/_q-press/components/markdown-utils.ts +105 -0
- package/src/templates/init/src/_q-press/composables/dark.ts +39 -0
- package/src/templates/init/src/_q-press/composables/scroll.ts +115 -0
- package/src/templates/init/src/_q-press/css/app.scss +662 -0
- package/src/templates/init/src/_q-press/css/fonts.scss +100 -0
- package/src/templates/init/src/_q-press/css/prism-theme.scss +298 -0
- package/src/templates/init/src/_q-press/css/themes/default.scss +68 -0
- package/src/templates/init/src/_q-press/css/themes/newspaper.scss +69 -0
- package/src/templates/init/src/_q-press/css/themes/sunrise.scss +67 -0
- package/src/templates/init/src/_q-press/css/themes/tawny.scss +69 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownHeader.vue +412 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownLayout.vue +239 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownPage.vue +307 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownSearch.vue +449 -0
- package/src/templates/init/src/_q-press/stores/markdown.ts +101 -0
- package/src/templates/init/src/components/LandingPage/LandingPage.vue +341 -0
- package/src/templates/init/src/components/Releases/PackageReleases.vue +164 -0
- package/src/templates/init/src/components/Releases/PublicReleases.vue +149 -0
- package/src/templates/init/src/components/Releases/ReleasesAvailable.vue +74 -0
- package/src/templates/init/src/examples/QAvatar/BasicExample.vue +11 -0
- package/src/templates/init/src/markdown/__elements.md +548 -0
- package/src/templates/init/src/markdown/__elements2.md +347 -0
- package/src/templates/init/src/markdown/faq/best-practices.md +0 -0
- package/src/templates/init/src/markdown/faq/general.md +0 -0
- package/src/templates/init/src/markdown/faq/troubleshooting.md +0 -0
- package/src/templates/init/src/markdown/getting-started/introduction.md +67 -0
- package/src/templates/init/src/markdown/guides/contributing.md +101 -0
- package/src/templates/init/src/markdown/guides/faq.md +115 -0
- package/src/templates/init/src/markdown/guides/release-notes.md +0 -0
- package/src/templates/init/src/markdown/guides/style-guide.md +0 -0
- package/src/templates/init/src/markdown/landing-page.md +11 -0
- package/src/templates/init/src/markdown/listing.ts +3 -0
- package/src/templates/init/src/markdown/md-plugins/blockquote/advanced.md +83 -0
- package/src/templates/init/src/markdown/md-plugins/blockquote/overview.md +183 -0
- package/src/templates/init/src/markdown/md-plugins/codeblocks/advanced.md +210 -0
- package/src/templates/init/src/markdown/md-plugins/codeblocks/overview.md +616 -0
- package/src/templates/init/src/markdown/md-plugins/containers/advanced.md +301 -0
- package/src/templates/init/src/markdown/md-plugins/containers/overview.md +206 -0
- package/src/templates/init/src/markdown/md-plugins/frontmatter/advanced.md +164 -0
- package/src/templates/init/src/markdown/md-plugins/frontmatter/overview.md +131 -0
- package/src/templates/init/src/markdown/md-plugins/headers/advanced.md +236 -0
- package/src/templates/init/src/markdown/md-plugins/headers/overview.md +134 -0
- package/src/templates/init/src/markdown/md-plugins/image/advanced.md +114 -0
- package/src/templates/init/src/markdown/md-plugins/image/overview.md +124 -0
- package/src/templates/init/src/markdown/md-plugins/imports/advanced.md +105 -0
- package/src/templates/init/src/markdown/md-plugins/imports/overview.md +80 -0
- package/src/templates/init/src/markdown/md-plugins/inline-code/advanced.md +133 -0
- package/src/templates/init/src/markdown/md-plugins/inline-code/overview.md +101 -0
- package/src/templates/init/src/markdown/md-plugins/link/advanced.md +157 -0
- package/src/templates/init/src/markdown/md-plugins/link/overview.md +126 -0
- package/src/templates/init/src/markdown/md-plugins/shared/overview.md +175 -0
- package/src/templates/init/src/markdown/md-plugins/table/advanced.md +190 -0
- package/src/templates/init/src/markdown/md-plugins/table/overview.md +186 -0
- package/src/templates/init/src/markdown/md-plugins/title/advanced.md +88 -0
- package/src/templates/init/src/markdown/md-plugins/title/overview.md +99 -0
- package/src/templates/init/src/markdown/other/release-notes.md +12 -0
- package/src/templates/init/src/markdown/privacy-policy.md +12 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +101 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/components.md +69 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +254 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/themes.md +4 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/advanced.md +4 -0
- package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/overview.md +103 -0
- package/src/templates/init/src/markdown/vite-plugins/index.md +6 -0
- package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/advanced.md +138 -0
- package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/overview.md +88 -0
- package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/advanced.md +226 -0
- package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/index.md +6 -0
- package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/overview.md +166 -0
- package/src/templates/init/src/q-press.globals.d.ts +36 -0
- package/src/templates/init/src/siteConfig/index.ts +440 -0
- package/src/templates/update/src/_q-press/.gitkeep +0 -0
- package/src/templates/update/src/_q-press/api/components/DarkModeToggle.json +37 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownApi.json +67 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCardLink.json +28 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCode.json +37 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCodepen.json +21 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownExample.json +22 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownHeader.json +28 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownInstallation.json +33 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownLayout.json +52 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownLink.json +23 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownPage.json +71 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownPageToc.json +17 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownPrerender.json +25 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownTree.json +27 -0
- package/src/templates/update/src/_q-press/api/composables/dark.json +29 -0
- package/src/templates/update/src/_q-press/api/composables/scroll.json +34 -0
- package/src/templates/update/src/_q-press/assets/get-meta.ts +29 -0
- package/src/templates/update/src/_q-press/components/DarkModeToggle.vue +105 -0
- package/src/templates/update/src/_q-press/components/MarkdownApi.vue +588 -0
- package/src/templates/update/src/_q-press/components/MarkdownApiEntry.ts +594 -0
- package/src/templates/update/src/_q-press/components/MarkdownCardLink.vue +25 -0
- package/src/templates/update/src/_q-press/components/MarkdownCardTitle.vue +21 -0
- package/src/templates/update/src/_q-press/components/MarkdownCode.vue +25 -0
- package/src/templates/update/src/_q-press/components/MarkdownCodePrism.ts +36 -0
- package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +183 -0
- package/src/templates/update/src/_q-press/components/MarkdownCopyButton.vue +104 -0
- package/src/templates/update/src/_q-press/components/MarkdownExample.vue +221 -0
- package/src/templates/update/src/_q-press/components/MarkdownInstallation.vue +166 -0
- package/src/templates/update/src/_q-press/components/MarkdownLink.vue +38 -0
- package/src/templates/update/src/_q-press/components/MarkdownPrerender.ts +82 -0
- package/src/templates/update/src/_q-press/components/MarkdownTree.vue +105 -0
- package/src/templates/update/src/_q-press/components/markdown-utils.ts +105 -0
- package/src/templates/update/src/_q-press/composables/dark.ts +39 -0
- package/src/templates/update/src/_q-press/composables/scroll.ts +115 -0
- package/src/templates/update/src/_q-press/css/app.scss +662 -0
- package/src/templates/update/src/_q-press/css/fonts.scss +100 -0
- package/src/templates/update/src/_q-press/css/prism-theme.scss +298 -0
- package/src/templates/update/src/_q-press/css/themes/default.scss +68 -0
- package/src/templates/update/src/_q-press/css/themes/newspaper.scss +69 -0
- package/src/templates/update/src/_q-press/css/themes/sunrise.scss +67 -0
- package/src/templates/update/src/_q-press/css/themes/tawny.scss +69 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownHeader.vue +412 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownLayout.vue +239 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownPage.vue +307 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownSearch.vue +449 -0
- package/src/templates/update/src/_q-press/stores/markdown.ts +101 -0
- package/src/templates/update/src/q-press.globals.d.ts +36 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Image Plugin
|
|
3
|
+
desc: Image plugin for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the Image Plugin documentation! This guide will provide you with an overview of the Image plugin and its features.
|
|
7
|
+
|
|
8
|
+
## What is the Image Plugin?
|
|
9
|
+
|
|
10
|
+
The Image Plugin is a simple yet powerful tool that enhances the standard image functionality in Markdown. It allows you to apply custom CSS classes to images as well as provide a width and a height, making it easier to style and manage images in your documentation.
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Custom CSS Class**: Apply a custom CSS class to images for consistent styling.
|
|
15
|
+
- **Automatic Alt Text**: Automatically set the `alt` attribute for images based on their content.
|
|
16
|
+
- **Width and Height**: Specify the width and height of images for responsive design.
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
Here are some examples of what you can achieve with the Image Plugin:
|
|
21
|
+
|
|
22
|
+
### Standard Image
|
|
23
|
+
|
|
24
|
+
```markup
|
|
25
|
+

|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### External Image with Width/Height
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
```markup
|
|
33
|
+

|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Image with Custom Class
|
|
37
|
+
|
|
38
|
+
You can apply a custom CSS class to images:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import MarkdownIt from 'markdown-it'
|
|
42
|
+
import { imagePlugin } from '@md-plugins/md-plugin-image'
|
|
43
|
+
|
|
44
|
+
const md = new MarkdownIt()
|
|
45
|
+
|
|
46
|
+
md.use(imagePlugin, {
|
|
47
|
+
imageClass: 'custom-image-class', // Optional: Customize the CSS class for images
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Now you can use the Image plugin in your Markdown content
|
|
51
|
+
const result = md.render('')
|
|
52
|
+
console.log(result)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Name
|
|
56
|
+
|
|
57
|
+
The official NPM name is `@md-plugins/md-plugin-image`.
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
You can install the Image plugin using npm, yarn, or pnpm. Choose your preferred method below:
|
|
62
|
+
|
|
63
|
+
```tabs
|
|
64
|
+
<<| bash npm |>>
|
|
65
|
+
npm install @md-plugins/md-plugin-image
|
|
66
|
+
<<| bash yarn |>>
|
|
67
|
+
yarn add @md-plugins/md-plugin-image
|
|
68
|
+
<<| bash pnpm |>>
|
|
69
|
+
pnpm add @md-plugins/md-plugin-image
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import MarkdownIt from 'markdown-it'
|
|
78
|
+
import { imagePlugin } from '@md-plugins/md-plugin-image'
|
|
79
|
+
|
|
80
|
+
const md = new MarkdownIt()
|
|
81
|
+
|
|
82
|
+
md.use(imagePlugin, {
|
|
83
|
+
imageClass: 'custom-image-class', // Optional: Customize the CSS class for images
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// Now you can use the Image plugin in your Markdown content
|
|
87
|
+
const result = md.render('')
|
|
88
|
+
console.log(result)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Options
|
|
92
|
+
|
|
93
|
+
The Image plugin accepts the following options:
|
|
94
|
+
|
|
95
|
+
- **imageClass**: The CSS class to apply to images. Default is `markdown-image`.
|
|
96
|
+
|
|
97
|
+
## Advanced Configuration
|
|
98
|
+
|
|
99
|
+
For more advanced configurations, you can combine the Image plugin with other Markdown-It plugins to enhance your Markdown content further. Here's an example:
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import MarkdownIt from 'markdown-it'
|
|
103
|
+
import { imagePlugin } from '@md-plugins/md-plugin-image'
|
|
104
|
+
import markdownItAnchor from 'markdown-it-anchor'
|
|
105
|
+
import markdownItToc from 'markdown-it-toc-done-right'
|
|
106
|
+
|
|
107
|
+
const md = new MarkdownIt()
|
|
108
|
+
|
|
109
|
+
md.use(imagePlugin, {
|
|
110
|
+
imageClass: 'custom-image-class', // Customize the CSS class for images
|
|
111
|
+
})
|
|
112
|
+
.use(markdownItAnchor)
|
|
113
|
+
.use(markdownItToc)
|
|
114
|
+
|
|
115
|
+
// Now you can use the Image plugin along with other plugins in your Markdown content
|
|
116
|
+
const result = md.render('# Table of Contents\n\n[[toc]]\n\n')
|
|
117
|
+
console.log(result)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Support
|
|
121
|
+
|
|
122
|
+
If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
|
|
123
|
+
|
|
124
|
+
Happy coding!
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Imports Plugin Advanced Topics
|
|
3
|
+
desc: Imports plugin advanced topics for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Imports Plugin
|
|
7
|
+
|
|
8
|
+
The `imports` plugin allows you to extract and store script imports from your Markdown content. 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 { PluginSimple } from 'markdown-it'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Markdown-It plugin that extracts and stores script imports from the Markdown content.
|
|
17
|
+
*
|
|
18
|
+
* This plugin replaces script import blocks (delimited by `<script import>` and `</script>`) with an empty string,
|
|
19
|
+
* and adds the extracted script content to the `env.pageScripts` set in the Markdown-It environment.
|
|
20
|
+
*
|
|
21
|
+
* @param md - The Markdown-It instance to extend.
|
|
22
|
+
*/
|
|
23
|
+
declare const importsPlugin: PluginSimple
|
|
24
|
+
|
|
25
|
+
declare module '@md-plugins/shared' {
|
|
26
|
+
interface MarkdownItEnv {
|
|
27
|
+
/**
|
|
28
|
+
* An array of page script (import statements) to be included.
|
|
29
|
+
*/
|
|
30
|
+
pageScripts?: Set<string>
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { importsPlugin }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### How It Works
|
|
38
|
+
|
|
39
|
+
The `imports` plugin processes script import blocks in your Markdown content, extracting the script content and storing it in the `env.pageScripts` set. This allows you to manage and use script imports in your Markdown content.
|
|
40
|
+
|
|
41
|
+
### Default Behavior
|
|
42
|
+
|
|
43
|
+
::: tip
|
|
44
|
+
Here we are adding a space after the first `<` to avoid parsing our examples. In your own code, be sure to remove that space when the functionality is required.
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
By default, the `imports` plugin replaces script import blocks (delimited by `<script script import>` and `</script>`) with an empty string and adds the extracted script content to the `env.pageScripts` set. Here is an example of a Markdown file with script imports:
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
< script import>
|
|
51
|
+
import { ref } from 'vue'
|
|
52
|
+
import MyComponent from './MyComponent.vue'
|
|
53
|
+
</>
|
|
54
|
+
|
|
55
|
+
# My Awesome Post
|
|
56
|
+
|
|
57
|
+
This post uses some imported components.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Plugin Options
|
|
61
|
+
|
|
62
|
+
The `imports` plugin does not provide any options for customization. It is designed to work out of the box with the default behavior.
|
|
63
|
+
|
|
64
|
+
### Example Configuration
|
|
65
|
+
|
|
66
|
+
Here is an example of how you can use the `imports` plugin:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import MarkdownIt from 'markdown-it'
|
|
70
|
+
import { importsPlugin } from '@md-plugins/md-plugin-imports'
|
|
71
|
+
|
|
72
|
+
const md = new MarkdownIt()
|
|
73
|
+
|
|
74
|
+
md.use(importsPlugin)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Using Extracted Scripts
|
|
78
|
+
|
|
79
|
+
Once the script imports are extracted, they are stored in the `env.pageScripts` set. How you handle this data and send it to the front-end is up to you. Here is an example of how to use the extracted scripts in a Vue component:
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<template>
|
|
83
|
+
<div>
|
|
84
|
+
<h1>My Awesome Post</h1>
|
|
85
|
+
<MyComponent />
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script setup>
|
|
90
|
+
import { ref } from 'vue'
|
|
91
|
+
import MyComponent from './MyComponent.vue'
|
|
92
|
+
|
|
93
|
+
// The extracted scripts would be included here
|
|
94
|
+
</script>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Handling Errors
|
|
98
|
+
|
|
99
|
+
The `imports` plugin includes error handling to ensure that any issues with parsing the script imports do not break the rendering process. If an error occurs, the plugin will log the error and continue rendering the content without the script imports.
|
|
100
|
+
|
|
101
|
+
### Conclusion
|
|
102
|
+
|
|
103
|
+
The `imports` plugin is a powerful tool for extracting and storing script imports from your Markdown content. By managing the extracted scripts in the `env.pageScripts` set, you can tailor the plugin to fit your specific needs. Remember, it is up to you to handle the extracted script data and send it to the front-end in a way that suits your application. Experiment with different configurations and find the one that works best for you.
|
|
104
|
+
|
|
105
|
+
Happy coding!
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Imports Plugin
|
|
3
|
+
desc: Imports plugin for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the Imports Plugin documentation! This guide will provide you with an overview of the Imports plugin and its features.
|
|
7
|
+
|
|
8
|
+
## What is the Imports Plugin?
|
|
9
|
+
|
|
10
|
+
The Imports Plugin is a powerful tool that enhances the standard Markdown functionality by allowing you to extract and manage script imports directly from your Markdown content. It integrates seamlessly with Markdown-It to provide a flexible and customizable way to handle script imports in your Markdown files.
|
|
11
|
+
|
|
12
|
+
## Why Use the Imports Plugin?
|
|
13
|
+
|
|
14
|
+
When working with Markdown content, especially in a dynamic environment like a documentation site or a static site generator, you might need to include specific scripts for certain pages. The Imports Plugin allows you to define these script imports directly within your Markdown files, making it easier to manage dependencies and ensure that the necessary scripts are included when rendering the content.
|
|
15
|
+
|
|
16
|
+
## Key Features
|
|
17
|
+
|
|
18
|
+
- **Script Extraction**: Extract script imports from your Markdown content.
|
|
19
|
+
- **Environment Integration**: Store extracted scripts in the Markdown-It environment for easy access.
|
|
20
|
+
- **Flexible Management**: Manage script imports directly within your Markdown files.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
::: warning
|
|
25
|
+
We can't put the examples in the docs proper because they will otherwise be parsed. We have to use `$lt;script import>` and `</script>` to avoid parsing. In this case, we have to put the examples in blockquotes.
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
Here are some examples of what you can achieve with the Imports Plugin:
|
|
29
|
+
|
|
30
|
+
### Standard Script Import
|
|
31
|
+
|
|
32
|
+
> <script import>
|
|
33
|
+
> import SomeLibrary from 'some-library'
|
|
34
|
+
> </script>
|
|
35
|
+
|
|
36
|
+
## Name
|
|
37
|
+
|
|
38
|
+
The official NPM name is `@md-plugins/md-plugin-imports`.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
You can install the Imports plugin using npm, yarn, or pnpm. Choose your preferred method below:
|
|
43
|
+
|
|
44
|
+
```tabs
|
|
45
|
+
<<| bash npm |>>
|
|
46
|
+
npm install @md-plugins/md-plugin-imports
|
|
47
|
+
<<| bash yarn |>>
|
|
48
|
+
yarn add @md-plugins/md-plugin-imports
|
|
49
|
+
<<| bash pnpm |>>
|
|
50
|
+
pnpm add @md-plugins/md-plugin-imports
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
|
|
56
|
+
|
|
57
|
+
> import MarkdownIt from 'markdown-it'
|
|
58
|
+
> import { importsPlugin } from '@md-plugins/md-plugin-imports'
|
|
59
|
+
> //
|
|
60
|
+
> const md = new MarkdownIt()
|
|
61
|
+
> //
|
|
62
|
+
> md.use(importsPlugin)
|
|
63
|
+
> //
|
|
64
|
+
> // Now you can use the Imports plugin in your Markdown content
|
|
65
|
+
> const result = md.render('<script import>\nimport SomeLibrary from "some-library"\n</script>\n\n# My Document\n\nThis is the content of my document.')
|
|
66
|
+
> console.log(result)
|
|
67
|
+
|
|
68
|
+
### Options
|
|
69
|
+
|
|
70
|
+
The Imports plugin does not accept any options.
|
|
71
|
+
|
|
72
|
+
## Support
|
|
73
|
+
|
|
74
|
+
If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
|
|
75
|
+
|
|
76
|
+
Happy coding!
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inline Code Plugin Advanced Topics
|
|
3
|
+
desc: Inline code plugin advanced topics for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Inline Code Plugin
|
|
7
|
+
|
|
8
|
+
The `inlinecode` plugin allows you to add custom classes to inline code elements in your Markdown content. 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 InlineCodePluginOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The CSS class to apply to inline code blocks
|
|
18
|
+
*
|
|
19
|
+
* @default 'markdown-token'
|
|
20
|
+
*/
|
|
21
|
+
inlineCodeClass?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds a class to inline code.
|
|
26
|
+
*/
|
|
27
|
+
declare const inlinecodePlugin: PluginWithOptions<InlineCodePluginOptions>
|
|
28
|
+
|
|
29
|
+
export { type InlineCodePluginOptions, inlinecodePlugin }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### How It Works
|
|
33
|
+
|
|
34
|
+
The `inlinecode` plugin processes inline code tokens in your Markdown content, adding custom classes to them. This helps improve the styling and accessibility of inline code elements in your Markdown content.
|
|
35
|
+
|
|
36
|
+
### Default Behavior
|
|
37
|
+
|
|
38
|
+
By default, the `inlinecode` plugin adds the `markdown-token` class to all inline code elements. Here is an example of a Markdown file with inline code:
|
|
39
|
+
|
|
40
|
+
Here is some `inline code` in a sentence.
|
|
41
|
+
|
|
42
|
+
::: tip
|
|
43
|
+
Here is some `inline code` in a container.
|
|
44
|
+
:::
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
Here is some `inline code` in a sentence.
|
|
48
|
+
|
|
49
|
+
::: tip
|
|
50
|
+
Here is some `inline code` in a container.
|
|
51
|
+
:::
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Default CSS
|
|
55
|
+
|
|
56
|
+
By default, the `inlinecode` plugin applies the following CSS class to inline code elements. You can add this class in your CSS to customize the appearance of inline code elements.
|
|
57
|
+
|
|
58
|
+
```scss
|
|
59
|
+
.markdown-token {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
padding: 4px 6px;
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
line-height: 16px;
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
font-family: inherit;
|
|
66
|
+
color: #00bfff;
|
|
67
|
+
vertical-align: baseline;
|
|
68
|
+
border: 1px solid currentColor;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Plugin Options
|
|
73
|
+
|
|
74
|
+
The `inlinecode` plugin provides an option for customization. Here is the available option and its description:
|
|
75
|
+
|
|
76
|
+
#### `inlineCodeClass`
|
|
77
|
+
|
|
78
|
+
- **Type**: `string`
|
|
79
|
+
- **Default**: `'markdown-token'`
|
|
80
|
+
- **Description**: The class to be added to all inline code elements.
|
|
81
|
+
|
|
82
|
+
### Example Configuration
|
|
83
|
+
|
|
84
|
+
Here is an example of how you can configure the `inlinecode` plugin with custom options:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import MarkdownIt from 'markdown-it'
|
|
88
|
+
import { inlinecodePlugin } from '@md-plugins/md-plugin-inlinecode'
|
|
89
|
+
|
|
90
|
+
const md = new MarkdownIt()
|
|
91
|
+
|
|
92
|
+
md.use(inlinecodePlugin, {
|
|
93
|
+
inlineCodeClass: 'custom-inline-code-class',
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Customizing the CSS
|
|
98
|
+
|
|
99
|
+
You can customize the appearance of inline code elements by overriding the default CSS class. Here are some examples of how you can customize the inline code elements:
|
|
100
|
+
|
|
101
|
+
#### Example 1: Customizing the Background Color
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
.custom-inline-code-class {
|
|
105
|
+
background-color: #f0f0f0; /* Change the background color */
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Example 2: Adding a Border
|
|
110
|
+
|
|
111
|
+
```css
|
|
112
|
+
.custom-inline-code-class {
|
|
113
|
+
border: 1px solid #dfe2e5; /* Add a border to inline code */
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Example 3: Changing the Font Style
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
.custom-inline-code-class {
|
|
121
|
+
font-family: 'Courier New', Courier, monospace; /* Change the font style */
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Handling the `class` Attribute
|
|
126
|
+
|
|
127
|
+
The `inlinecode` plugin ensures that the `class` attribute is properly set for all inline code elements. If the `class` attribute is not present or is empty, the plugin sets it to the specified class. This helps improve the styling and accessibility of your Markdown content.
|
|
128
|
+
|
|
129
|
+
### Conclusion
|
|
130
|
+
|
|
131
|
+
The `inlinecode` plugin is a powerful tool for adding custom classes to inline code elements in your Markdown content. By customizing the class and CSS, you can tailor the appearance of inline code elements to match the style of your project. Experiment with different configurations and find the one that works best for you.
|
|
132
|
+
|
|
133
|
+
Happy coding!
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inlinecode Plugin
|
|
3
|
+
desc: Inlinecode plugin for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the Inlinecode Plugin documentation! This guide will provide you with an overview of the Inlinecode plugin and its features.
|
|
7
|
+
|
|
8
|
+
## What is the Inlinecode Plugin?
|
|
9
|
+
|
|
10
|
+
The Inlinecode Plugin is a simple yet powerful tool that enhances the standard inline code functionality in Markdown. It allows you to apply custom CSS classes to inline code blocks, making it easier to style and highlight inline code snippets in your documentation.
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Custom CSS Class**: Apply a custom CSS class to inline code blocks for consistent styling.
|
|
15
|
+
- **Easy Configuration**: Simple and straightforward configuration options.
|
|
16
|
+
- **Compatibility**: Works seamlessly with other Markdown-It plugins.
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
Here are some examples of what you can achieve with the Inlinecode Plugin:
|
|
21
|
+
|
|
22
|
+
### Standard Inline Code
|
|
23
|
+
|
|
24
|
+
This is an example of `inline code`.
|
|
25
|
+
|
|
26
|
+
```markup
|
|
27
|
+
This is an example of `inline code`.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Name
|
|
31
|
+
|
|
32
|
+
The official NPM name is `@md-plugins/md-plugin-inlinecode`.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
You can install the Inlinecode plugin using npm, yarn, or pnpm. Choose your preferred method below:
|
|
37
|
+
|
|
38
|
+
```tabs
|
|
39
|
+
<<| bash npm |>>
|
|
40
|
+
npm install @md-plugins/md-plugin-inlinecode
|
|
41
|
+
<<| bash yarn |>>
|
|
42
|
+
yarn add @md-plugins/md-plugin-inlinecode
|
|
43
|
+
<<| bash pnpm |>>
|
|
44
|
+
pnpm add @md-plugins/md-plugin-inlinecode
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import MarkdownIt from 'markdown-it'
|
|
53
|
+
import { inlinecodePlugin } from '@md-plugins/md-plugin-inlinecode'
|
|
54
|
+
|
|
55
|
+
const md = new MarkdownIt()
|
|
56
|
+
|
|
57
|
+
md.use(inlinecodePlugin, {
|
|
58
|
+
inlineCodeClass: 'custom-inline-code', // Optional: Customize the CSS class for inline code
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// Now you can use the Inlinecode plugin in your Markdown content
|
|
62
|
+
const result = md.render('This is an example of `inline code` with a custom class.')
|
|
63
|
+
console.log(result)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Options
|
|
67
|
+
|
|
68
|
+
The Inlinecode plugin accepts the following options:
|
|
69
|
+
|
|
70
|
+
- **inlineCodeClass**: The CSS class to apply to inline code blocks. Default is `'markdown-token'`.
|
|
71
|
+
|
|
72
|
+
## Advanced Configuration
|
|
73
|
+
|
|
74
|
+
For more advanced configurations, you can combine the Inlinecode plugin with other Markdown-It plugins to enhance your Markdown content further. Here's an example:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import MarkdownIt from 'markdown-it'
|
|
78
|
+
import { inlinecodePlugin } from '@md-plugins/md-plugin-inlinecode'
|
|
79
|
+
import markdownItAnchor from 'markdown-it-anchor'
|
|
80
|
+
import markdownItToc from 'markdown-it-toc-done-right'
|
|
81
|
+
|
|
82
|
+
const md = new MarkdownIt()
|
|
83
|
+
|
|
84
|
+
md.use(inlinecodePlugin, {
|
|
85
|
+
inlineCodeClass: 'custom-inline-code', // Customize the CSS class for inline code
|
|
86
|
+
})
|
|
87
|
+
.use(markdownItAnchor)
|
|
88
|
+
.use(markdownItToc)
|
|
89
|
+
|
|
90
|
+
// Now you can use the Inlinecode plugin along with other plugins in your Markdown content
|
|
91
|
+
const result = md.render(
|
|
92
|
+
'# Table of Contents\n\n[[toc]]\n\nThis is an example of `inline code` with a custom class.',
|
|
93
|
+
)
|
|
94
|
+
console.log(result)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Support
|
|
98
|
+
|
|
99
|
+
If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
|
|
100
|
+
|
|
101
|
+
Happy coding!!!
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Link Plugin Advanced Topics
|
|
3
|
+
desc: Link plugin advanced topics for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Link Plugin
|
|
7
|
+
|
|
8
|
+
The `link` plugin allows you to customize the rendering of links in your Markdown content by replacing the default `<a>` tags with custom components. 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 LinkPluginOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The tag for the internal link
|
|
18
|
+
*
|
|
19
|
+
* @default 'MarkdownLink'
|
|
20
|
+
*/
|
|
21
|
+
linkTag?: string
|
|
22
|
+
/**
|
|
23
|
+
* The "to" keyword" for the internal link
|
|
24
|
+
*
|
|
25
|
+
* @default 'to'
|
|
26
|
+
*/
|
|
27
|
+
linkToKeyword?: string
|
|
28
|
+
/**
|
|
29
|
+
* add import statements to the page.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
pageScript?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module '@md-plugins/shared' {
|
|
36
|
+
interface MarkdownItEnv {
|
|
37
|
+
/**
|
|
38
|
+
* An array of page script (import statements) to be included for tags.
|
|
39
|
+
*/
|
|
40
|
+
pageScripts?: Set<string>
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare const linkPlugin: PluginWithOptions<LinkPluginOptions>
|
|
45
|
+
|
|
46
|
+
export { type LinkPluginOptions, linkPlugin }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### How It Works
|
|
50
|
+
|
|
51
|
+
The `link` plugin processes link tokens in your Markdown content, replacing the default `<a>` tags with custom components. This helps improve the styling and functionality of links in your Markdown content.
|
|
52
|
+
|
|
53
|
+
### Default Behavior
|
|
54
|
+
|
|
55
|
+
By default, the `link` plugin replaces `<a>` tags with a custom `MarkdownLink` component and sets the `to` attribute for navigation. Here is an example of a Markdown file with links:
|
|
56
|
+
|
|
57
|
+
[Link to Google](https://www.google.com)
|
|
58
|
+
|
|
59
|
+
[Link to another page](/another-page)
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
[Link to Google](https://www.google.com)
|
|
63
|
+
|
|
64
|
+
[Link to another page](/another-page)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Plugin Options
|
|
68
|
+
|
|
69
|
+
The `link` plugin provides several options for customization. Here are the available options and their descriptions:
|
|
70
|
+
|
|
71
|
+
#### linkTag
|
|
72
|
+
|
|
73
|
+
- **Type**: `string`
|
|
74
|
+
- **Default**: `'MarkdownLink'`
|
|
75
|
+
- **Description**: The custom component to replace the `<a>` tag.
|
|
76
|
+
|
|
77
|
+
#### linkToKeyword
|
|
78
|
+
|
|
79
|
+
- **Type**: `string`
|
|
80
|
+
- **Default**: `'to'`
|
|
81
|
+
- **Description**: The attribute to use for the link destination.
|
|
82
|
+
|
|
83
|
+
#### pageScript
|
|
84
|
+
|
|
85
|
+
- **Type**: `string`
|
|
86
|
+
- **Default**: `'import MarkdownLink from "src/.q-press/components/MarkdownLink.vue"'`
|
|
87
|
+
- **Description**: The script to import the custom link component.
|
|
88
|
+
|
|
89
|
+
### Example Configuration
|
|
90
|
+
|
|
91
|
+
Here is an example of how you can configure the `link` plugin with custom options:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import MarkdownIt from 'markdown-it'
|
|
95
|
+
import { linkPlugin } from '@md-plugins/md-plugin-link'
|
|
96
|
+
|
|
97
|
+
const md = new MarkdownIt()
|
|
98
|
+
|
|
99
|
+
md.use(linkPlugin, {
|
|
100
|
+
linkTag: 'CustomLink',
|
|
101
|
+
linkToKeyword: 'href',
|
|
102
|
+
pageScript: 'import CustomLink from "src/components/CustomLink.vue"',
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Customizing the CSS
|
|
107
|
+
|
|
108
|
+
You can customize the appearance of links by overriding the default CSS class. Here are some examples of how you can customize the links:
|
|
109
|
+
|
|
110
|
+
#### Default CSS
|
|
111
|
+
|
|
112
|
+
By default, the `link` plugin applies the following CSS class to links. You can add this class in your CSS to customize the appearance of links.
|
|
113
|
+
|
|
114
|
+
```scss
|
|
115
|
+
markdown-link {
|
|
116
|
+
color: #00bfff;
|
|
117
|
+
text-decoration: none;
|
|
118
|
+
border-bottom: 1px dotted currentColor;
|
|
119
|
+
outline: 0;
|
|
120
|
+
transition: color 0.28s ease-in-out;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Example 1: Customizing the Hover Effect
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
markdown-link:hover {
|
|
128
|
+
color: #ff6347; /* Change the color on hover */
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Example 2: Adding a Background Color
|
|
133
|
+
|
|
134
|
+
```css
|
|
135
|
+
markdown-link {
|
|
136
|
+
background-color: #f0f0f0; /* Add a background color */
|
|
137
|
+
padding: 2px 4px;
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Example 3: Changing the Font Style
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
markdown-link {
|
|
145
|
+
font-family: 'Courier New', Courier, monospace; /* Change the font style */
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Handling the pageScript
|
|
150
|
+
|
|
151
|
+
The `link` plugin ensures that the custom component script is properly imported. If the `pageScript` option is set, the plugin adds the script to the `env.pageScripts` set. This helps manage the dependencies of your Markdown content.
|
|
152
|
+
|
|
153
|
+
### Conclusion
|
|
154
|
+
|
|
155
|
+
The `link` plugin is a powerful tool for customizing the rendering of links in your Markdown content. By customizing the component, attributes, and CSS, you can tailor the appearance and functionality of links to match the style of your project. Experiment with different configurations and find the one that works best for you.
|
|
156
|
+
|
|
157
|
+
Happy coding!
|