@md-plugins/quasar-app-extension-q-press 0.1.0-alpha.24 → 0.1.0-alpha.25
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/package.json +15 -15
- package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +11 -0
- package/src/templates/init/src/_q-press/components/MarkdownPrerender.ts +9 -0
- package/src/templates/init/src/_q-press/composables/scroll.ts +27 -0
- package/src/templates/init/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +9 -4
- package/src/templates/init/src/_q-press/layouts/MarkdownHeaderMenu.ts +18 -2
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +1 -1
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +1 -1
- package/src/templates/init/src/siteConfig/index.ts +2 -2
- package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +11 -0
- package/src/templates/update/src/_q-press/components/MarkdownPrerender.ts +9 -0
- package/src/templates/update/src/_q-press/composables/scroll.ts +27 -0
- package/src/templates/update/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +9 -4
- package/src/templates/update/src/_q-press/layouts/MarkdownHeaderMenu.ts +18 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/quasar-app-extension-q-press",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.25",
|
|
4
4
|
"description": "QPress - The Ultimate Markdown Solution for Quasar Framework",
|
|
5
5
|
"author": "hawkeye64 <galbraith64@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -29,24 +29,24 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@types/markdown-it": "^14.1.2",
|
|
31
31
|
"markdown-it": "^14.1.0",
|
|
32
|
-
"@md-plugins/md-plugin-
|
|
33
|
-
"@md-plugins/md-plugin-
|
|
34
|
-
"@md-plugins/md-plugin-
|
|
35
|
-
"@md-plugins/md-plugin-frontmatter": "0.1.0-alpha.
|
|
36
|
-
"@md-plugins/md-plugin-
|
|
37
|
-
"@md-plugins/md-plugin-image": "0.1.0-alpha.
|
|
38
|
-
"@md-plugins/md-plugin-imports": "0.1.0-alpha.
|
|
39
|
-
"@md-plugins/md-plugin-
|
|
40
|
-
"@md-plugins/md-plugin-
|
|
41
|
-
"@md-plugins/md-plugin-
|
|
42
|
-
"@md-plugins/md-plugin
|
|
43
|
-
"@md-plugins/
|
|
44
|
-
"@md-plugins/
|
|
32
|
+
"@md-plugins/md-plugin-blockquote": "0.1.0-alpha.25",
|
|
33
|
+
"@md-plugins/md-plugin-headers": "0.1.0-alpha.25",
|
|
34
|
+
"@md-plugins/md-plugin-codeblocks": "0.1.0-alpha.25",
|
|
35
|
+
"@md-plugins/md-plugin-frontmatter": "0.1.0-alpha.25",
|
|
36
|
+
"@md-plugins/md-plugin-inlinecode": "0.1.0-alpha.25",
|
|
37
|
+
"@md-plugins/md-plugin-image": "0.1.0-alpha.25",
|
|
38
|
+
"@md-plugins/md-plugin-imports": "0.1.0-alpha.25",
|
|
39
|
+
"@md-plugins/md-plugin-containers": "0.1.0-alpha.25",
|
|
40
|
+
"@md-plugins/md-plugin-table": "0.1.0-alpha.25",
|
|
41
|
+
"@md-plugins/md-plugin-title": "0.1.0-alpha.25",
|
|
42
|
+
"@md-plugins/vite-md-plugin": "0.1.0-alpha.25",
|
|
43
|
+
"@md-plugins/md-plugin-link": "0.1.0-alpha.25",
|
|
44
|
+
"@md-plugins/shared": "0.1.0-alpha.25"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/markdown-it": "^14.1.2",
|
|
48
48
|
"fs-extra": "^11.3.0",
|
|
49
|
-
"vite": "^6.0
|
|
49
|
+
"vite": "^6.1.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"markdown-it": "^14.1.0"
|
|
@@ -141,6 +141,12 @@ const slugifiedTitle = computed(() => {
|
|
|
141
141
|
return slugify('example-' + props.title)
|
|
142
142
|
})
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Computed property that returns the options for the component.
|
|
146
|
+
* This property is reactive and will update whenever its dependencies change.
|
|
147
|
+
*
|
|
148
|
+
* @returns {Object} The options object for the component.
|
|
149
|
+
*/
|
|
144
150
|
const options = computed(() => {
|
|
145
151
|
const data = {
|
|
146
152
|
title: computedTitle.value,
|
|
@@ -164,6 +170,11 @@ ${html.value}
|
|
|
164
170
|
return JSON.stringify(data)
|
|
165
171
|
})
|
|
166
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Opens a specific part of the application.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} whichParts - The parts of the application to open.
|
|
177
|
+
*/
|
|
167
178
|
function open(whichParts) {
|
|
168
179
|
def.parts = whichParts
|
|
169
180
|
|
|
@@ -20,6 +20,15 @@ export default defineComponent({
|
|
|
20
20
|
|
|
21
21
|
const hasHeader = computed(() => props.title !== undefined || props.tabs !== undefined)
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Generates an array of VNode elements based on the provided props and slots.
|
|
25
|
+
*
|
|
26
|
+
* This function constructs a list of VNode elements to be rendered, including
|
|
27
|
+
* a title, tabs, a separator, and the main content. The content is conditionally
|
|
28
|
+
* wrapped in QTabPanels or a div based on the presence of tabs.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ReturnType<typeof h>[]} An array of VNode elements to be rendered.
|
|
31
|
+
*/
|
|
23
32
|
function getContent() {
|
|
24
33
|
const acc: ReturnType<typeof h>[] = []
|
|
25
34
|
|
|
@@ -23,6 +23,12 @@ export function useScroll() {
|
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Changes the router's hash to the specified value. If the current hash is different from the provided hash,
|
|
28
|
+
* it replaces the current hash with the new one. If the hash is the same, it scrolls to the current anchor.
|
|
29
|
+
*
|
|
30
|
+
* @param hash - The new hash value to set in the router.
|
|
31
|
+
*/
|
|
26
32
|
function changeRouterHash(hash: string) {
|
|
27
33
|
if (route.hash !== hash) {
|
|
28
34
|
router.replace({ hash }).catch(() => {})
|
|
@@ -31,6 +37,12 @@ export function useScroll() {
|
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Scrolls the page to the specified HTML element with a given delay.
|
|
42
|
+
*
|
|
43
|
+
* @param el - The HTML element to scroll to.
|
|
44
|
+
* @param delay - The delay in milliseconds for the scroll animation.
|
|
45
|
+
*/
|
|
34
46
|
function scrollPage(el: HTMLElement, delay: number) {
|
|
35
47
|
const { top } = el.getBoundingClientRect()
|
|
36
48
|
const offset = Math.max(
|
|
@@ -48,6 +60,11 @@ export function useScroll() {
|
|
|
48
60
|
}, delay + 10)
|
|
49
61
|
}
|
|
50
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Scrolls the page to the HTML element with the specified ID, updates the router's hash, and sets the active TOC (table of contents) item.
|
|
65
|
+
*
|
|
66
|
+
* @param id - The ID of the HTML element to scroll to.
|
|
67
|
+
*/
|
|
51
68
|
function scrollTo(id: string) {
|
|
52
69
|
clearTimeout(scrollTimer)
|
|
53
70
|
changeRouterHash('#' + id)
|
|
@@ -57,6 +74,11 @@ export function useScroll() {
|
|
|
57
74
|
}, scrollDuration + 50)
|
|
58
75
|
}
|
|
59
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Handles the page scroll event and updates the active TOC (table of contents) item, unless the TOC update is prevented.
|
|
79
|
+
*
|
|
80
|
+
* @param position - The current vertical scroll position of the page.
|
|
81
|
+
*/
|
|
60
82
|
function onPageScroll({ position }: { position: number }) {
|
|
61
83
|
// @ts-expect-error Jeff - fix later when I can figure this one out
|
|
62
84
|
if (preventTocUpdate !== true && document.qScrollPrevented !== true) {
|
|
@@ -64,6 +86,11 @@ export function useScroll() {
|
|
|
64
86
|
}
|
|
65
87
|
}
|
|
66
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Scrolls the page to the current anchor element, optionally with an immediate scroll.
|
|
91
|
+
*
|
|
92
|
+
* @param immediate - If true, the scroll will be immediate without any animation.
|
|
93
|
+
*/
|
|
67
94
|
function scrollToCurrentAnchor(immediate?: boolean) {
|
|
68
95
|
const hash = location.hash
|
|
69
96
|
const el = hash.length > 1 ? document.getElementById(hash.substring(1)) : null
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
class="header-btn"
|
|
7
7
|
flat
|
|
8
8
|
round
|
|
9
|
-
:icon="entry.icon"
|
|
9
|
+
:icon="!entry.image ? entry.icon : void 0"
|
|
10
10
|
:to="entry.path"
|
|
11
|
+
:color="entry.color ? entry.color : void 0"
|
|
11
12
|
:href="entry.external ? entry.path : void 0"
|
|
12
13
|
:target="entry.external ? '_blank' : void 0"
|
|
13
14
|
:aria-label="entry.name"
|
|
14
|
-
|
|
15
|
+
>
|
|
16
|
+
<q-avatar v-if="entry.image" size="28px">
|
|
17
|
+
<img :src="entry.icon" />
|
|
18
|
+
</q-avatar>
|
|
19
|
+
</q-btn>
|
|
15
20
|
</div>
|
|
16
21
|
</template>
|
|
17
22
|
|
|
@@ -21,11 +26,11 @@ interface MenuEntry {
|
|
|
21
26
|
path: string
|
|
22
27
|
external?: boolean
|
|
23
28
|
name: string
|
|
29
|
+
color?: string
|
|
30
|
+
image?: boolean
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
const props = defineProps<{
|
|
27
34
|
menu: MenuEntry[]
|
|
28
35
|
}>()
|
|
29
|
-
|
|
30
|
-
console.log('props.menu:', props.menu)
|
|
31
36
|
</script>
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
QMenu,
|
|
3
|
+
QIcon,
|
|
4
|
+
QAvatar,
|
|
5
|
+
QList,
|
|
6
|
+
QItem,
|
|
7
|
+
QItemSection,
|
|
8
|
+
QItemLabel,
|
|
9
|
+
QSeparator,
|
|
10
|
+
Screen,
|
|
11
|
+
} from 'quasar'
|
|
2
12
|
import { h } from 'vue'
|
|
3
13
|
import { mdiMenuRight } from '@quasar/extras/mdi-v7'
|
|
4
14
|
|
|
@@ -10,6 +20,8 @@ interface MenuElement {
|
|
|
10
20
|
icon?: string
|
|
11
21
|
name?: string
|
|
12
22
|
mq?: string
|
|
23
|
+
color?: string
|
|
24
|
+
image?: boolean
|
|
13
25
|
children?: MenuElement[]
|
|
14
26
|
}
|
|
15
27
|
|
|
@@ -52,8 +64,12 @@ export default {
|
|
|
52
64
|
() => {
|
|
53
65
|
const acc: any[] = []
|
|
54
66
|
|
|
67
|
+
const iconOrImage = !entry.image
|
|
68
|
+
? h(QIcon, { name: entry.icon, color: entry.color ? entry.color : void 0 })
|
|
69
|
+
: h(QAvatar, { size: '28px' }, () => h('img', { src: entry.icon }))
|
|
70
|
+
|
|
55
71
|
if (entry.icon !== void 0) {
|
|
56
|
-
acc.push(h(QItemSection, { side: true }, () =>
|
|
72
|
+
acc.push(h(QItemSection, { side: true }, () => iconOrImage))
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
acc.push(h(QItemSection, { class: 'text-no-wrap' }, () => entry.name))
|
|
@@ -42,7 +42,7 @@ In your markdown file, you can add the following to create an `api` card:
|
|
|
42
42
|
|
|
43
43
|
::: tip
|
|
44
44
|
The API format conforms to Quasar's API format.
|
|
45
|
-
We will touch on this at a later date.
|
|
45
|
+
We will touch on this at a later date. For now, you can look at the Api folder in the .q-press folder.
|
|
46
46
|
:::
|
|
47
47
|
|
|
48
48
|
```markdown
|
|
@@ -70,7 +70,7 @@ pnpm add prismjs
|
|
|
70
70
|
|
|
71
71
|
### Modify `tsconfig.json`
|
|
72
72
|
|
|
73
|
-
Add the `resolveJsonModule: true` to your `tsconfig.json` file in your
|
|
73
|
+
Add the `resolveJsonModule: true` to your `tsconfig.json` file in your root folder:
|
|
74
74
|
|
|
75
75
|
```json
|
|
76
76
|
"compilerOptions": {
|
|
@@ -112,7 +112,7 @@ const socialLinks = {
|
|
|
112
112
|
path: 'https://twitter.com/md_plugins',
|
|
113
113
|
external: true,
|
|
114
114
|
},
|
|
115
|
-
],
|
|
115
|
+
] as SocialLink[],
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
const netlifyLink = {
|
|
@@ -348,7 +348,7 @@ const secondaryToolbarLinks = [
|
|
|
348
348
|
otherMenu,
|
|
349
349
|
]
|
|
350
350
|
|
|
351
|
-
export const moreLinks
|
|
351
|
+
export const moreLinks = [
|
|
352
352
|
{
|
|
353
353
|
name: 'More',
|
|
354
354
|
// children: [...primaryToolbarLinks, { separator: true }, ...secondaryToolbarLinks, socialLinks],
|
|
@@ -141,6 +141,12 @@ const slugifiedTitle = computed(() => {
|
|
|
141
141
|
return slugify('example-' + props.title)
|
|
142
142
|
})
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Computed property that returns the options for the component.
|
|
146
|
+
* This property is reactive and will update whenever its dependencies change.
|
|
147
|
+
*
|
|
148
|
+
* @returns {Object} The options object for the component.
|
|
149
|
+
*/
|
|
144
150
|
const options = computed(() => {
|
|
145
151
|
const data = {
|
|
146
152
|
title: computedTitle.value,
|
|
@@ -164,6 +170,11 @@ ${html.value}
|
|
|
164
170
|
return JSON.stringify(data)
|
|
165
171
|
})
|
|
166
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Opens a specific part of the application.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} whichParts - The parts of the application to open.
|
|
177
|
+
*/
|
|
167
178
|
function open(whichParts) {
|
|
168
179
|
def.parts = whichParts
|
|
169
180
|
|
|
@@ -20,6 +20,15 @@ export default defineComponent({
|
|
|
20
20
|
|
|
21
21
|
const hasHeader = computed(() => props.title !== undefined || props.tabs !== undefined)
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Generates an array of VNode elements based on the provided props and slots.
|
|
25
|
+
*
|
|
26
|
+
* This function constructs a list of VNode elements to be rendered, including
|
|
27
|
+
* a title, tabs, a separator, and the main content. The content is conditionally
|
|
28
|
+
* wrapped in QTabPanels or a div based on the presence of tabs.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ReturnType<typeof h>[]} An array of VNode elements to be rendered.
|
|
31
|
+
*/
|
|
23
32
|
function getContent() {
|
|
24
33
|
const acc: ReturnType<typeof h>[] = []
|
|
25
34
|
|
|
@@ -23,6 +23,12 @@ export function useScroll() {
|
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Changes the router's hash to the specified value. If the current hash is different from the provided hash,
|
|
28
|
+
* it replaces the current hash with the new one. If the hash is the same, it scrolls to the current anchor.
|
|
29
|
+
*
|
|
30
|
+
* @param hash - The new hash value to set in the router.
|
|
31
|
+
*/
|
|
26
32
|
function changeRouterHash(hash: string) {
|
|
27
33
|
if (route.hash !== hash) {
|
|
28
34
|
router.replace({ hash }).catch(() => {})
|
|
@@ -31,6 +37,12 @@ export function useScroll() {
|
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Scrolls the page to the specified HTML element with a given delay.
|
|
42
|
+
*
|
|
43
|
+
* @param el - The HTML element to scroll to.
|
|
44
|
+
* @param delay - The delay in milliseconds for the scroll animation.
|
|
45
|
+
*/
|
|
34
46
|
function scrollPage(el: HTMLElement, delay: number) {
|
|
35
47
|
const { top } = el.getBoundingClientRect()
|
|
36
48
|
const offset = Math.max(
|
|
@@ -48,6 +60,11 @@ export function useScroll() {
|
|
|
48
60
|
}, delay + 10)
|
|
49
61
|
}
|
|
50
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Scrolls the page to the HTML element with the specified ID, updates the router's hash, and sets the active TOC (table of contents) item.
|
|
65
|
+
*
|
|
66
|
+
* @param id - The ID of the HTML element to scroll to.
|
|
67
|
+
*/
|
|
51
68
|
function scrollTo(id: string) {
|
|
52
69
|
clearTimeout(scrollTimer)
|
|
53
70
|
changeRouterHash('#' + id)
|
|
@@ -57,6 +74,11 @@ export function useScroll() {
|
|
|
57
74
|
}, scrollDuration + 50)
|
|
58
75
|
}
|
|
59
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Handles the page scroll event and updates the active TOC (table of contents) item, unless the TOC update is prevented.
|
|
79
|
+
*
|
|
80
|
+
* @param position - The current vertical scroll position of the page.
|
|
81
|
+
*/
|
|
60
82
|
function onPageScroll({ position }: { position: number }) {
|
|
61
83
|
// @ts-expect-error Jeff - fix later when I can figure this one out
|
|
62
84
|
if (preventTocUpdate !== true && document.qScrollPrevented !== true) {
|
|
@@ -64,6 +86,11 @@ export function useScroll() {
|
|
|
64
86
|
}
|
|
65
87
|
}
|
|
66
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Scrolls the page to the current anchor element, optionally with an immediate scroll.
|
|
91
|
+
*
|
|
92
|
+
* @param immediate - If true, the scroll will be immediate without any animation.
|
|
93
|
+
*/
|
|
67
94
|
function scrollToCurrentAnchor(immediate?: boolean) {
|
|
68
95
|
const hash = location.hash
|
|
69
96
|
const el = hash.length > 1 ? document.getElementById(hash.substring(1)) : null
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
class="header-btn"
|
|
7
7
|
flat
|
|
8
8
|
round
|
|
9
|
-
:icon="entry.icon"
|
|
9
|
+
:icon="!entry.image ? entry.icon : void 0"
|
|
10
10
|
:to="entry.path"
|
|
11
|
+
:color="entry.color ? entry.color : void 0"
|
|
11
12
|
:href="entry.external ? entry.path : void 0"
|
|
12
13
|
:target="entry.external ? '_blank' : void 0"
|
|
13
14
|
:aria-label="entry.name"
|
|
14
|
-
|
|
15
|
+
>
|
|
16
|
+
<q-avatar v-if="entry.image" size="28px">
|
|
17
|
+
<img :src="entry.icon" />
|
|
18
|
+
</q-avatar>
|
|
19
|
+
</q-btn>
|
|
15
20
|
</div>
|
|
16
21
|
</template>
|
|
17
22
|
|
|
@@ -21,11 +26,11 @@ interface MenuEntry {
|
|
|
21
26
|
path: string
|
|
22
27
|
external?: boolean
|
|
23
28
|
name: string
|
|
29
|
+
color?: string
|
|
30
|
+
image?: boolean
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
const props = defineProps<{
|
|
27
34
|
menu: MenuEntry[]
|
|
28
35
|
}>()
|
|
29
|
-
|
|
30
|
-
console.log('props.menu:', props.menu)
|
|
31
36
|
</script>
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
QMenu,
|
|
3
|
+
QIcon,
|
|
4
|
+
QAvatar,
|
|
5
|
+
QList,
|
|
6
|
+
QItem,
|
|
7
|
+
QItemSection,
|
|
8
|
+
QItemLabel,
|
|
9
|
+
QSeparator,
|
|
10
|
+
Screen,
|
|
11
|
+
} from 'quasar'
|
|
2
12
|
import { h } from 'vue'
|
|
3
13
|
import { mdiMenuRight } from '@quasar/extras/mdi-v7'
|
|
4
14
|
|
|
@@ -10,6 +20,8 @@ interface MenuElement {
|
|
|
10
20
|
icon?: string
|
|
11
21
|
name?: string
|
|
12
22
|
mq?: string
|
|
23
|
+
color?: string
|
|
24
|
+
image?: boolean
|
|
13
25
|
children?: MenuElement[]
|
|
14
26
|
}
|
|
15
27
|
|
|
@@ -52,8 +64,12 @@ export default {
|
|
|
52
64
|
() => {
|
|
53
65
|
const acc: any[] = []
|
|
54
66
|
|
|
67
|
+
const iconOrImage = !entry.image
|
|
68
|
+
? h(QIcon, { name: entry.icon, color: entry.color ? entry.color : void 0 })
|
|
69
|
+
: h(QAvatar, { size: '28px' }, () => h('img', { src: entry.icon }))
|
|
70
|
+
|
|
55
71
|
if (entry.icon !== void 0) {
|
|
56
|
-
acc.push(h(QItemSection, { side: true }, () =>
|
|
72
|
+
acc.push(h(QItemSection, { side: true }, () => iconOrImage))
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
acc.push(h(QItemSection, { class: 'text-no-wrap' }, () => entry.name))
|