@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,616 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Codeblocks Plugin
|
|
3
|
+
desc: Codeblocks plugin for Markdown.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the Codeblocks Plugin documentation! This guide will provide you with an overview of the Codeblocks plugin and its features.
|
|
7
|
+
|
|
8
|
+
## What is the Codeblocks Plugin?
|
|
9
|
+
|
|
10
|
+
The Codeblocks Plugin is a powerful tool that enhances the standard code block functionality in Markdown. It allows you to create visually appealing and customizable code blocks that can be used to highlight code snippets in your documentation.
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Syntax Highlighting**: Automatically highlight code syntax for various programming languages.
|
|
15
|
+
- **Line Numbers**: Display line numbers alongside your code blocks for better readability.
|
|
16
|
+
- **Line Highlighting**: Highlight specific lines of code for emphasis.
|
|
17
|
+
- **Add/Remove Lines**: Highlight add or remove lines of code with ease.
|
|
18
|
+
- **Tabs**: Organize your code blocks into tabs for easy navigation.
|
|
19
|
+
- **Copy to Clipboard**: Add a button to copy code snippets to the clipboard with a single click.
|
|
20
|
+
- **Customizable Styles**: Apply custom styles to your code blocks to match your documentation's theme.
|
|
21
|
+
- **Responsive Design**: Ensure your code blocks look great on all devices.
|
|
22
|
+
- **Fixed Height**: (optional) Maintain a consistent height for your code blocks.
|
|
23
|
+
|
|
24
|
+
## Supported Language Syntaxes
|
|
25
|
+
|
|
26
|
+
| Name | Aliases | Comment |
|
|
27
|
+
| ---------- | ------- | ----------------------------------------------------------- |
|
|
28
|
+
| markup | | Default, when none applied. Allows codeblocks in codeblocks |
|
|
29
|
+
| bash | | |
|
|
30
|
+
| javascript | js | |
|
|
31
|
+
| typescript | ts | |
|
|
32
|
+
| sass | | |
|
|
33
|
+
| scss | | |
|
|
34
|
+
| css | | |
|
|
35
|
+
| json | | |
|
|
36
|
+
| xml | | |
|
|
37
|
+
| html | | |
|
|
38
|
+
| diff | | Special grammar |
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
Here are some examples of what you can achieve with the Codeblocks Plugin:
|
|
43
|
+
|
|
44
|
+
### Standard Code Block
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
console.log('Hello, world!')
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
````markup
|
|
51
|
+
```js
|
|
52
|
+
console.log('Hello, world!')
|
|
53
|
+
```
|
|
54
|
+
````
|
|
55
|
+
|
|
56
|
+
### Code Block with Title
|
|
57
|
+
|
|
58
|
+
```js My Title
|
|
59
|
+
console.log('Hello, world!')
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
````markup
|
|
63
|
+
```js My Title
|
|
64
|
+
console.log('Hello, world!')
|
|
65
|
+
```
|
|
66
|
+
````
|
|
67
|
+
|
|
68
|
+
### Code Block with Restricted Height
|
|
69
|
+
|
|
70
|
+
```js [maxheight=300px]
|
|
71
|
+
export function containersPlugin(
|
|
72
|
+
md: MarkdownIt,
|
|
73
|
+
containers: ContainerDetails[],
|
|
74
|
+
createContainer: CreateContainerFn,
|
|
75
|
+
): void {
|
|
76
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
77
|
+
console.warn('No containers provided to containersPlugin.')
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (typeof createContainer == 'function') {
|
|
82
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
86
|
+
try {
|
|
87
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
````markup
|
|
96
|
+
```js [maxheight=300px]
|
|
97
|
+
export function containersPlugin(
|
|
98
|
+
md: MarkdownIt,
|
|
99
|
+
containers: ContainerDetails[],
|
|
100
|
+
createContainer: CreateContainerFn,
|
|
101
|
+
): void {
|
|
102
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
103
|
+
console.warn('No containers provided to containersPlugin.')
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (typeof createContainer == 'function') {
|
|
108
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
112
|
+
try {
|
|
113
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
````
|
|
121
|
+
|
|
122
|
+
### Code Block with Line Numbers
|
|
123
|
+
|
|
124
|
+
```js [numbered]
|
|
125
|
+
export function containersPlugin(
|
|
126
|
+
md: MarkdownIt,
|
|
127
|
+
containers: ContainerDetails[],
|
|
128
|
+
createContainer: CreateContainerFn,
|
|
129
|
+
): void {
|
|
130
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
131
|
+
console.warn('No containers provided to containersPlugin.')
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (typeof createContainer == 'function') {
|
|
136
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
140
|
+
try {
|
|
141
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
````markup
|
|
150
|
+
```js [numbered]
|
|
151
|
+
export function containersPlugin(
|
|
152
|
+
md: MarkdownIt,
|
|
153
|
+
containers: ContainerDetails[],
|
|
154
|
+
createContainer: CreateContainerFn,
|
|
155
|
+
): void {
|
|
156
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
157
|
+
console.warn('No containers provided to containersPlugin.')
|
|
158
|
+
return
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (typeof createContainer !== 'function') {
|
|
162
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
166
|
+
try {
|
|
167
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
````
|
|
175
|
+
|
|
176
|
+
### Code Block with Highlighted Lines
|
|
177
|
+
|
|
178
|
+
```js [highlight=6-9,15]
|
|
179
|
+
export function containersPlugin(
|
|
180
|
+
md: MarkdownIt,
|
|
181
|
+
containers: ContainerDetails[],
|
|
182
|
+
createContainer: CreateContainerFn,
|
|
183
|
+
): void {
|
|
184
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
185
|
+
console.warn('No containers provided to containersPlugin.')
|
|
186
|
+
return
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (typeof createContainer !== 'function') {
|
|
190
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
194
|
+
try {
|
|
195
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
````markup
|
|
204
|
+
```js [highlight=6-9,15]
|
|
205
|
+
export function containersPlugin(
|
|
206
|
+
md: MarkdownIt,
|
|
207
|
+
containers: ContainerDetails[],
|
|
208
|
+
createContainer: CreateContainerFn,
|
|
209
|
+
): void {
|
|
210
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
211
|
+
console.warn('No containers provided to containersPlugin.')
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (typeof createContainer !== 'function') {
|
|
216
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
220
|
+
try {
|
|
221
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
````
|
|
229
|
+
|
|
230
|
+
### Code Block with Internal Highlights
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
export function containersPlugin(
|
|
234
|
+
md: MarkdownIt,
|
|
235
|
+
containers: ContainerDetails[],
|
|
236
|
+
createContainer: CreateContainerFn,
|
|
237
|
+
): void {
|
|
238
|
+
if (!Array.isArray(containers) || containers.length === 0) { [[! highlight]]
|
|
239
|
+
console.warn('No containers provided to containersPlugin.') [[! highlight]]
|
|
240
|
+
return [[! highlight]]
|
|
241
|
+
} [[! highlight]]
|
|
242
|
+
|
|
243
|
+
if (typeof createContainer !== 'function') {
|
|
244
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
containers.forEach(({ type, defaultTitle }) => { [[! highlight]]
|
|
248
|
+
try {
|
|
249
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
250
|
+
} catch (error) {
|
|
251
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Look for the `[[! highlight]]` on individual lines.
|
|
258
|
+
|
|
259
|
+
````markup
|
|
260
|
+
```js
|
|
261
|
+
export function containersPlugin(
|
|
262
|
+
md: MarkdownIt,
|
|
263
|
+
containers: ContainerDetails[],
|
|
264
|
+
createContainer: CreateContainerFn,
|
|
265
|
+
): void {
|
|
266
|
+
if (!Array.isArray(containers) || containers.length === 0) { [[! highlight]]
|
|
267
|
+
console.warn('No containers provided to containersPlugin.') [[! highlight]]
|
|
268
|
+
return [[! highlight]]
|
|
269
|
+
} [[! highlight]]
|
|
270
|
+
|
|
271
|
+
if (typeof createContainer !== 'function') {
|
|
272
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
containers.forEach(({ type, defaultTitle }) => { [[! highlight]]
|
|
276
|
+
try {
|
|
277
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
278
|
+
} catch (error) {
|
|
279
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
````
|
|
285
|
+
|
|
286
|
+
### Code Block with Add/Remove (add/rem) Lines
|
|
287
|
+
|
|
288
|
+
```js [add=6-9 rem=19]
|
|
289
|
+
export function containersPlugin(
|
|
290
|
+
md: MarkdownIt,
|
|
291
|
+
containers: ContainerDetails[],
|
|
292
|
+
createContainer: CreateContainerFn,
|
|
293
|
+
): void {
|
|
294
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
295
|
+
console.warn('No containers provided to containersPlugin.')
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (typeof createContainer !== 'function') {
|
|
300
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
304
|
+
try {
|
|
305
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
````markup
|
|
314
|
+
```js [add=6-9 rem=19]
|
|
315
|
+
export function containersPlugin(
|
|
316
|
+
md: MarkdownIt,
|
|
317
|
+
containers: ContainerDetails[],
|
|
318
|
+
createContainer: CreateContainerFn,
|
|
319
|
+
): void {
|
|
320
|
+
if (!Array.isArray(containers) || containers.length === 0) {
|
|
321
|
+
console.warn('No containers provided to containersPlugin.')
|
|
322
|
+
return
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (typeof createContainer !== 'function') {
|
|
326
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
330
|
+
try {
|
|
331
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
332
|
+
} catch (error) {
|
|
333
|
+
console.error(`Failed to create container for type: ${type}`, error)
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
````
|
|
339
|
+
|
|
340
|
+
### Code Block with Internal Add/Remove (add/rem) Lines
|
|
341
|
+
|
|
342
|
+
```js
|
|
343
|
+
export function containersPlugin(
|
|
344
|
+
md: MarkdownIt,
|
|
345
|
+
containers: ContainerDetails[],
|
|
346
|
+
createContainer: CreateContainerFn,
|
|
347
|
+
): void {
|
|
348
|
+
if (!Array.isArray(containers) || containers.length === 0) { [[! add]]
|
|
349
|
+
console.warn('No containers provided to containersPlugin.') [[! add]]
|
|
350
|
+
return [[! add]]
|
|
351
|
+
} [[! add]]
|
|
352
|
+
|
|
353
|
+
if (typeof createContainer !== 'function') {
|
|
354
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
358
|
+
try {
|
|
359
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
360
|
+
} catch (error) {
|
|
361
|
+
console.error(`Failed to create container for type: ${type}`, error) [[! rem]]
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Look for the `[[! add]]` and `[[! rem]]` on individual lines.
|
|
368
|
+
|
|
369
|
+
````markup
|
|
370
|
+
```js
|
|
371
|
+
export function containersPlugin(
|
|
372
|
+
md: MarkdownIt,
|
|
373
|
+
containers: ContainerDetails[],
|
|
374
|
+
createContainer: CreateContainerFn,
|
|
375
|
+
): void {
|
|
376
|
+
if (!Array.isArray(containers) || containers.length === 0) { [[! add]]
|
|
377
|
+
console.warn('No containers provided to containersPlugin.') [[! add]]
|
|
378
|
+
return [[! add]]
|
|
379
|
+
} [[! add]]
|
|
380
|
+
|
|
381
|
+
if (typeof createContainer !== 'function') {
|
|
382
|
+
throw new Error('Invalid createContainer function provided to containersPlugin.')
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
containers.forEach(({ type, defaultTitle }) => {
|
|
386
|
+
try {
|
|
387
|
+
md.use(...createContainer(container, type, defaultTitle))
|
|
388
|
+
} catch (error) {
|
|
389
|
+
console.error(`Failed to create container for type: ${type}`, error) [[! rem]]
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
````
|
|
395
|
+
|
|
396
|
+
### Tabs
|
|
397
|
+
|
|
398
|
+
```tabs
|
|
399
|
+
<<| bash npm |>>
|
|
400
|
+
npm install @md-plugins/md-plugin-codeblocks
|
|
401
|
+
<<| bash yarn |>>
|
|
402
|
+
yarn add @md-plugins/md-plugin-codeblocks
|
|
403
|
+
<<| bash pnpm |>>
|
|
404
|
+
pnpm add @md-plugins/md-plugin-codeblocks
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
````markup
|
|
408
|
+
```tabs
|
|
409
|
+
<<| bash npm |>>
|
|
410
|
+
npm install @md-plugins/md-plugin-codeblocks
|
|
411
|
+
<<| bash yarn |>>
|
|
412
|
+
yarn add @md-plugins/md-plugin-codeblocks
|
|
413
|
+
<<| bash pnpm |>>
|
|
414
|
+
pnpm add @md-plugins/md-plugin-codeblocks
|
|
415
|
+
```
|
|
416
|
+
````
|
|
417
|
+
|
|
418
|
+
### Advanced Tabs
|
|
419
|
+
|
|
420
|
+
```tabs
|
|
421
|
+
<<| javascript [numbered highlight=2,4 add=3 rem=5] javascript |>>
|
|
422
|
+
console.log('Hello, world!'); // Line 1
|
|
423
|
+
const a = 10; // Line 2
|
|
424
|
+
const b = 20; // Line 3
|
|
425
|
+
console.log(a + b); // Line 4
|
|
426
|
+
console.log('This line will be removed'); // Line 5
|
|
427
|
+
<<| typescript [numbered highlight=2,4 add=3 rem=5] typescript |>>
|
|
428
|
+
console.log('Hello, TypeScript!'); // Line 1
|
|
429
|
+
const a: number = 10; // Line 2
|
|
430
|
+
const b: number = 20; // Line 3
|
|
431
|
+
console.log(a + b); // Line 4
|
|
432
|
+
console.log('This line will be removed'); // Line 5
|
|
433
|
+
<<| bash [numbered highlight=2,4 add=3 rem=5] bash |>>
|
|
434
|
+
echo 'Hello, Bash!' # Line 1
|
|
435
|
+
VAR1=10 # Line 2
|
|
436
|
+
VAR2=20 # Line 3
|
|
437
|
+
echo $((VAR1 + VAR2)) # Line 4
|
|
438
|
+
echo 'This line will be removed' # Line 5
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
````markup
|
|
442
|
+
```tabs
|
|
443
|
+
<<| javascript [numbered highlight=2,4 add=3 rem=5] javascript |>>
|
|
444
|
+
console.log('Hello, world!'); // Line 1
|
|
445
|
+
const a = 10; // Line 2
|
|
446
|
+
const b = 20; // Line 3
|
|
447
|
+
console.log(a + b); // Line 4
|
|
448
|
+
console.log('This line will be removed'); // Line 5
|
|
449
|
+
<<| typescript [numbered highlight=2,4 add=3 rem=5] typescript |>>
|
|
450
|
+
console.log('Hello, TypeScript!'); // Line 1
|
|
451
|
+
const a: number = 10; // Line 2
|
|
452
|
+
const b: number = 20; // Line 3
|
|
453
|
+
console.log(a + b); // Line 4
|
|
454
|
+
console.log('This line will be removed'); // Line 5
|
|
455
|
+
<<| bash [numbered highlight=2,4 add=3 rem=5] bash |>>
|
|
456
|
+
echo 'Hello, Bash!' # Line 1
|
|
457
|
+
VAR1=10 # Line 2
|
|
458
|
+
VAR2=20 # Line 3
|
|
459
|
+
echo $((VAR1 + VAR2)) # Line 4
|
|
460
|
+
echo 'This line will be removed' # Line 5
|
|
461
|
+
```
|
|
462
|
+
````
|
|
463
|
+
|
|
464
|
+
### Advanced Tabs with Title
|
|
465
|
+
|
|
466
|
+
```tabs Examples
|
|
467
|
+
<<| javascript [numbered highlight=2,4 add=3 rem=5] javascript |>>
|
|
468
|
+
console.log('Hello, world!'); // Line 1
|
|
469
|
+
const a = 10; // Line 2
|
|
470
|
+
const b = 20; // Line 3
|
|
471
|
+
console.log(a + b); // Line 4
|
|
472
|
+
console.log('This line will be removed'); // Line 5
|
|
473
|
+
<<| typescript [numbered highlight=2,4 add=3 rem=5] typescript |>>
|
|
474
|
+
console.log('Hello, TypeScript!'); // Line 1
|
|
475
|
+
const a: number = 10; // Line 2
|
|
476
|
+
const b: number = 20; // Line 3
|
|
477
|
+
console.log(a + b); // Line 4
|
|
478
|
+
console.log('This line will be removed'); // Line 5
|
|
479
|
+
<<| bash [numbered highlight=2,4 add=3 rem=5] bash |>>
|
|
480
|
+
echo 'Hello, Bash!' # Line 1
|
|
481
|
+
VAR1=10 # Line 2
|
|
482
|
+
VAR2=20 # Line 3
|
|
483
|
+
echo $((VAR1 + VAR2)) # Line 4
|
|
484
|
+
echo 'This line will be removed' # Line 5
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
````markup
|
|
488
|
+
```tabs Examples
|
|
489
|
+
console.log('Hello, world!'); // Line 1
|
|
490
|
+
const a = 10; // Line 2
|
|
491
|
+
const b = 20; // Line 3
|
|
492
|
+
console.log(a + b); // Line 4
|
|
493
|
+
console.log('This line will be removed'); // Line 5
|
|
494
|
+
<<| typescript [numbered highlight=2,4 add=3 rem=5] typescript |>>
|
|
495
|
+
console.log('Hello, TypeScript!'); // Line 1
|
|
496
|
+
const a: number = 10; // Line 2
|
|
497
|
+
const b: number = 20; // Line 3
|
|
498
|
+
console.log(a + b); // Line 4
|
|
499
|
+
console.log('This line will be removed'); // Line 5
|
|
500
|
+
<<| bash [numbered highlight=2,4 add=3 rem=5] bash |>>
|
|
501
|
+
echo 'Hello, Bash!' # Line 1
|
|
502
|
+
VAR1=10 # Line 2
|
|
503
|
+
VAR2=20 # Line 3
|
|
504
|
+
echo $((VAR1 + VAR2)) # Line 4
|
|
505
|
+
echo 'This line will be removed' # Line 5
|
|
506
|
+
```
|
|
507
|
+
````
|
|
508
|
+
|
|
509
|
+
## Name
|
|
510
|
+
|
|
511
|
+
The official NPM name is `@md-plugins/md-plugin-codeblocks`.
|
|
512
|
+
|
|
513
|
+
## Installation
|
|
514
|
+
|
|
515
|
+
You can install the Codeblocks plugin using npm, yarn, or pnpm. Choose your preferred method below:
|
|
516
|
+
|
|
517
|
+
```tabs
|
|
518
|
+
<<| bash npm |>>
|
|
519
|
+
npm install @md-plugins/md-plugin-codeblocks
|
|
520
|
+
<<| bash yarn |>>
|
|
521
|
+
yarn add @md-plugins/md-plugin-codeblocks
|
|
522
|
+
<<| bash pnpm |>>
|
|
523
|
+
pnpm add @md-plugins/md-plugin-codeblocks
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
## Configuration
|
|
527
|
+
|
|
528
|
+
After installing the plugin, you need to configure it in your Markdown-It setup. Here's an example of how to do that:
|
|
529
|
+
|
|
530
|
+
````javascript
|
|
531
|
+
import MarkdownIt from 'markdown-it'
|
|
532
|
+
import { codeblocksPlugin } from '@md-plugins/md-plugin-codeblocks'
|
|
533
|
+
|
|
534
|
+
const md = new MarkdownIt()
|
|
535
|
+
|
|
536
|
+
md.use(codeblocksPlugin, {
|
|
537
|
+
defaultLang: 'javascript', // Optional: Set the default language
|
|
538
|
+
containerComponent: 'MarkdownPrerender', // Optional: Customize the container component
|
|
539
|
+
copyButtonComponent: 'MarkdownCopyButton', // Optional: Customize the copy button component
|
|
540
|
+
tabPanelTagName: 'q-tab-panel', // Optional: Customize the tab panel tag name
|
|
541
|
+
tabPanelTagClass: 'q-pa-none', // Optional: Customize the tab panel tag class
|
|
542
|
+
preClass: 'markdown-code', // Optional: Customize the class for the pre tag
|
|
543
|
+
codeClass: '', // Optional: Customize the class for the code tag
|
|
544
|
+
pageScripts: [
|
|
545
|
+
"import MarkdownPrerender from 'src/.q-press/components/MarkdownPrerender'", // ts file
|
|
546
|
+
"import MarkdownCopyButton from 'src/.q-press/components/MarkdownCopyButton.vue'",
|
|
547
|
+
], // Optional: Include page scripts
|
|
548
|
+
langList: [
|
|
549
|
+
{ name: 'javascript', aliases: 'javascript|js' },
|
|
550
|
+
{ name: 'typescript', aliases: 'typescript|ts' },
|
|
551
|
+
], // Optional: Customize Prism languages
|
|
552
|
+
})
|
|
553
|
+
|
|
554
|
+
// Now you can use the Codeblocks plugin in your Markdown content
|
|
555
|
+
const result = md.render("```javascript\nconsole.log('Hello, world!');\n```")
|
|
556
|
+
console.log(result)
|
|
557
|
+
````
|
|
558
|
+
|
|
559
|
+
### Options
|
|
560
|
+
|
|
561
|
+
The Codeblocks plugin accepts the following options:
|
|
562
|
+
|
|
563
|
+
- **defaultLang**: The default language to use if none is detected. Default is `markup`.
|
|
564
|
+
- **containerComponent**: The component used to wrap code blocks. Default is `MarkdownPrerender`.
|
|
565
|
+
- **copyButtonComponent**: The component used to render the copy button. Default is `MarkdownCopyButton`.
|
|
566
|
+
- **tabPanelTagName**: The component name for the tab panel. Default is `q-tab-panel`.
|
|
567
|
+
- **tabPanelTagClass**: The class(es) to be used with the tab panel. Default is `q-pa-none`.
|
|
568
|
+
- **preClass**: The class to be used for the pre tag. Default is `markdown-pre`.
|
|
569
|
+
- **codeClass**: The class to be used for the code tag. Default is `markdown-code`.
|
|
570
|
+
- **pageScripts**: An array of page scripts to be included.
|
|
571
|
+
- **langList**: Optional Prism languages configuration array. Each item can have a name, optional aliases, and customCopy boolean.
|
|
572
|
+
|
|
573
|
+
## Advanced Configuration
|
|
574
|
+
|
|
575
|
+
For more advanced configurations, you can combine the Codeblocks plugin with other Markdown-It plugins to enhance your Markdown content further. Here's an example:
|
|
576
|
+
|
|
577
|
+
````js
|
|
578
|
+
import MarkdownIt from 'markdown-it'
|
|
579
|
+
import { codeblocksPlugin } from '@md-plugins/md-plugin-codeblocks'
|
|
580
|
+
import markdownItAnchor from 'markdown-it-anchor'
|
|
581
|
+
import markdownItToc from 'markdown-it-toc-done-right'
|
|
582
|
+
|
|
583
|
+
const md = new MarkdownIt()
|
|
584
|
+
|
|
585
|
+
md.use(codeblocksPlugin, {
|
|
586
|
+
defaultLang: 'javascript', // Set the default language
|
|
587
|
+
containerComponent: 'MarkdownPrerender', // Customize the container component
|
|
588
|
+
copyButtonComponent: 'MarkdownCopyButton', // Customize the copy button component
|
|
589
|
+
tabPanelTagName: 'q-tab-panel', // Customize the tab panel tag name
|
|
590
|
+
tabPanelTagClass: 'q-pa-none', // Customize the tab panel tag class
|
|
591
|
+
preClass: 'markdown-pre', // Customize the class for the pre tag
|
|
592
|
+
codeClass: 'markdown-code', // Customize the class for the code tag
|
|
593
|
+
pageScripts: [
|
|
594
|
+
"import MarkdownPrerender from 'src/.q-presss/components/MarkdownPrerender'", // ts file
|
|
595
|
+
"import MarkdownCopyButton from 'src/.q-press/components/MarkdownCopyButton.vue'",
|
|
596
|
+
], // Include page scripts
|
|
597
|
+
langList: [
|
|
598
|
+
{ name: 'javascript', aliases: 'javascript|js' },
|
|
599
|
+
{ name: 'typescript', aliases: 'typescript|ts' },
|
|
600
|
+
], // Customize Prism languages
|
|
601
|
+
})
|
|
602
|
+
.use(markdownItAnchor)
|
|
603
|
+
.use(markdownItToc)
|
|
604
|
+
|
|
605
|
+
// Now you can use the Codeblocks plugin along with other plugins in your Markdown content
|
|
606
|
+
const result = md.render(
|
|
607
|
+
"# Table of Contents\n\n[[toc]]\n\n```javascript\nconsole.log('Hello, world!');\n```",
|
|
608
|
+
)
|
|
609
|
+
console.log(result)
|
|
610
|
+
````
|
|
611
|
+
|
|
612
|
+
## Support
|
|
613
|
+
|
|
614
|
+
If you have any questions or need assistance, please refer to the FAQ or reach out to our support team.
|
|
615
|
+
|
|
616
|
+
Happy coding!
|