@grandaniel/vue-markdown-editor 1.1.3-dev.bc50199 → 1.1.3-dev.df4d480

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 CHANGED
@@ -204,6 +204,64 @@ Returns a reactive editor instance:
204
204
  | `TextishNodeType` | Type — union of `PARAGRAPH \| HEADLINE1 \| HEADLINE2 \| HEADLINE3 \| LIST`. |
205
205
  | `isTextNodeState(node)` | Type guard for text‑based nodes. |
206
206
  | `isTextNodeType(type)` | Type guard for text‑based node types. |
207
+ | `MarkdownRenderer` | Component — renders Markdown to plain HTML. SSR‑safe. |
208
+
209
+ ---
210
+
211
+ ## MarkdownRenderer
212
+
213
+ `<MarkdownRenderer>` converts a Markdown string to plain HTML. It uses the same `remark-parse` pipeline as the editor, so custom module blocks (like `"""MarkdownModuleImage"""`) render as rich `<figure>` elements automatically.
214
+
215
+ The renderer is **SSR‑safe** — no browser APIs, no TipTap. It works in `nuxt generate`, `vite-ssg`, and any server‑side rendering context.
216
+
217
+ ```vue
218
+ <script setup lang="ts">
219
+ import { MarkdownRenderer } from "@grandaniel/vue-markdown-editor";
220
+
221
+ const markdown = `# Hello World
222
+
223
+ This is a **paragraph** with *inline* formatting.
224
+
225
+ - List item 1
226
+ - List item 2
227
+
228
+ """MarkdownModuleImage
229
+ src: https://example.com/photo.jpg
230
+ alt: A scenic view
231
+ caption: Photo caption
232
+ """
233
+ `;
234
+ </script>
235
+
236
+ <template>
237
+ <MarkdownRenderer :markdown="markdown" />
238
+ </template>
239
+ ```
240
+
241
+ ### Live preview alongside the editor
242
+
243
+ Bind the editor's reactive `markdownContent` to the renderer:
244
+
245
+ ```vue
246
+ <script setup lang="ts">
247
+ import { MarkdownEditor, MarkdownRenderer, useMarkdownEditor } from "@grandaniel/vue-markdown-editor";
248
+
249
+ const editor = useMarkdownEditor("# Start writing…");
250
+ </script>
251
+
252
+ <template>
253
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
254
+ <MarkdownEditor :editor="editor" />
255
+ <MarkdownRenderer :markdown="editor.markdownContent.value" />
256
+ </div>
257
+ </template>
258
+ ```
259
+
260
+ ### Props
261
+
262
+ | Prop | Type | Required | Description |
263
+ |---|---|---|---|
264
+ | `markdown` | `string` | ✓ | Raw Markdown string to render as HTML. |
207
265
 
208
266
  ---
209
267
 
@@ -0,0 +1,2 @@
1
+ import type { MarkdownAstNode } from "../Types/MarkdownAstNode";
2
+ export declare function parseMarkdown(markdown: string): MarkdownAstNode[];
@@ -0,0 +1,2 @@
1
+ import type { MarkdownAstNode } from "../Types/MarkdownAstNode";
2
+ export declare function serializeMarkdown(nodes: MarkdownAstNode[]): string;
@@ -0,0 +1,7 @@
1
+ import type { Component } from "vue";
2
+ import MarkdownNodeType from "../MarkdownEditor/Types/MarkdownAstNodeType";
3
+ type RenderComponent = Component<{
4
+ state: any;
5
+ }>;
6
+ declare const RenderComponentRegistry: Record<MarkdownNodeType, RenderComponent>;
7
+ export default RenderComponentRegistry;
@@ -0,0 +1,13 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ markdown: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
+ markdown: {
8
+ type: StringConstructor;
9
+ required: true;
10
+ };
11
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleTextState from "../../MarkdownEditor/Modules/MarkdownModuleTextState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleTextState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleTextState from "../../MarkdownEditor/Modules/MarkdownModuleTextState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleTextState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleTextState from "../../MarkdownEditor/Modules/MarkdownModuleTextState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleTextState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleImageState from "../../MarkdownEditor/Modules/MarkdownModuleImageState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleImageState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleListState from "../../MarkdownEditor/Modules/MarkdownModuleListState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleListState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type MarkdownModuleTextState from "../../MarkdownEditor/Modules/MarkdownModuleTextState";
2
+ type __VLS_Props = {
3
+ state: MarkdownModuleTextState;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as MarkdownRenderer } from "./MarkdownRenderer.vue";
2
+ export { default as RenderComponentRegistry } from "./MarkdownRenderComponentRegistry";
@@ -1 +1,2 @@
1
1
  export * from './MarkdownEditor/';
2
+ export * from './MarkdownRenderer/';