@sit-onyx/comark 0.2.0 → 0.3.0-dev-20261009105419

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
@@ -10,8 +10,8 @@ Render markdown content with [onyx](https://onyx.schwarz/) components.
10
10
 
11
11
  It's a wrapper for the [@comark/vue](https://www.npmjs.com/package/@comark/vue) package using the onyx design system created by [Schwarz Digits](https://schwarz-digits.de).
12
12
 
13
- For runtime parsing and rendering of markdown use the [`OnyxComark`](#onyxcomark) component.
14
- Otherwise use the [`OnyxComarkRenderer`](#onyxcomarkrenderer) for server and build-time parsing with less client code required.
13
+ For runtime parsing and rendering of markdown use the [`OnyxMarkdown`](#onyxmarkdown) component.
14
+ Otherwise use the [`OnyxMarkdownDocument`](#onyxmarkdowndocument) for server and build-time parsing with less client code required.
15
15
 
16
16
  ## Getting Started
17
17
 
@@ -31,7 +31,7 @@ Import the CSS file, either globally or in a single component:
31
31
  import "@sit-onyx/comark/style.css";
32
32
  ```
33
33
 
34
- ## `OnyxComark`
34
+ ## `OnyxMarkdown`
35
35
 
36
36
  Simple runtime parser and renderer component for markdown.
37
37
  Just pass your markdown string:
@@ -39,7 +39,7 @@ Just pass your markdown string:
39
39
  ```vue
40
40
  <!-- App.vue -->
41
41
  <script setup lang="ts">
42
- import { OnyxComark } from "@sit-onyx/comark";
42
+ import { OnyxMarkdown } from "@sit-onyx/comark";
43
43
 
44
44
  const content = `# Hello World
45
45
 
@@ -50,29 +50,28 @@ This is **markdown** with Comark components.
50
50
  <template>
51
51
  <!-- It is required to wrap OnyxComark in a Suspense block! -->
52
52
  <Suspense>
53
- <OnyxComark>{{ content }}</OnyxComark>
53
+ <OnyxMarkdown>{{ content }}</OnyxMarkdown>
54
54
  </Suspense>
55
55
  </template>
56
56
  ```
57
57
 
58
- For more details check the [documentation for the `Comark` component](https://comark.dev/rendering/vue#code-comark).
58
+ For more details check the [documentation for the `Markdown` component](https://comark.dev/rendering/vue#markdown).
59
59
 
60
60
  ## `OnyxComarkRenderer`
61
61
 
62
- Renders a pre-parsed ComarkTree without any parsing. Use it when you parse on the server, in a build step, or via an API, so no parser or plugin code is shipped to the browser.
62
+ Renders a pre-parsed MarkdownDocument without any parsing. Use it when you parse on the server, in a build step, or via an API, so no parser or plugin code is shipped to the browser.
63
63
 
64
64
  ### 1. Parse on the server/buildtime
65
65
 
66
66
  ```ts
67
- // server.ts
68
-
69
- import { createParse } from "comark";
70
67
  import { readFile } from "node:fs/promises";
68
+ // server.ts
69
+ import { createMarkdownParser } from "comark";
71
70
 
72
- const parse = createParse();
71
+ const parse = createMarkdownParser();
73
72
 
74
73
  // In your server handler
75
- export async function getContentTree(slug: string) {
74
+ export async function getContentDocument(slug: string) {
76
75
  const markdown = await readFile(`content/${slug}.md`, "utf-8");
77
76
  return parse(markdown);
78
77
  }
@@ -83,14 +82,15 @@ export async function getContentTree(slug: string) {
83
82
  ```vue
84
83
  <!-- ContentPage.vue -->
85
84
  <script setup lang="ts">
86
- import { OnyxComarkRenderer } from "@sit-onyx/comark";
85
+ import { OnyxMarkdownDocument } from "@sit-onyx/comark";
86
+
87
87
  const { slug } = defineProps<{ slug: string }>();
88
88
 
89
89
  const res = await fetch(`/api/content/${slug}`);
90
- const tree = await res.json();
90
+ const document = await res.json();
91
91
  </script>
92
92
 
93
93
  <template>
94
- <OnyxComarkRenderer :tree="tree" />
94
+ <OnyxMarkdownDocument :value="document" />
95
95
  </template>
96
96
  ```
@@ -0,0 +1 @@
1
+ [{"exportName":"OnyxMarkdownDocument","displayName":"OnyxMarkdownDocument","type":1,"props":[{"name":"value","global":false,"description":"The parsed Comark document to render — either a full `MarkdownDocument` or a bare\n`Node[]`. When a node array is passed, frontmatter and meta\ndefault to `{}` and runtime data should be supplied via `data`.","tags":[],"required":false,"type":"MarkdownDocument<Record<string, any>, Record<string, any>> | { nodes: Node[]; } | undefined","schema":{"kind":"enum","type":"MarkdownDocument<Record<string, any>, Record<string, any>> | { nodes: Node[]; } | undefined","schema":["undefined","MarkdownDocument<Record<string, any>, Record<string, any>>","{ nodes: Node[]; }"]},"declarations":[]},{"name":"components","global":false,"description":"Custom component mappings for element tags","tags":[],"required":false,"type":"Record<string, any> | undefined","schema":{"kind":"enum","type":"Record<string, any> | undefined","schema":["undefined","Record<string, any>"]},"declarations":[]},{"name":"componentsManifest","global":false,"description":"Dynamic component resolver function","tags":[],"required":false,"type":"ComponentManifest | undefined","schema":{"kind":"enum","type":"ComponentManifest | undefined","schema":["undefined","ComponentManifest"]},"declarations":[]},{"name":"streaming","global":false,"description":"Enable streaming mode with enhanced components","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"caret","global":false,"description":"If caret is true, a caret will be appended to the document's last text node","tags":[],"required":false,"type":"boolean | { class: string; } | undefined","schema":{"kind":"enum","type":"boolean | { class: string; } | undefined","schema":["undefined","false","true","{ class: string; }"]},"declarations":[]},{"name":"data","global":false,"description":"Additional data to pass to the renderer","tags":[],"required":false,"type":"Record<string, unknown> | undefined","schema":{"kind":"enum","type":"Record<string, unknown> | undefined","schema":["undefined","Record<string, unknown>"]},"declarations":[]},{"name":"documentKey","global":false,"description":"Document key. When set and `globalThis.comarkContext` exists, the renderer\nsubscribes to live updates for this key (HMR, devtools, collab, agents) and\nre-renders with the pushed document. No-op otherwise.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"OnyxMarkdown","displayName":"OnyxMarkdown","type":1,"props":[{"name":"value","global":false,"description":"The markdown content to parse and render, or a pre-parsed MarkdownDocument","tags":[],"required":false,"type":"string | MarkdownDocument<Record<string, any>, Record<string, any>> | undefined","schema":{"kind":"enum","type":"string | MarkdownDocument<Record<string, any>, Record<string, any>> | undefined","schema":["undefined","string","MarkdownDocument<Record<string, any>, Record<string, any>>"]},"declarations":[]},{"name":"options","global":false,"description":"Parser options (excluding plugins)","tags":[],"required":false,"type":"Omit<ParserOptions<readonly ComarkPlugin<any, any>[]>, \"plugins\"> | undefined","schema":{"kind":"enum","type":"Omit<ParserOptions<readonly ComarkPlugin<any, any>[]>, \"plugins\"> | undefined","schema":["undefined","Omit<ParserOptions<readonly ComarkPlugin<any, any>[]>, \"plugins\">"]},"declarations":[]},{"name":"plugins","global":false,"description":"Additional plugins to use","tags":[],"required":false,"type":"readonly ComarkPlugin<any, any>[] | undefined","schema":{"kind":"enum","type":"readonly ComarkPlugin<any, any>[] | undefined","schema":["undefined","readonly ComarkPlugin<any, any>[]"]},"declarations":[]},{"name":"unwrap","global":false,"description":"Strip wrapper tags from the top level of the document — shorthand for\n`options.unwrap`. `true` unwraps `<p>` (single-line rendering); a\nspace-separated string or array unwraps the listed tags. Useful for inline\nusage like `<UButton><Markdown :value=\"text\" unwrap /></UButton>`.","tags":[],"required":false,"type":"string | boolean | string[] | undefined","schema":{"kind":"enum","type":"string | boolean | string[] | undefined","schema":["undefined","string","false","true","string[]"]},"declarations":[]},{"name":"components","global":false,"description":"Custom component mappings for element tags","tags":[],"required":false,"type":"Record<string, any> | undefined","schema":{"kind":"enum","type":"Record<string, any> | undefined","schema":["undefined","Record<string, any>"]},"declarations":[]},{"name":"componentsManifest","global":false,"description":"Dynamic component resolver function","tags":[],"required":false,"type":"ComponentManifest | undefined","schema":{"kind":"enum","type":"ComponentManifest | undefined","schema":["undefined","ComponentManifest"]},"declarations":[]},{"name":"streaming","global":false,"description":"Enable streaming mode with stream-specific components","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"summary","global":false,"description":"If document has a <!-- more --> comment, only render the content before the comment","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"caret","global":false,"description":"If caret is true, a caret will be appended to the document's last text node","tags":[],"required":false,"type":"boolean | { class: string; } | undefined","schema":{"kind":"enum","type":"boolean | { class: string; } | undefined","schema":["undefined","false","true","{ class: string; }"]},"declarations":[]},{"name":"data","global":false,"description":"Additional data to pass to the renderer","tags":[],"required":false,"type":"Record<string, unknown> | undefined","schema":{"kind":"enum","type":"Record<string, unknown> | undefined","schema":["undefined","Record<string, unknown>"]},"declarations":[]},{"name":"documentKey","global":false,"description":"Document key used to subscribe to live updates via `globalThis.comarkContext`","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"ProseH1","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseA","type":1,"props":[{"name":"href","global":false,"default":"\"\"","description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"target","global":false,"description":"","tags":[],"required":false,"type":"\"_self\" | \"_blank\" | \"_parent\" | \"_top\" | undefined","schema":{"kind":"enum","type":"\"_self\" | \"_blank\" | \"_parent\" | \"_top\" | undefined","schema":["undefined","\"_self\"","\"_blank\"","\"_parent\"","\"_top\""]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseH4","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseHr","type":1,"props":[],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"ProseBr","type":1,"props":[],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"ProseCode","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseH6","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseOl","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseH2","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseTbody","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProsePre","type":1,"props":[{"name":"language","global":false,"description":"Code language","tags":[{"name":"example","text":" js, ts, html, css, etc."}],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"filename","global":false,"description":"Filename.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"highlights","global":false,"description":"Highlighted code line numbers.","tags":[],"required":false,"type":"number[] | undefined","schema":{"kind":"enum","type":"number[] | undefined","schema":["undefined","number[]"]},"declarations":[]},{"name":"meta","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"Renderer code snippet.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseImg","type":1,"props":[{"name":"src","global":false,"default":"\"\"","description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"alt","global":false,"default":"\"\"","description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"width","global":false,"description":"","tags":[],"required":false,"type":"string | number | undefined","schema":{"kind":"enum","type":"string | number | undefined","schema":["undefined","string","number"]},"declarations":[]},{"name":"height","global":false,"description":"","tags":[],"required":false,"type":"string | number | undefined","schema":{"kind":"enum","type":"string | number | undefined","schema":["undefined","string","number"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"ProseSummary","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseTable","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseThead","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseP","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseH5","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseUl","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseDetails","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ProseH3","type":1,"props":[{"name":"id","global":false,"description":"","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"","tags":[],"schema":"any","declarations":[]}],"exposed":[]}]
@@ -374,5 +374,3 @@ export declare const components: {
374
374
  alt: string;
375
375
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
376
376
  };
377
- export declare const OnyxMarkdown: import('vue').DefineComponent<import('@comark/vue').MarkdownProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('@comark/vue').MarkdownProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
378
- export declare const OnyxMarkdownDocument: import('vue').DefineComponent<import('@comark/vue').MarkdownDocumentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('@comark/vue').MarkdownDocumentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1 @@
1
+ export declare const OnyxMarkdownDocument: import('vue').DefineComponent<import('@comark/vue').MarkdownDocumentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('@comark/vue').MarkdownDocumentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1 @@
1
+ export declare const OnyxMarkdown: import('vue').DefineComponent<import('@comark/vue').MarkdownProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('@comark/vue').MarkdownProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
package/dist/index.d.ts CHANGED
@@ -18,4 +18,5 @@ export { default as ProseTable } from './components/prose/ProseTable.vue';
18
18
  export { default as ProseTbody } from './components/prose/ProseTbody.vue';
19
19
  export { default as ProseThead } from './components/prose/ProseThead.vue';
20
20
  export { default as ProseUl } from './components/prose/ProseUl.vue';
21
- export { OnyxMarkdown, OnyxMarkdownDocument } from './components/comark.js';
21
+ export * from './components/markdown.js';
22
+ export * from './components/markdown-document.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/comark",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-dev-20261009105419",
4
4
  "description": "Wrapper for the comark package using the onyx design system created by Schwarz Digits",
5
5
  "bugs": {
6
6
  "url": "https://github.com/SchwarzIT/onyx/issues"
@@ -24,24 +24,26 @@
24
24
  "node": "./dist/index.js",
25
25
  "default": "./dist/index.js"
26
26
  },
27
- "./style.css": "./dist/style.css"
27
+ "./style.css": "./dist/style.css",
28
+ "./component-meta.json": "./dist/component-meta.json"
28
29
  },
29
30
  "devDependencies": {
30
- "@comark/vue": "^0.6.2",
31
+ "@comark/vue": "^0.7.0",
31
32
  "@playwright/experimental-ct-vue": "1.62.1",
32
33
  "@playwright/test": "1.62.1",
33
- "@vue/compiler-dom": "3.5.41",
34
- "unplugin-dts": "1.0.3",
35
- "vite": "8.2.1",
36
- "vue": "3.5.41",
37
34
  "@sit-onyx/playwright-utils": "^1.3.0",
38
35
  "@sit-onyx/shared": "^0.1.0",
39
- "sit-onyx": "^1.19.0"
36
+ "@sit-onyx/vite-plugin-component-meta": "^0.0.0",
37
+ "@vue/compiler-dom": "3.5.43",
38
+ "sit-onyx": "^1.21.1-dev-20261009105419",
39
+ "unplugin-dts": "1.1.2",
40
+ "vite": "8.3.2",
41
+ "vue": "3.5.43"
40
42
  },
41
43
  "peerDependencies": {
42
44
  "@comark/vue": ">= 0.6.0",
43
- "vue": ">= 3.5.0",
44
- "sit-onyx": "^1.19.0"
45
+ "sit-onyx": "^1.21.1-dev-20261009105419",
46
+ "vue": ">= 3.5.0"
45
47
  },
46
48
  "engines": {
47
49
  "node": ">=20"