@barzhsieh/nuxt-content-mermaid 2.2.3 → 3.0.0
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/README.md +190 -90
- package/README.zh-TW.md +183 -99
- package/dist/module.d.mts +39 -53
- package/dist/module.json +3 -3
- package/dist/module.mjs +600 -155
- package/dist/runtime/built-in-renderer/BuiltInRenderer.d.vue.ts +0 -0
- package/dist/runtime/built-in-renderer/BuiltInRenderer.vue +597 -0
- package/dist/runtime/built-in-renderer/BuiltInRenderer.vue.d.ts +0 -0
- package/dist/runtime/component-configuration-error.d.ts +3 -0
- package/dist/runtime/component-configuration-error.js +7 -0
- package/dist/runtime/component-configuration.d.ts +23 -0
- package/dist/runtime/component-configuration.js +78 -0
- package/dist/runtime/components/ContentMermaidTransport.d.vue.ts +10 -0
- package/dist/runtime/components/ContentMermaidTransport.vue +21 -0
- package/dist/runtime/components/ContentMermaidTransport.vue.d.ts +10 -0
- package/dist/runtime/components/Mermaid.d.vue.ts +0 -31
- package/dist/runtime/components/Mermaid.vue +136 -743
- package/dist/runtime/components/Mermaid.vue.d.ts +0 -31
- package/dist/runtime/components/MermaidExpandOverlay.d.vue.ts +13 -16
- package/dist/runtime/components/MermaidExpandOverlay.vue +61 -53
- package/dist/runtime/components/MermaidExpandOverlay.vue.d.ts +13 -16
- package/dist/runtime/components/MermaidFullscreenPresentation.d.vue.ts +18 -0
- package/dist/runtime/components/MermaidFullscreenPresentation.vue +56 -0
- package/dist/runtime/components/MermaidFullscreenPresentation.vue.d.ts +18 -0
- package/dist/runtime/composables/useMermaidExpand.d.ts +16 -32
- package/dist/runtime/composables/useMermaidExpand.js +232 -75
- package/dist/runtime/composables/useMermaidFullscreen.d.ts +18 -0
- package/dist/runtime/composables/useMermaidFullscreen.js +242 -0
- package/dist/runtime/composables/useMermaidZoom.d.ts +5 -1
- package/dist/runtime/composables/useMermaidZoom.js +54 -28
- package/dist/runtime/configuration/core.d.ts +27 -0
- package/dist/runtime/configuration/core.js +340 -0
- package/dist/runtime/configuration/module.d.ts +17 -0
- package/dist/runtime/configuration/module.js +233 -0
- package/dist/runtime/configuration/runtime-options.d.ts +4 -0
- package/dist/runtime/configuration/runtime-options.js +57 -0
- package/dist/runtime/constants.d.ts +24 -0
- package/dist/runtime/constants.js +60 -2
- package/dist/runtime/direct-mermaid-config.d.ts +5 -0
- package/dist/runtime/direct-mermaid-config.js +216 -0
- package/dist/runtime/mermaid-config.d.ts +9 -5
- package/dist/runtime/mermaid-config.js +30 -19
- package/dist/runtime/mermaid-rendering.d.ts +28 -0
- package/dist/runtime/mermaid-rendering.js +140 -0
- package/dist/runtime/plugins/content-mermaid-transport.d.ts +2 -0
- package/dist/runtime/plugins/content-mermaid-transport.js +5 -0
- package/dist/runtime/plugins/mermaid.client.d.ts +0 -3
- package/dist/runtime/plugins/mermaid.client.js +14 -32
- package/dist/runtime/plugins/runtime-config.d.ts +2 -0
- package/dist/runtime/plugins/runtime-config.js +9 -0
- package/dist/runtime/rendererSelection.d.ts +43 -0
- package/dist/runtime/rendererSelection.js +36 -0
- package/dist/runtime/rendererSelectionOrchestration.d.ts +12 -0
- package/dist/runtime/rendererSelectionOrchestration.js +13 -0
- package/dist/runtime/runtime-snapshot.d.ts +3 -0
- package/dist/runtime/runtime-snapshot.js +26 -0
- package/dist/runtime/utils/index.d.ts +0 -4
- package/dist/runtime/utils/index.js +0 -37
- package/dist/types.d.mts +2 -2
- package/package.json +36 -32
- package/dist/runtime/utils/mermaid-transform.d.ts +0 -18
- package/dist/runtime/utils/mermaid-transform.js +0 -345
package/README.md
CHANGED
|
@@ -14,54 +14,111 @@
|
|
|
14
14
|
A Nuxt module designed for integrating [**Mermaid**](https://mermaid.js.org/) with [**Nuxt Content v3**](https://content.nuxt.com/docs/getting-started).
|
|
15
15
|
It automatically converts `mermaid` code blocks in Markdown into responsive chart components, and supports lazy loading and dark/light theme switching.
|
|
16
16
|
|
|
17
|
+
<details>
|
|
18
|
+
<summary>Table of Contents</summary>
|
|
19
|
+
|
|
20
|
+
- [Features](#features)
|
|
21
|
+
- [Requirements](#requirements)
|
|
22
|
+
- [Dependency and Migration Contract](./docs/en/DEPENDENCY_AND_MIGRATION_CONTRACT.md)
|
|
23
|
+
- [Quick Setup](#quick-setup)
|
|
24
|
+
- [Configuration](#configuration)
|
|
25
|
+
- [Migrating to v3](#migrating-to-v3)
|
|
26
|
+
- [Styling (CSS Variables)](#styling-css-variables)
|
|
27
|
+
- [Advanced Usage](#advanced-usage)
|
|
28
|
+
- [Debug mode](#debug-mode)
|
|
29
|
+
- [Theme & Color Mode](#theme--color-mode)
|
|
30
|
+
- [Override Per-Page Settings with Frontmatter](#override-per-page-settings-with-frontmatter)
|
|
31
|
+
- [Mermaid Inline Attributes & YAML Frontmatter](#mermaid-inline-attributes--yaml-frontmatter)
|
|
32
|
+
- [Custom Rendering Component](#custom-rendering-component)
|
|
33
|
+
- [Wrapper Example](#wrapper-example)
|
|
34
|
+
- [Error Handling](#error-handling)
|
|
35
|
+
- [Support](#support)
|
|
36
|
+
- [Contribution](#contribution)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
|
|
39
|
+
</details>
|
|
40
|
+
|
|
17
41
|
## Features
|
|
18
42
|
|
|
19
43
|
- **Automatic conversion**: Parses Markdown code blocks and replaces them with a `<Mermaid>` rendering component.
|
|
20
44
|
- **Performance friendly**: Supports lazy loading — Mermaid core and related resources are only loaded when the component mounts.
|
|
21
45
|
- **Theme integration**: Integrates with `@nuxtjs/color-mode` to automatically switch between light and dark Mermaid themes.
|
|
22
|
-
- **Highly customizable**:
|
|
23
|
-
- **
|
|
46
|
+
- **Highly customizable**: Supports custom renderers, loading spinners, error views, themes, and toolbar controls.
|
|
47
|
+
- **Deployment configuration**: Pure-data settings can be transported through public runtime config and are resolved once for each Nuxt application.
|
|
24
48
|
|
|
25
49
|
## Requirements
|
|
26
50
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
51
|
+
- Node.js `>=22.19.0`
|
|
52
|
+
- `nuxt@^4.1.0`
|
|
53
|
+
- `@nuxt/content@>=3.5.0 <4.0.0`
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### 1. Install the module
|
|
55
|
+
For the ownership model, 2.x migration path, rendering guarantees, and visual
|
|
56
|
+
snapshot limits, see the [Dependency and Migration Contract](./docs/en/DEPENDENCY_AND_MIGRATION_CONTRACT.md).
|
|
33
57
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npx nuxi module add @barzhsieh/nuxt-content-mermaid
|
|
38
|
-
```
|
|
58
|
+
## Quick Setup
|
|
39
59
|
|
|
40
|
-
|
|
60
|
+
### 1. Install the packages
|
|
41
61
|
|
|
42
|
-
|
|
62
|
+
Package-manager installation and Nuxt module initialization are separate
|
|
63
|
+
steps. Your application owns the Nuxt and Nuxt Content peer dependencies, so it
|
|
64
|
+
must install, pin, and update them. Install this module together with the
|
|
65
|
+
supported Nuxt Content peer:
|
|
43
66
|
|
|
44
67
|
```bash
|
|
45
68
|
# pnpm
|
|
46
|
-
pnpm add
|
|
69
|
+
pnpm add @barzhsieh/nuxt-content-mermaid @nuxt/content
|
|
47
70
|
|
|
48
71
|
# npm
|
|
49
|
-
npm install
|
|
72
|
+
npm install @barzhsieh/nuxt-content-mermaid @nuxt/content
|
|
50
73
|
|
|
51
74
|
# yarn
|
|
52
|
-
yarn add
|
|
75
|
+
yarn add @barzhsieh/nuxt-content-mermaid @nuxt/content
|
|
53
76
|
```
|
|
54
77
|
|
|
55
|
-
|
|
78
|
+
Mermaid is bundled as this module's Module-Owned Dependency, so you do not need
|
|
79
|
+
to install it separately for this module.
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> **Nuxt Content database connector** — On Node.js, Nuxt Content asks the
|
|
83
|
+
> application to choose a database connector. `better-sqlite3`, `sqlite3`, and
|
|
84
|
+
> native SQLite in supported Node.js versions are available choices; this
|
|
85
|
+
> module does not require or own a specific connector. Follow the
|
|
86
|
+
> [Nuxt Content installation guide](https://content.nuxt.com/docs/getting-started/installation)
|
|
87
|
+
> for the options supported by your installed version.
|
|
88
|
+
>
|
|
89
|
+
> **pnpm v10+** — If you choose `better-sqlite3` or `sqlite3`, pnpm v10 blocks
|
|
90
|
+
> their native build scripts by default. Run `pnpm approve-builds`, or allow
|
|
91
|
+
> only the connector you selected in `package.json`. The example below uses
|
|
92
|
+
> `better-sqlite3`; replace it with `sqlite3` when that is your connector:
|
|
93
|
+
>
|
|
94
|
+
> ```json
|
|
95
|
+
> {
|
|
96
|
+
> "pnpm": {
|
|
97
|
+
> "onlyBuiltDependencies": ["better-sqlite3"]
|
|
98
|
+
> }
|
|
99
|
+
> }
|
|
100
|
+
> ```
|
|
101
|
+
|
|
102
|
+
### 2. Initialize the Nuxt module
|
|
103
|
+
|
|
104
|
+
List only this module in the standard `modules` configuration:
|
|
58
105
|
|
|
59
106
|
```ts
|
|
60
107
|
export default defineNuxtConfig({
|
|
61
|
-
modules: ["@barzhsieh/nuxt-content-mermaid"
|
|
108
|
+
modules: ["@barzhsieh/nuxt-content-mermaid"],
|
|
62
109
|
});
|
|
63
110
|
```
|
|
64
111
|
|
|
112
|
+
The module declares the required Nuxt Content relationship and compatible
|
|
113
|
+
version through `moduleDependencies`, so Nuxt initializes the installed
|
|
114
|
+
`@nuxt/content` module in the required order. This does not install, pin, or
|
|
115
|
+
update Nuxt Content; those package-manager responsibilities remain with your
|
|
116
|
+
application.
|
|
117
|
+
|
|
118
|
+
If your application already lists `@nuxt/content` manually in `modules`, you
|
|
119
|
+
may keep that entry. Manual listing remains supported, but it is no longer the
|
|
120
|
+
standard configuration.
|
|
121
|
+
|
|
65
122
|
### 3. Use Mermaid in Markdown
|
|
66
123
|
|
|
67
124
|
Add Mermaid code blocks inside `.md` files under the `content/` directory:
|
|
@@ -81,8 +138,7 @@ The module will automatically transform the block into an SVG chart component.
|
|
|
81
138
|
|
|
82
139
|
## Configuration
|
|
83
140
|
|
|
84
|
-
|
|
85
|
-
(`mermaidContent` is still accepted for backward compatibility, but will be removed in a future release.)
|
|
141
|
+
Configure the module globally through the canonical `contentMermaid` option. The former `mermaidContent` alias was removed in v3 and produces a migration error.
|
|
86
142
|
|
|
87
143
|
```ts
|
|
88
144
|
// nuxt.config.ts
|
|
@@ -100,11 +156,6 @@ export default defineNuxtConfig({
|
|
|
100
156
|
light: "default",
|
|
101
157
|
dark: "dark",
|
|
102
158
|
},
|
|
103
|
-
components: {
|
|
104
|
-
renderer: undefined,
|
|
105
|
-
spinner: undefined,
|
|
106
|
-
error: undefined,
|
|
107
|
-
},
|
|
108
159
|
toolbar: {
|
|
109
160
|
title: "mermaid",
|
|
110
161
|
fontSize: "14px",
|
|
@@ -144,27 +195,42 @@ export default defineNuxtConfig({
|
|
|
144
195
|
|
|
145
196
|
**loader**
|
|
146
197
|
|
|
147
|
-
| Option | Type | Default
|
|
148
|
-
| :---------------- | :------------------------------------ |
|
|
149
|
-
| `loader.init` | `
|
|
150
|
-
| `loader.lazy` | `boolean \| { threshold?: number }` | `true`
|
|
198
|
+
| Option | Type | Default | Description |
|
|
199
|
+
| :---------------- | :------------------------------------ | :--------------- | :------------------------------------------------------------------------------- |
|
|
200
|
+
| `loader.init` | `RuntimeMermaidConfig` (strict pure data) | package defaults | Pure-data Mermaid options transported to `mermaid.initialize`. |
|
|
201
|
+
| `loader.lazy` | `boolean \| { threshold?: number }` | `true` | Lazy load Mermaid when the component enters the viewport; set `false` to preload. |
|
|
202
|
+
|
|
203
|
+
The `loader.init` baseline is:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
{
|
|
207
|
+
startOnLoad: false,
|
|
208
|
+
theme: 'default',
|
|
209
|
+
fontFamily: 'Arial, sans-serif, 微軟正黑體',
|
|
210
|
+
securityLevel: 'strict',
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
When omitted, debug-derived values resolve to `logLevel: 5` and
|
|
215
|
+
`suppressErrorRendering: true` with `debug: false`, or `logLevel: 1` and
|
|
216
|
+
`suppressErrorRendering: false` with `debug: true`. Explicit values always win.
|
|
151
217
|
|
|
152
218
|
**theme**
|
|
153
219
|
|
|
154
220
|
Color mode integration is automatic when `@nuxtjs/color-mode` is installed; manual themes set via `useMermaidTheme()` take precedence.
|
|
155
221
|
|
|
156
|
-
| Option | Type | Default | Description
|
|
157
|
-
| :---------------- | :----- | :---------- |
|
|
158
|
-
| `theme.light` | string | `'default'` |
|
|
159
|
-
| `theme.dark` | string | `'dark'` |
|
|
222
|
+
| Option | Type | Default | Description |
|
|
223
|
+
| :---------------- | :----- | :---------- | :--------------------------------------------------------------------------- |
|
|
224
|
+
| `theme.light` | string | `'default'` | Used for light color mode and the manual `setMermaidTheme('light')` strategy. |
|
|
225
|
+
| `theme.dark` | string | `'dark'` | Used for dark color mode and the manual `setMermaidTheme('dark')` strategy. |
|
|
160
226
|
|
|
161
227
|
**components**
|
|
162
228
|
|
|
163
|
-
| Option | Type | Default
|
|
164
|
-
| :------------------------ | :------- |
|
|
165
|
-
| `components.renderer` | `string` |
|
|
166
|
-
| `components.spinner` | `string` |
|
|
167
|
-
| `components.error` | `string` |
|
|
229
|
+
| Option | Type | Default | Description |
|
|
230
|
+
| :------------------------ | :------- | :------ | :----------------------------------------------------------------------- |
|
|
231
|
+
| `components.renderer` | `string` | omitted | Optional: custom Mermaid renderer component name. |
|
|
232
|
+
| `components.spinner` | `string` | omitted | Optional: global loading spinner component name. |
|
|
233
|
+
| `components.error` | `string` | omitted | Optional: global error component name when Mermaid rendering fails. |
|
|
168
234
|
|
|
169
235
|
**toolbar**
|
|
170
236
|
|
|
@@ -207,7 +273,11 @@ A zoom toolbar appears with +/−/Reset buttons and a percentage display.
|
|
|
207
273
|
Use `toolbar.fullscreenToolbarScale` to scale the fullscreen toolbar and zoom controls.
|
|
208
274
|
|
|
209
275
|
|
|
210
|
-
> **Note**:
|
|
276
|
+
> **Note**: `contentMermaid.enabled` controls Module Activation during Nuxt setup. Setting it to `false` disables only the Mermaid Content/runtime integration; it does not disable Nuxt Content. It is never a public runtime setting. `runtimeConfig.public.contentMermaid` carries only strict pure data and is resolved once during each Nuxt application initialization; mutating it later does not update the established Runtime Mermaid Snapshot.
|
|
277
|
+
|
|
278
|
+
## Migrating to v3
|
|
279
|
+
|
|
280
|
+
The [v3 migration guide](./docs/en/MIGRATION_V3.md) covers the removed configuration alias, build-time activation, pure-data runtime transport, Page versus Direct Mermaid Config, Property-Presence Merge, expand reset semantics, and public diagnostic and rendering guarantees. A runnable companion is available at `/migration` in the playground.
|
|
211
281
|
|
|
212
282
|
## Styling (CSS Variables)
|
|
213
283
|
|
|
@@ -264,7 +334,7 @@ Variables:
|
|
|
264
334
|
- **Runtime behavior**:
|
|
265
335
|
- **Debug on**: `mermaid.run` uses `suppressErrors: false`, errors throw with full stack traces for debugging.
|
|
266
336
|
- **Debug off**: `mermaid.run` uses `suppressErrors: true`, so one failing chart won't block others.
|
|
267
|
-
- **Console output**:
|
|
337
|
+
- **Console output**: Debug log wording and internal render scheduling are not public APIs. For configuration failures, recognize the documented public fingerprint instead of parsing private details.
|
|
268
338
|
|
|
269
339
|
### Theme & Color Mode
|
|
270
340
|
|
|
@@ -275,8 +345,7 @@ The module determines the active Mermaid theme with the following priority:
|
|
|
275
345
|
3. `@nuxtjs/color-mode` (auto-detected when installed):
|
|
276
346
|
- `dark` → `theme.dark`
|
|
277
347
|
- `light` → `theme.light`
|
|
278
|
-
4. `loader.init.theme` (
|
|
279
|
-
5. Fallback: `theme.light`, then Mermaid default `'default'`
|
|
348
|
+
4. Resolved `loader.init.theme` (package default: `'default'`)
|
|
280
349
|
|
|
281
350
|
For advanced manual control (e.g., forcing specific themes, custom toggle logic), please refer to the [Manual Theme Control Guide](./docs/en/MANUAL_THEME_CONTROL.md).
|
|
282
351
|
|
|
@@ -394,12 +463,15 @@ graph TD
|
|
|
394
463
|
|
|
395
464
|
If you want full control over rendering (for example to add a border, expand controls, or other UI), you can provide a custom component via `components.renderer`.
|
|
396
465
|
|
|
466
|
+
The configured name is a candidate until its component resolves. Built-in rendering remains paused during resolution. If the component cannot be found or loaded, the module falls back to the Built-in Renderer. Once resolution succeeds, the Custom Renderer completely owns rendering; its later mount or render failures do not trigger Built-in fallback.
|
|
467
|
+
|
|
397
468
|
1. Specify the component name in `nuxt.config.ts`:
|
|
398
469
|
|
|
399
470
|
```ts
|
|
400
471
|
contentMermaid: {
|
|
401
472
|
components: {
|
|
402
473
|
renderer: "MyCustomMermaid",
|
|
474
|
+
spinner: "MySpinner", // optional input for your component
|
|
403
475
|
},
|
|
404
476
|
}
|
|
405
477
|
```
|
|
@@ -408,60 +480,60 @@ If you want full control over rendering (for example to add a border, expand con
|
|
|
408
480
|
|
|
409
481
|
```vue
|
|
410
482
|
<script setup lang="ts">
|
|
411
|
-
|
|
483
|
+
import { onMounted, ref, shallowRef, useId } from 'vue'
|
|
484
|
+
import type { Component } from 'vue'
|
|
485
|
+
|
|
486
|
+
const props = defineProps<{
|
|
487
|
+
code?: string
|
|
488
|
+
spinner: Component | string
|
|
489
|
+
}>()
|
|
490
|
+
|
|
491
|
+
const loading = ref(true)
|
|
492
|
+
const error = shallowRef<unknown>()
|
|
493
|
+
const svg = ref('')
|
|
494
|
+
const renderId = `custom-mermaid-${useId().replaceAll(':', '')}`
|
|
495
|
+
|
|
496
|
+
onMounted(async () => {
|
|
497
|
+
try {
|
|
498
|
+
const mermaid = await useNuxtApp().$mermaid()
|
|
499
|
+
svg.value = (await mermaid.render(renderId, props.code ?? '')).svg
|
|
500
|
+
}
|
|
501
|
+
catch (cause) {
|
|
502
|
+
error.value = cause
|
|
503
|
+
}
|
|
504
|
+
finally {
|
|
505
|
+
loading.value = false
|
|
506
|
+
}
|
|
507
|
+
})
|
|
412
508
|
</script>
|
|
413
509
|
|
|
414
510
|
<template>
|
|
415
511
|
<div class="custom-wrapper border rounded p-4">
|
|
416
|
-
<
|
|
417
|
-
|
|
418
|
-
|
|
512
|
+
<component
|
|
513
|
+
:is="props.spinner"
|
|
514
|
+
v-if="loading"
|
|
515
|
+
/>
|
|
516
|
+
<p
|
|
517
|
+
v-else-if="error"
|
|
518
|
+
role="alert"
|
|
519
|
+
>
|
|
520
|
+
Diagram failed: {{ error instanceof Error ? error.message : String(error) }}
|
|
521
|
+
</p>
|
|
522
|
+
<div
|
|
523
|
+
v-else
|
|
524
|
+
v-html="svg"
|
|
525
|
+
/>
|
|
419
526
|
</div>
|
|
420
527
|
</template>
|
|
421
528
|
```
|
|
422
529
|
|
|
423
|
-
|
|
530
|
+
The Custom Renderer receives the existing `code`, default slot, and `spinner` inputs. It does not receive Built-in configuration, theme, toolbar, loading, or error state. `components.error` handles only Built-in Mermaid render failures, so a Custom Renderer must own its error presentation as shown above.
|
|
424
531
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
Minimal example that uses the provided spinner while waiting for your own loading logic:
|
|
428
|
-
|
|
429
|
-
```ts
|
|
430
|
-
// nuxt.config.ts
|
|
431
|
-
export default defineNuxtConfig({
|
|
432
|
-
contentMermaid: {
|
|
433
|
-
components: {
|
|
434
|
-
renderer: 'MyCustomMermaid',
|
|
435
|
-
spinner: 'MySpinner', // optional: globally replace the default spinner
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
})
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
```vue
|
|
442
|
-
<!-- components/MyCustomMermaid.vue -->
|
|
443
|
-
<script setup lang="ts">
|
|
444
|
-
import { ref, onMounted } from 'vue'
|
|
445
|
-
import type { Component } from 'vue'
|
|
446
|
-
|
|
447
|
-
const props = defineProps<{ spinner: Component | string }>()
|
|
448
|
-
const loading = ref(true)
|
|
449
|
-
onMounted(() => { loading.value = false })
|
|
450
|
-
</script>
|
|
451
|
-
|
|
452
|
-
<template>
|
|
453
|
-
<div class="my-mermaid">
|
|
454
|
-
<component v-if="loading" :is="props.spinner" />
|
|
455
|
-
<Mermaid v-else>
|
|
456
|
-
<slot />
|
|
457
|
-
</Mermaid>
|
|
458
|
-
</div>
|
|
459
|
-
</template>
|
|
460
|
-
```
|
|
532
|
+
Do not render `<Mermaid>` from the component currently configured as `components.renderer`: that nested component would select the same Custom Renderer again. Invoke `$mermaid`, another rendering library, or your own renderer directly instead.
|
|
461
533
|
|
|
462
534
|
### Wrapper Example
|
|
463
535
|
|
|
464
|
-
|
|
536
|
+
Independently of `components.renderer`, you can wrap `<Mermaid>` inside your own Vue component. Do not configure that wrapper itself as the Custom Renderer.
|
|
465
537
|
For example, you can bundle a title, loading state, and error/fallback UI, then drop it anywhere in templates:
|
|
466
538
|
|
|
467
539
|
```vue
|
|
@@ -531,16 +603,44 @@ export default defineNuxtConfig({
|
|
|
531
603
|
},
|
|
532
604
|
})
|
|
533
605
|
```
|
|
606
|
+
|
|
607
|
+
## Compatibility
|
|
608
|
+
|
|
609
|
+
The public peer contract supports Nuxt `^4.1.0` and Nuxt Content `>=3.5.0 <4.0.0`. Releases verify two fixed package artifact profiles: `v3-minimum` at the public floors and `v3-known-latest` at the deliberately pinned known-latest versions. Both profiles cover clean installation, public types, production build, and basic browser SVG rendering under their exact Node runtimes.
|
|
610
|
+
|
|
611
|
+
These profiles are evidence for the complete peer range, not a list of the only supported versions. If a profile fails, the resolution is to diagnose and fix the compatibility boundary—not to remove that profile or weaken its Package User assertions.
|
|
612
|
+
|
|
613
|
+
Run each profile under its exact Node runtime:
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
volta run --node 22.19.0 pnpm test:compatibility-profile --profile v3-minimum
|
|
617
|
+
volta run --node 24.19.0 pnpm test:package-artifact
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
## Support
|
|
621
|
+
|
|
622
|
+
If this module is useful to you, you can [support my open-source work on Ko-fi](https://ko-fi.com/barzhsieh). Your support helps fund maintenance, compatibility updates, testing, and documentation.
|
|
623
|
+
|
|
534
624
|
## Contribution
|
|
535
625
|
|
|
626
|
+
Contributions are welcome! Feel free to open an [issue](https://github.com/andy820621/nuxt-content-mermaid/issues) or submit a pull request.
|
|
627
|
+
|
|
628
|
+
Maintainers should follow the [stable release runbook](./docs/en/RELEASING.md).
|
|
629
|
+
|
|
630
|
+
- Commit messages should follow [Conventional Commits](https://www.conventionalcommits.org/) (e.g. `feat: add spinner option`, `fix: handle dark mode toggle`).
|
|
631
|
+
- PRs should include a summary of changes and test results.
|
|
632
|
+
|
|
536
633
|
<details>
|
|
537
634
|
<summary>Local Development Commands</summary>
|
|
538
635
|
|
|
539
636
|
```bash
|
|
540
|
-
pnpm install
|
|
541
|
-
pnpm dev:prepare
|
|
542
|
-
pnpm dev
|
|
543
|
-
pnpm test
|
|
637
|
+
pnpm install # Install dependencies
|
|
638
|
+
pnpm dev:prepare # Build module stubs & prepare playground
|
|
639
|
+
pnpm dev # Start playground
|
|
640
|
+
pnpm test # Run tests
|
|
641
|
+
pnpm test:package-artifact # Verify the known-latest package artifact profile
|
|
642
|
+
pnpm lint # Run ESLint
|
|
643
|
+
pnpm test:types # Type checking
|
|
544
644
|
```
|
|
545
645
|
|
|
546
646
|
</details>
|