@primeui-devkit/markdown-core 0.1.0-rc.4 → 0.1.0-rc.5

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { ComarkElement as MarkdownElement, ComarkNode as MarkdownNode, ParseOptions as MarkdownParseOptions, ComarkParseFn as MarkdownParser, ComarkPlugin as MarkdownPlugin, NodeRenderData as MarkdownRenderData, ComarkTree as MarkdownTree, autoCloseMarkdown, createParse as createMarkdownParser, defineComarkPlugin as defineMarkdownPlugin, parseFrontmatter, parse as parseMarkdown } from 'comark';
1
+ export { ElementNode as MarkdownElement, Node as MarkdownNode, ParserOptions as MarkdownParseOptions, ComarkParseFn as MarkdownParser, ComarkPlugin as MarkdownPlugin, NodeRenderData as MarkdownRenderData, MarkdownDocument as MarkdownTree, autoCloseMarkdown, createMarkdownParser, defineComarkPlugin as defineMarkdownPlugin, parseFrontmatter, parseMarkdown } from 'comark';
2
2
  export { pascalCase, resolveAttributes } from 'comark/utils';
3
3
  export { HeadingSection, TocItem, childrenOf, descriptionFromTree, headingSections, isElement, propsOf, tagOf, textOf, titleFromTree, tocFromTree, walkTree } from './tree.js';
4
4
  export { SanitizeOptions, componentMap, defaultAllowedProtocols, defaultBlockedTags, isPrototypeKey, isSafeAttribute, sanitizeOptions, sanitizeTree } from './plugins/sanitize.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{childrenOf as e,descriptionFromTree as t,headingSections as n,isElement as r,propsOf as i,tagOf as a,textOf as o,titleFromTree as s,tocFromTree as c,walkTree as l}from"./tree.js";import{componentMap as u,defaultAllowedProtocols as d,defaultBlockedTags as f,isPrototypeKey as p,isSafeAttribute as m,sanitizeOptions as h,sanitizeTree as g}from"./plugins/sanitize.js";import{autoCloseMarkdown as _,createParse as v,defineComarkPlugin as y,parse as b,parseFrontmatter as x}from"comark";import{pascalCase as S,resolveAttributes as C}from"comark/utils";export{_ as autoCloseMarkdown,e as childrenOf,u as componentMap,v as createMarkdownParser,d as defaultAllowedProtocols,f as defaultBlockedTags,y as defineMarkdownPlugin,t as descriptionFromTree,n as headingSections,r as isElement,p as isPrototypeKey,m as isSafeAttribute,x as parseFrontmatter,b as parseMarkdown,S as pascalCase,i as propsOf,C as resolveAttributes,h as sanitizeOptions,g as sanitizeTree,a as tagOf,o as textOf,s as titleFromTree,c as tocFromTree,l as walkTree};
1
+ import{childrenOf as e,descriptionFromTree as t,headingSections as n,isElement as r,propsOf as i,tagOf as a,textOf as o,titleFromTree as s,tocFromTree as c,walkTree as l}from"./tree.js";import{componentMap as u,defaultAllowedProtocols as d,defaultBlockedTags as f,isPrototypeKey as p,isSafeAttribute as m,sanitizeOptions as h,sanitizeTree as g}from"./plugins/sanitize.js";import{autoCloseMarkdown as _,createMarkdownParser as v,defineComarkPlugin as y,parseFrontmatter as b,parseMarkdown as x}from"comark";import{pascalCase as S,resolveAttributes as C}from"comark/utils";export{_ as autoCloseMarkdown,e as childrenOf,u as componentMap,v as createMarkdownParser,d as defaultAllowedProtocols,f as defaultBlockedTags,y as defineMarkdownPlugin,t as descriptionFromTree,n as headingSections,r as isElement,p as isPrototypeKey,m as isSafeAttribute,b as parseFrontmatter,x as parseMarkdown,S as pascalCase,i as propsOf,C as resolveAttributes,h as sanitizeOptions,g as sanitizeTree,a as tagOf,o as textOf,s as titleFromTree,c as tocFromTree,l as walkTree};
@@ -1,4 +1,4 @@
1
- import { ComarkPlugin, ComarkTree } from 'comark';
1
+ import { ComarkPlugin, MarkdownDocument } from 'comark';
2
2
 
3
3
  /** A theme name, or a definition as a `shiki/themes/*` module default-exports. */
4
4
  type HighlightTheme = string | (object & {
@@ -40,7 +40,7 @@ declare function availableThemes(): Promise<string[]>;
40
40
  * const tree = await highlightTree(await parse(source));
41
41
  * ```
42
42
  */
43
- declare function highlightTree(tree: ComarkTree, options?: HighlightOptions): Promise<ComarkTree>;
43
+ declare function highlightTree(tree: MarkdownDocument, options?: HighlightOptions): Promise<MarkdownDocument>;
44
44
  /** Parser plugin form: tokenises every block while parsing. {@link highlightTree} does the same for a tree parsed earlier or cached. */
45
45
  declare function highlight(options?: HighlightOptions): ComarkPlugin<any, any>;
46
46
 
@@ -1 +1 @@
1
- import e,{getHighlighter as t,highlightCodeBlocks as n}from"comark/plugins/highlight";import{bundledThemes as r}from"shiki";const i=e=>e?[e.light,e.dark].filter(e=>typeof e==`string`):[],a={light:`material-theme-lighter`,dark:`material-theme-palenight`};async function o(){let e=await t();return[.../* @__PURE__ */ new Set([...Object.keys(r),...e.getLoadedThemes?.()??[]])]}async function s(e,t={}){let{themes:r,languages:a,transformers:s,inlineStyles:c=!1}=t,l=i(r);if(l.length>0){let e=await o(),t=l.filter(t=>!e.includes(t));if(t.length>0)throw Error(`Unknown theme${t.length>1?`s`:``}: ${t.join(`, `)}. Available: ${e.join(`, `)}.`)}return await n(e,{...r?{themes:r}:{},...a?{languages:a}:{},...s?{transformers:s}:{},preStyles:c})}function c(t={}){let{themes:n,languages:r,transformers:i,inlineStyles:a=!1}=t;return e({...n?{themes:n}:{},...r?{languages:r}:{},...i?{transformers:i}:{},preStyles:a})}export{o as availableThemes,c as default,a as defaultThemes,s as highlightTree};
1
+ import e,{getHighlighter as t,highlightCodeBlocks as n}from"comark/plugins/shiki";import{bundledThemes as r}from"shiki";const i=e=>e?[e.light,e.dark].filter(e=>typeof e==`string`):[],a={light:`material-theme-lighter`,dark:`material-theme-palenight`};async function o(){let e=await t();return[.../* @__PURE__ */ new Set([...Object.keys(r),...e.getLoadedThemes?.()??[]])]}async function s(e,t={}){let{themes:r,languages:a,transformers:s,inlineStyles:c=!1}=t,l=i(r);if(l.length>0){let e=await o(),t=l.filter(t=>!e.includes(t));if(t.length>0)throw Error(`Unknown theme${t.length>1?`s`:``}: ${t.join(`, `)}. Available: ${e.join(`, `)}.`)}return await n(e,{...r?{themes:r}:{},...a?{languages:a}:{},...s?{transformers:s}:{},preStyles:c})}function c(t={}){let{themes:n,languages:r,transformers:i,inlineStyles:a=!1}=t;return e({...n?{themes:n}:{},...r?{languages:r}:{},...i?{transformers:i}:{},preStyles:a})}export{o as availableThemes,c as default,a as defaultThemes,s as highlightTree};
@@ -1,5 +1,5 @@
1
1
  import * as comark from 'comark';
2
- import { ComarkNode } from 'comark';
2
+ import { Node } from 'comark';
3
3
 
4
4
  interface SanitizeOptions {
5
5
  /** Tags removed with everything inside them, added to the default list. */
@@ -25,7 +25,7 @@ declare function isPrototypeKey(name: string): boolean;
25
25
  declare function isSafeAttribute(tag: string, key: string, value: unknown, options?: SanitizeOptions): boolean;
26
26
  /** A copy of the tree with what would run script, submit a form, restyle the page or swap in another component removed; for a tree that did not come through the plugin. */
27
27
  declare function sanitizeTree<T extends {
28
- nodes: ComarkNode[];
28
+ nodes: Node[];
29
29
  }>(tree: T, options?: SanitizeOptions): T;
30
30
  /** The `sanitize` option every renderer takes, as options to pass on, or `false` when it is off. Unset means on. */
31
31
  declare function sanitizeOptions(setting: boolean | SanitizeOptions | undefined): SanitizeOptions | false;
package/dist/preset.js CHANGED
@@ -1 +1 @@
1
- import e,{sanitizeOptions as t}from"./plugins/sanitize.js";import{createParse as n}from"comark";import r from"comark/plugins/alert";import i from"comark/plugins/binding";import a from"comark/plugins/headings";import o from"comark/plugins/toc";function s(s={}){let c=[];s.headings!==!1&&c.push(a()),s.toc!==!1&&c.push(o()),s.alert!==!1&&c.push(r()),s.binding!==!1&&c.push(i()),s.plugins&&c.push(...s.plugins);let l=t(s.sanitize);return l&&c.push(e(l)),n({...s.parse,plugins:c})}export{s as createDocsParser};
1
+ import e,{sanitizeOptions as t}from"./plugins/sanitize.js";import{createMarkdownParser as n}from"comark";import r from"comark/plugins/alert";import i from"comark/plugins/binding";import a from"comark/plugins/headings";import o from"comark/plugins/toc";function s(s={}){let c=[];s.headings!==!1&&c.push(a()),s.toc!==!1&&c.push(o()),s.alert!==!1&&c.push(r()),s.binding!==!1&&c.push(i()),s.plugins&&c.push(...s.plugins);let l=t(s.sanitize);return l&&c.push(e(l)),n({...s.parse,plugins:c})}export{s as createDocsParser};
package/dist/search.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ComarkTree } from 'comark';
1
+ import { MarkdownDocument } from 'comark';
2
2
 
3
3
  interface SearchPage {
4
4
  /** Route of the page, e.g. '/charts/animation'. */
5
5
  route: string;
6
- tree: ComarkTree;
6
+ tree: MarkdownDocument;
7
7
  }
8
8
  interface SearchDocument {
9
9
  /** Route plus anchor, e.g. '/charts/animation#easing'. */
package/dist/tree.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ComarkElement, ComarkNode, ComarkTree } from 'comark';
1
+ import { ElementNode, Node, MarkdownDocument } from 'comark';
2
2
 
3
3
  interface TocItem {
4
4
  id: string;
@@ -7,19 +7,19 @@ interface TocItem {
7
7
  children?: TocItem[];
8
8
  }
9
9
  /** Table of contents produced by the toc plugin, normalized to a plain array. */
10
- declare function tocFromTree(tree: ComarkTree | null | undefined): TocItem[];
10
+ declare function tocFromTree(tree: MarkdownDocument | null | undefined): TocItem[];
11
11
  /** Page title: frontmatter wins, then the title the parser derived from the first heading. */
12
- declare function titleFromTree(tree: ComarkTree | null | undefined): string;
12
+ declare function titleFromTree(tree: MarkdownDocument | null | undefined): string;
13
13
  /** Page description from frontmatter, when present. */
14
- declare function descriptionFromTree(tree: ComarkTree | null | undefined): string;
15
- declare function isElement(node: ComarkNode): node is ComarkElement;
16
- declare function tagOf(node: ComarkElement): string;
17
- declare function propsOf(node: ComarkElement): Record<string, unknown>;
18
- declare function childrenOf(node: ComarkElement): ComarkNode[];
14
+ declare function descriptionFromTree(tree: MarkdownDocument | null | undefined): string;
15
+ declare function isElement(node: Node): node is ElementNode;
16
+ declare function tagOf(node: ElementNode): string;
17
+ declare function propsOf(node: ElementNode): Record<string, unknown>;
18
+ declare function childrenOf(node: ElementNode): Node[];
19
19
  /** Depth-first walk; return `false` from the visitor to skip a node's children. */
20
- declare function walkTree(tree: ComarkTree, visit: (node: ComarkNode, parent: ComarkElement | null) => void | boolean): void;
20
+ declare function walkTree(tree: MarkdownDocument, visit: (node: Node, parent: ElementNode | null) => void | boolean): void;
21
21
  /** Plain-text content of a node or node list, markup stripped. */
22
- declare function textOf(node: ComarkNode | ComarkNode[]): string;
22
+ declare function textOf(node: Node | Node[]): string;
23
23
  interface HeadingSection {
24
24
  /** Heading id (anchor target); empty for content before the first heading. */
25
25
  id: string;
@@ -31,7 +31,7 @@ interface HeadingSection {
31
31
  text: string;
32
32
  }
33
33
  /** Splits a page into heading-anchored plain-text sections, code blocks excluded. */
34
- declare function headingSections(tree: ComarkTree): HeadingSection[];
34
+ declare function headingSections(tree: MarkdownDocument): HeadingSection[];
35
35
 
36
36
  export { childrenOf, descriptionFromTree, headingSections, isElement, propsOf, tagOf, textOf, titleFromTree, tocFromTree, walkTree };
37
37
  export type { HeadingSection, TocItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primeui-devkit/markdown-core",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0-rc.5",
4
4
  "author": "PrimeTek Informatics",
5
5
  "description": "Framework-agnostic markdown engine. Parses markdown with component directives into a serializable tree consumed by the framework renderers. The parsing backend is an internal implementation detail.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -87,7 +87,7 @@
87
87
  "README.md"
88
88
  ],
89
89
  "dependencies": {
90
- "comark": "^0.5.1"
90
+ "comark": "0.7.0"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "shiki": "^4.4.2"
@@ -104,8 +104,8 @@
104
104
  "vitest": "4.1.11",
105
105
  "@primeui-devkit/bundle": "0.1.0-rc.2",
106
106
  "@primeui-devkit/cli": "0.1.0-rc.2",
107
- "@primeui-devkit/ts-config": "0.1.0-rc.2",
108
- "@primeui-devkit/test-config": "0.1.0-rc.2"
107
+ "@primeui-devkit/test-config": "0.1.0-rc.2",
108
+ "@primeui-devkit/ts-config": "0.1.0-rc.2"
109
109
  },
110
110
  "engines": {
111
111
  "node": ">=22.18.0"