You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demo/src/markdown/markdown.vmd
+55-2Lines changed: 55 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
title: QMarkdown Docs
3
3
desc: This is the documentation for QMarkdown
4
4
---
5
+
5
6
<template>
6
7
<div class="q-pa-md q-gutter-sm q-markdown">
7
8
@@ -94,6 +95,7 @@ The recommended way, would be to import the markdown to be used so that it doesn
94
95
QMarkdown comes with a Webpack loader for importing markdown files directly into your code.
95
96
96
97
In your JavaScript:
98
+
97
99
```js
98
100
import markdown from '../markdown/calendar.md'
99
101
@@ -107,16 +109,19 @@ export default {
107
109
},
108
110
...
109
111
```
112
+
110
113
And, in your HTML:
111
114
```html
112
115
<q-markdown :src="markdown" />
113
116
```
117
+
114
118
## Setting up Table of Contents
115
119
You enable a TOC by setting `:toc="true"` on the `q-markdown` component. The data in the TOC is based on HTML Headings (H1-H6). You can change the number of headings that you are interested in by using the `toc-start` and `toc-end` properties.
116
120
117
121
To get the data for the TOC, you must use the `@data` event.
@@ -170,6 +179,7 @@ You are able to mix Vue (SFC: single-file component) and Markdown together. This
170
179
The minimal viable `.vmd` file must contain a `<template>` section. All other sections are optional.
171
180
172
181
Example (from the top of this file):
182
+
173
183
```html
174
184
<template>
175
185
<div class="q-pa-md q-gutter-sm q-markdown">
@@ -183,6 +193,7 @@ QMarkdown is a [Quasar App Extension](https://v1.quasar.dev/app-extensions/intro
183
193
... // the rest of the markdown
184
194
</template>
185
195
```
196
+
186
197
As you may have noticed, your HTML code should add the `q-markdown` class to the wrapper html in order to get all proper syntax highlighting.
187
198
188
199
Now, as far as getting it to be displayed on your page, do the following in your `<script>` section:
@@ -218,6 +229,7 @@ If you would like to generate a TOC (Table of Contents) derived from the header
218
229
}
219
230
},
220
231
```
232
+
221
233
The Vue+Markdown (`.vmd`) loader will replace the `tocData: [ ]` (extra space in square brackets added to avoid this feature in the docs) if found and add the TOC data.
222
234
223
235
::: warning
@@ -267,6 +279,7 @@ title: QMarkdown Docs
267
279
desc: This is the documentation for QMarkdown
268
280
---
269
281
```
282
+
270
283
This will be converted to:
271
284
272
285
```js
@@ -278,7 +291,7 @@ This will be converted to:
278
291
279
292
This is injected into your Vue data by having the following:
280
293
281
-
```
294
+
```js
282
295
data () {
283
296
return {
284
297
// eslint-disable-next-line
@@ -294,6 +307,7 @@ Notice the commented line `eslint-disable-next-line`? The data added is not form
294
307
:::
295
308
296
309
Finally, you can use the Front-Matter data like this:
310
+
297
311
```js
298
312
mounted () {
299
313
document.title = this.frontMatter.title
@@ -308,7 +322,9 @@ import getTagParts from '@quasar/quasar-app-extension-qmarkdown/src/lib/getTagPa
@@ -319,6 +335,7 @@ And then, you can use it like this:
319
335
console.log('css', results.css)
320
336
},
321
337
```
338
+
322
339
This makes use of the `raw-loader` Webpack loader. The exclamations are needed to tell Webpack to overload the default loader.
323
340
324
341
::: tip
@@ -327,6 +344,38 @@ This makes use of the `raw-loader` Webpack loader. The exclamations are needed t
327
344
328
345
Now, you will have access to the tag parts of the Vue file.
329
346
347
+
# Extending Markdown-it!
348
+
You can use the `extend` property to extend the Markdown-it! markdown processor. The extend function takes a single argument of the md (markdown) instance.
349
+
350
+
Now, you can extend QMarkdown with either your own code or Markdown-it! [plugins](https://www.npmjs.com/search?q=keywords:markdown-it-plugin). Please read the Markdown-It [documentation](https://github.com/markdown-it/markdown-it#readme) on how to do this.
@@ -403,7 +456,7 @@ The TOC data will be transformed to the following:
403
456
If you appreciate the work that went into this App Extension, please consider [donating to Quasar](https://donate.quasar.dev).
404
457
405
458
---
406
-
This page created with [QMarkdown](https://quasarframework.github.io/app-extension-qmarkdown/demo/dist/spa/#/images).
459
+
This page created with [QMarkdown](https://quasarframework.github.io/app-extension-qmarkdown/demo/dist/spa/#/images). It is in the `vmd` format. You can view it's source [here](https://github.com/quasarframework/app-extension-qmarkdown/blob/dev/demo/src/markdown/markdown.vmd)
0 commit comments