@primeui-devkit/markdown-core 0.1.0-rc.2 → 0.1.0-rc.3

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
@@ -1,92 +1,18 @@
1
1
  # @primeui-devkit/markdown-core
2
2
 
3
- Framework-agnostic markdown engine. Parses markdown with component directives
4
- (`::name{props}`) into a serializable AST that every `*-markdown` renderer consumes.
3
+ Framework-agnostic markdown engine: parses markdown with component directives into a serializable tree that every renderer consumes, plus highlighting, search and llms.txt helpers.
5
4
 
6
- ```ts
7
- import { createDocsParser } from '@primeui-devkit/markdown-core/preset';
8
-
9
- const parse = createDocsParser(); // headings + toc + alert + binding
10
- const tree = await parse('# Hello\n\n::demo-viewer{name="basic"}\n::');
11
- // the tree is plain JSON — cacheable, serializable, consumable by any renderer
12
- ```
13
-
14
- Parsing is asynchronous — plugins may load resources — so the result has to be awaited
15
- before any of the tree helpers below will accept it.
16
-
17
- Lower-level API: `createMarkdownParser`, `parseMarkdown`, `defineMarkdownPlugin`.
18
- Optional plugins as subpaths: `./plugins/{headings,toc,highlight,alert,binding}`
19
- (highlight needs the optional `shiki` peer).
20
-
21
- Types: `MarkdownTree`, `MarkdownNode`, `MarkdownElement`, `MarkdownPlugin`, `MarkdownParser`.
22
-
23
- ## Syntax highlighting
24
-
25
- The preset deliberately leaves highlighting out. A highlighter is heavy and not every page
26
- needs one, so it ships as an optional peer:
5
+ ## Install
27
6
 
28
7
  ```bash
29
- pnpm add shiki
8
+ pnpm add @primeui-devkit/markdown-core
30
9
  ```
31
10
 
32
- Install it before importing `./plugins/highlight`. Without it that import fails while the
33
- module is still loading, with `Cannot find package 'shiki'` raised from inside the parsing
34
- backend — the message names neither this package nor the missing peer, and no `try` around
35
- the import can catch it.
36
-
37
- Highlighting is asynchronous, so it runs as its own step after parsing rather than inside
38
- it:
11
+ ## Use
39
12
 
40
13
  ```ts
41
14
  import { createDocsParser } from '@primeui-devkit/markdown-core/preset';
42
- import { highlightTree } from '@primeui-devkit/markdown-core/plugins/highlight';
43
15
 
44
16
  const parse = createDocsParser();
45
- const tree = await highlightTree(await parse(source));
46
- ```
47
-
48
- Both themes are emitted at once, so a page switches between light and dark without
49
- highlighting anything again.
50
-
51
- Passing a theme name the backend does not know produces unhighlighted output without
52
- reporting anything, so `highlightTree` checks names first and throws with the list of what
53
- is available — `availableThemes()` returns the same list.
54
-
55
- ```ts
56
- await highlightTree(tree, { themes: { light: 'material-theme-lighter', dark: 'material-theme-palenight' } });
57
- ```
58
-
59
- A theme the backend does not ship is passed as a definition instead of a name. `languages`
60
- preloads grammars, which keeps a build to the ones it uses rather than loading every one on
61
- demand, and `transformers` is where line markers such as `[!code highlight]` come from.
62
-
63
- ```ts
64
- import { transformerNotationHighlight } from '@shikijs/transformers';
65
-
66
- await highlightTree(tree, {
67
- themes: { light: (await import('shiki/themes/github-light.mjs')).default, dark: 'material-theme-palenight' },
68
- languages: [(await import('shiki/langs/vue.mjs')).default],
69
- transformers: [transformerNotationHighlight()]
70
- });
71
- ```
72
-
73
- `@primeui-devkit/highlighter` is a separate package for highlighting a standalone snippet
74
- to HTML. Neither depends on the other: this one works on a parsed tree, that one on a
75
- string, and a repository takes whichever it needs.
76
-
77
- ## Content utilities
78
-
79
- Parser-free subpaths for tooling and pipelines — usable in Node scripts, build
80
- steps, and browsers without pulling the engine in:
81
-
82
- - `./tree` — `tocFromTree`, `titleFromTree`, `descriptionFromTree`, `walkTree`, `textOf`, `headingSections`, node helpers (`isElement`, `tagOf`, `propsOf`, `childrenOf`)
83
- - `./search` — `buildSearchIndex(pages)` → heading-level `SearchDocument[]` (feed a local search, Algolia, or an agent) and `searchDocuments(index, query)` — a dependency-free scorer for docs-sized corpora
84
- - `./llms` — `renderLlmsIndex`, `renderLlmsFull`, `rawMarkdownFiles` for llms.txt pipelines
85
-
86
- ```ts
87
- import { buildSearchIndex } from '@primeui-devkit/markdown-core/search';
88
- import { renderLlmsIndex } from '@primeui-devkit/markdown-core/llms';
89
-
90
- const index = buildSearchIndex(pages.map((p) => ({ route: p.route, tree: p.tree })));
91
- const llms = renderLlmsIndex(pages, { title: 'Docs', siteUrl: 'https://docs.example.dev' });
17
+ const tree = await parse('# Hello\n\n::demo-viewer{name="basic"}\n::');
92
18
  ```
@@ -5,11 +5,11 @@ Each is provided under its own license, reproduced below.
5
5
 
6
6
  ---
7
7
 
8
- ## comark
8
+ ## comark 0.5.1
9
9
 
10
10
  Copyright (c) 2026 Comark team and contributors
11
11
 
12
- The markdown parsing engine used by this package (https://github.com/comarkdown/comark).
12
+ https://comark.dev
13
13
 
14
14
  Licensed under the MIT License.
15
15
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{autoCloseMarkdown,createParse as createMarkdownParser,defineComarkPlugin as defineMarkdownPlugin,parseFrontmatter,parse as parseMarkdown}from'comark';export{pascalCase,resolveAttributes}from'comark/utils';function u(e){return e?.meta?.toc?.links??[]}function f(e){return String(e?.frontmatter?.title??e?.meta?.title??"")}function l(e){return String(e?.frontmatter?.description??"")}function a(e){return Array.isArray(e)}function d(e){return e[0]}function m(e){return e[1]??{}}function s(e){return e.slice(2)}function w(e,t){let n=(r,o)=>{if(!(t(r,o)===false||!a(r)))for(let k of s(r))n(k,r);};for(let r of e.nodes??[])n(r,null);}function i(e){return typeof e=="string"?e:Array.isArray(e)&&typeof e[0]!="string"?e.map(t=>i(t)).join(""):a(e)?s(e).map(t=>i(t)).join(""):""}var c=new Set(["h1","h2","h3","h4","h5","h6"]);function p(e){let t=[],n={id:"",heading:"",depth:0,text:""};for(let r of e.nodes??[]){if(a(r)&&c.has(d(r))){(n.text.trim()||n.heading)&&t.push(n),n={id:String(m(r).id??""),heading:i(r),depth:Number(d(r).slice(1)),text:""};continue}if(a(r)&&d(r)==="pre")continue;let o=i(r).trim();o&&(n.text+=(n.text?" ":"")+o);}return (n.text.trim()||n.heading)&&t.push(n),t}export{s as childrenOf,l as descriptionFromTree,p as headingSections,a as isElement,m as propsOf,d as tagOf,i as textOf,f as titleFromTree,u as tocFromTree,w 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{autoCloseMarkdown as u,createParse as d,defineComarkPlugin as f,parse as p,parseFrontmatter as m}from"comark";import{pascalCase as h,resolveAttributes as g}from"comark/utils";export{u as autoCloseMarkdown,e as childrenOf,d as createMarkdownParser,f as defineMarkdownPlugin,t as descriptionFromTree,n as headingSections,r as isElement,m as parseFrontmatter,p as parseMarkdown,h as pascalCase,i as propsOf,g as resolveAttributes,a as tagOf,o as textOf,s as titleFromTree,c as tocFromTree,l as walkTree};
package/dist/llms.d.ts CHANGED
@@ -42,4 +42,5 @@ declare function rawMarkdownFiles(pages: LlmsPage[], options?: {
42
42
  transform?: (page: LlmsPage) => string;
43
43
  }): Array<[string, string]>;
44
44
 
45
- export { type LlmsFullOptions, type LlmsIndexOptions, type LlmsPage, pageTitle, rawMarkdownFiles, renderLlmsFull, renderLlmsIndex };
45
+ export { pageTitle, rawMarkdownFiles, renderLlmsFull, renderLlmsIndex };
46
+ export type { LlmsFullOptions, LlmsIndexOptions, LlmsPage };
package/dist/llms.js CHANGED
@@ -1,9 +1,4 @@
1
- function i(t){return t.title??t.markdown.match(/^#\s+(.+)$/m)?.[1]??t.route}function l(t,r){let e=t.route.replace(/^\//,"");return r.linkTarget==="raw"?`${r.siteUrl}/raw/${e}.md`:`${r.siteUrl}/${e}`}function a(t,r){return [`# ${r.title}`,"",`> ${r.description??""}`,"",`## ${r.heading??"Documentation"}`,...t.map(n=>`- [${i(n)}](${l(n,r)})${n.description?`: ${n.description}`:""}`)].join(`
2
- `)}function m(t,r){return [`# ${r.title}`,"",`> ${r.description??""}`,"",...t.map(n=>{let s=r.transform?r.transform(n):n.markdown.trim();return `## ${i(n)}
1
+ function e(e){return e.title??e.markdown.replace(/```[\s\S]*?```/g,``).match(/^#\s+(.+)$/m)?.[1]??e.route}function t(e,t){let n=e.route.replace(/^\//,``);return t.linkTarget===`raw`?`${t.siteUrl}/raw/${n}.md`:`${t.siteUrl}/${n}`}function n(n,r){return[`# ${r.title}`,``,`> ${r.description??``}`,``,`## ${r.heading??`Documentation`}`,...n.map(n=>`- [${e(n)}](${t(n,r)})${n.description?`: ${n.description}`:``}`)].join(`
2
+ `)}function r(t,n){return[`# ${n.title}`,``,`> ${n.description??``}`,``,...t.map(t=>{let r=n.transform?n.transform(t):t.markdown.trim();return`## ${e(t)}\n\n${t.description?`${t.description}\n\n`:``}${r}`})].join(`
3
3
 
4
- ${n.description?`${n.description}
5
-
6
- `:""}${s}`})].join(`
7
-
8
- `)}function o(t,r){return t.map(e=>[e.route.replace(/^\//,""),r?.transform?r.transform(e):e.markdown])}
9
- export{i as pageTitle,o as rawMarkdownFiles,m as renderLlmsFull,a as renderLlmsIndex};
4
+ `)}function i(e,t){return e.map(e=>[e.route.replace(/^\//,``),t?.transform?t.transform(e):e.markdown])}export{e as pageTitle,i as rawMarkdownFiles,r as renderLlmsFull,n as renderLlmsIndex};
@@ -1 +1 @@
1
- export*from'comark/plugins/alert';export{default}from'comark/plugins/alert';
1
+ import e from"comark/plugins/alert";export*from"comark/plugins/alert";export{e as default};
@@ -1 +1 @@
1
- export*from'comark/plugins/binding';export{default}from'comark/plugins/binding';
1
+ import e from"comark/plugins/binding";export*from"comark/plugins/binding";export{e as default};
@@ -1 +1 @@
1
- export*from'comark/plugins/headings';export{default}from'comark/plugins/headings';
1
+ import e from"comark/plugins/headings";export*from"comark/plugins/headings";export{e as default};
@@ -89,4 +89,5 @@ declare function highlightTree(tree: ComarkTree, options?: HighlightOptions): Pr
89
89
  */
90
90
  declare function highlight(options?: HighlightOptions): ComarkPlugin<any, any>;
91
91
 
92
- export { type HighlightLanguage, type HighlightOptions, type HighlightTheme, type HighlightTransformer, availableThemes, highlight as default, defaultThemes, highlightTree };
92
+ export { availableThemes, highlight as default, defaultThemes, highlightTree };
93
+ export type { HighlightLanguage, HighlightOptions, HighlightTheme, HighlightTransformer };
@@ -1 +1 @@
1
- import l,{getHighlighter,highlightCodeBlocks}from'comark/plugins/highlight';var c=e=>e?[e.light,e.dark].filter(t=>typeof t=="string"):[],y={light:"material-theme-lighter",dark:"material-theme-palenight"};async function d(){return (await getHighlighter()).getLoadedThemes?.()??[]}async function T(e,t={}){let{themes:i,languages:n,transformers:r,inlineStyles:s=false}=t,g=c(i);if(g.length>0){let h=await d(),a=g.filter(o=>!h.includes(o));if(a.length>0)throw new Error(`Unknown theme${a.length>1?"s":""}: ${a.join(", ")}. Available: ${h.join(", ")}.`)}return await highlightCodeBlocks(e,{...i?{themes:i}:{},...n?{languages:n}:{},...r?{transformers:r}:{},preStyles:s})}function f(e={}){let{themes:t,languages:i,transformers:n,inlineStyles:r=false}=e;return l({...t?{themes:t}:{},...i?{languages:i}:{},...n?{transformers:n}:{},preStyles:r})}export{d as availableThemes,f as default,y as defaultThemes,T as highlightTree};
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 +1 @@
1
- export*from'comark/plugins/toc';export{default}from'comark/plugins/toc';
1
+ import e from"comark/plugins/toc";export*from"comark/plugins/toc";export{e as default};
package/dist/preset.d.ts CHANGED
@@ -29,4 +29,5 @@ interface DocsParserOptions {
29
29
  */
30
30
  declare function createDocsParser(options?: DocsParserOptions): ComarkParseFn<any, any>;
31
31
 
32
- export { type DocsParserOptions, type ParserPassthrough, createDocsParser };
32
+ export { createDocsParser };
33
+ export type { DocsParserOptions, ParserPassthrough };
package/dist/preset.js CHANGED
@@ -1 +1 @@
1
- import {createParse}from'comark';import e from'comark/plugins/alert';import o from'comark/plugins/binding';import s from'comark/plugins/headings';import i from'comark/plugins/toc';function g(r={}){let a=[];return r.headings!==false&&a.push(s()),r.toc!==false&&a.push(i()),r.alert!==false&&a.push(e()),r.binding!==false&&a.push(o()),r.plugins&&a.push(...r.plugins),createParse({...r.parse,plugins:a})}export{g as createDocsParser};
1
+ import{createParse as e}from"comark";import t from"comark/plugins/alert";import n from"comark/plugins/binding";import r from"comark/plugins/headings";import i from"comark/plugins/toc";function a(a={}){let o=[];return a.headings!==!1&&o.push(r()),a.toc!==!1&&o.push(i()),a.alert!==!1&&o.push(t()),a.binding!==!1&&o.push(n()),a.plugins&&o.push(...a.plugins),e({...a.parse,plugins:o})}export{a as createDocsParser};
package/dist/prose.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  declare const PROSE_COMPONENTS: readonly ["ProseA", "ProseBlockquote", "ProseCode", "ProseEm", "ProseH1", "ProseH2", "ProseH3", "ProseH4", "ProseH5", "ProseH6", "ProseHr", "ProseImg", "ProseLi", "ProseOl", "ProseP", "ProsePre", "ProseStrong", "ProseTable", "ProseTbody", "ProseTd", "ProseTh", "ProseThead", "ProseTr", "ProseUl"];
2
2
  type ProseComponentName = (typeof PROSE_COMPONENTS)[number];
3
3
 
4
- export { PROSE_COMPONENTS, type ProseComponentName };
4
+ export { PROSE_COMPONENTS };
5
+ export type { ProseComponentName };
package/dist/prose.js CHANGED
@@ -1 +1 @@
1
- var e=["ProseA","ProseBlockquote","ProseCode","ProseEm","ProseH1","ProseH2","ProseH3","ProseH4","ProseH5","ProseH6","ProseHr","ProseImg","ProseLi","ProseOl","ProseP","ProsePre","ProseStrong","ProseTable","ProseTbody","ProseTd","ProseTh","ProseThead","ProseTr","ProseUl"];export{e as PROSE_COMPONENTS};
1
+ const e=[`ProseA`,`ProseBlockquote`,`ProseCode`,`ProseEm`,`ProseH1`,`ProseH2`,`ProseH3`,`ProseH4`,`ProseH5`,`ProseH6`,`ProseHr`,`ProseImg`,`ProseLi`,`ProseOl`,`ProseP`,`ProsePre`,`ProseStrong`,`ProseTable`,`ProseTbody`,`ProseTd`,`ProseTh`,`ProseThead`,`ProseTr`,`ProseUl`];export{e as PROSE_COMPONENTS};
package/dist/search.d.ts CHANGED
@@ -27,4 +27,5 @@ declare function buildSearchIndex(pages: SearchPage[]): SearchDocument[];
27
27
  */
28
28
  declare function searchDocuments(index: SearchDocument[], query: string, limit?: number): SearchDocument[];
29
29
 
30
- export { type SearchDocument, type SearchPage, buildSearchIndex, searchDocuments };
30
+ export { buildSearchIndex, searchDocuments };
31
+ export type { SearchDocument, SearchPage };
package/dist/search.js CHANGED
@@ -1 +1 @@
1
- function g(e){return String(e?.frontmatter?.title??e?.meta?.title??"")}function u(e){return Array.isArray(e)}function d(e){return e[0]}function k(e){return e[1]??{}}function w(e){return e.slice(2)}function s(e){return typeof e=="string"?e:Array.isArray(e)&&typeof e[0]!="string"?e.map(o=>s(o)).join(""):u(e)?w(e).map(o=>s(o)).join(""):""}var x=new Set(["h1","h2","h3","h4","h5","h6"]);function l(e){let o=[],n={id:"",heading:"",depth:0,text:""};for(let t of e.nodes??[]){if(u(t)&&x.has(d(t))){(n.text.trim()||n.heading)&&o.push(n),n={id:String(k(t).id??""),heading:s(t),depth:Number(d(t).slice(1)),text:""};continue}if(u(t)&&d(t)==="pre")continue;let i=s(t).trim();i&&(n.text+=(n.text?" ":"")+i);}return (n.text.trim()||n.heading)&&o.push(n),o}function T(e){let o=[];for(let{route:n,tree:t}of e){let i=g(t);for(let r of l(t))o.push({url:r.id?`${n}#${r.id}`:n,route:n,page:i,heading:r.heading||i,text:r.text});}return o}function N(e,o,n=10){let t=o.toLowerCase().split(/\s+/).filter(Boolean);if(!t.length)return [];let i=[];for(let r of e){let c=(r.page+" "+r.heading).toLowerCase(),p=r.text.toLowerCase(),a=0;for(let f of t){let m=c.includes(f),h=p.includes(f);if(!m&&!h){a=0;break}a+=m?5:1;}a>0&&i.push({doc:r,score:a});}return i.sort((r,c)=>c.score-r.score).slice(0,n).map(r=>r.doc)}export{T as buildSearchIndex,N as searchDocuments};
1
+ import{headingSections as e,titleFromTree as t}from"./tree.js";function n(n){let r=[];for(let{route:i,tree:a}of n){let n=t(a);for(let t of e(a))r.push({url:t.id?`${i}#${t.id}`:i,route:i,page:n,heading:t.heading||n,text:t.text})}return r}function r(e,t,n=10){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(!r.length)return[];let i=[];for(let t of e){let e=(t.page+` `+t.heading).toLowerCase(),n=t.text.toLowerCase(),a=0;for(let t of r){let r=e.includes(t),i=n.includes(t);if(!r&&!i){a=0;break}a+=r?5:1}a>0&&i.push({doc:t,score:a})}return i.sort((e,t)=>t.score-e.score).slice(0,n).map(e=>e.doc)}export{n as buildSearchIndex,r as searchDocuments};
package/dist/tree.d.ts CHANGED
@@ -41,4 +41,5 @@ interface HeadingSection {
41
41
  */
42
42
  declare function headingSections(tree: ComarkTree): HeadingSection[];
43
43
 
44
- export { type HeadingSection, type TocItem, childrenOf, descriptionFromTree, headingSections, isElement, propsOf, tagOf, textOf, titleFromTree, tocFromTree, walkTree };
44
+ export { childrenOf, descriptionFromTree, headingSections, isElement, propsOf, tagOf, textOf, titleFromTree, tocFromTree, walkTree };
45
+ export type { HeadingSection, TocItem };
package/dist/tree.js CHANGED
@@ -1 +1 @@
1
- function l(e){return e?.meta?.toc?.links??[]}function k(e){return String(e?.frontmatter?.title??e?.meta?.title??"")}function m(e){return String(e?.frontmatter?.description??"")}function i(e){return Array.isArray(e)}function d(e){return e[0]}function u(e){return e[1]??{}}function s(e){return e.slice(2)}function w(e,r){let t=(n,o)=>{if(!(r(n,o)===false||!i(n)))for(let c of s(n))t(c,n);};for(let n of e.nodes??[])t(n,null);}function a(e){return typeof e=="string"?e:Array.isArray(e)&&typeof e[0]!="string"?e.map(r=>a(r)).join(""):i(e)?s(e).map(r=>a(r)).join(""):""}var f=new Set(["h1","h2","h3","h4","h5","h6"]);function p(e){let r=[],t={id:"",heading:"",depth:0,text:""};for(let n of e.nodes??[]){if(i(n)&&f.has(d(n))){(t.text.trim()||t.heading)&&r.push(t),t={id:String(u(n).id??""),heading:a(n),depth:Number(d(n).slice(1)),text:""};continue}if(i(n)&&d(n)==="pre")continue;let o=a(n).trim();o&&(t.text+=(t.text?" ":"")+o);}return (t.text.trim()||t.heading)&&r.push(t),r}export{s as childrenOf,m as descriptionFromTree,p as headingSections,i as isElement,u as propsOf,d as tagOf,a as textOf,k as titleFromTree,l as tocFromTree,w as walkTree};
1
+ function e(e){return e?.meta?.toc?.links??[]}function t(e){return String(e?.frontmatter?.title??e?.meta?.title??``)}function n(e){return String(e?.frontmatter?.description??``)}function r(e){return Array.isArray(e)}function i(e){return e[0]}function a(e){return e[1]??{}}function o(e){return e.slice(2)}function s(e,t){let n=(e,i)=>{if(t(e,i)!==!1&&r(e))for(let t of o(e))n(t,e)};for(let t of e.nodes??[])n(t,null)}function c(e){return typeof e==`string`?e:Array.isArray(e)&&e[0]===null?``:Array.isArray(e)&&typeof e[0]!=`string`?e.map(e=>c(e)).join(``):r(e)?o(e).map(e=>c(e)).join(``):``}const l=/* @__PURE__ */ new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);function u(e){let t=[],n={id:``,heading:``,depth:0,text:``};for(let o of e.nodes??[]){if(r(o)&&l.has(i(o))){(n.text.trim()||n.heading)&&t.push(n),n={id:String(a(o).id??``),heading:c(o),depth:Number(i(o).slice(1)),text:``};continue}if(r(o)&&i(o)===`pre`)continue;let e=c(o).trim();e&&(n.text+=(n.text?` `:``)+e)}return(n.text.trim()||n.heading)&&t.push(n),t}export{o as childrenOf,n as descriptionFromTree,u as headingSections,r as isElement,a as propsOf,i as tagOf,c as textOf,t as titleFromTree,e as tocFromTree,s as walkTree};
package/package.json CHANGED
@@ -1,57 +1,56 @@
1
1
  {
2
2
  "name": "@primeui-devkit/markdown-core",
3
- "version": "0.1.0-rc.2",
4
- "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.",
3
+ "version": "0.1.0-rc.3",
5
4
  "author": "PrimeTek Informatics",
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",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/primefaces/primeui-devkit.git",
10
+ "directory": "packages/markdown/markdown-core"
11
+ },
7
12
  "bugs": {
8
13
  "url": "https://support.primeui.dev"
9
14
  },
10
15
  "type": "module",
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
11
19
  "exports": {
12
20
  ".": {
13
21
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js"
22
+ "import": "./dist/index.js",
23
+ "default": "./dist/index.js"
15
24
  },
16
25
  "./preset": {
17
26
  "types": "./dist/preset.d.ts",
18
- "import": "./dist/preset.js"
27
+ "import": "./dist/preset.js",
28
+ "default": "./dist/preset.js"
19
29
  },
20
30
  "./tree": {
21
31
  "types": "./dist/tree.d.ts",
22
- "import": "./dist/tree.js"
32
+ "import": "./dist/tree.js",
33
+ "default": "./dist/tree.js"
23
34
  },
24
35
  "./search": {
25
36
  "types": "./dist/search.d.ts",
26
- "import": "./dist/search.js"
37
+ "import": "./dist/search.js",
38
+ "default": "./dist/search.js"
27
39
  },
28
40
  "./llms": {
29
41
  "types": "./dist/llms.d.ts",
30
- "import": "./dist/llms.js"
42
+ "import": "./dist/llms.js",
43
+ "default": "./dist/llms.js"
31
44
  },
32
45
  "./prose": {
33
46
  "types": "./dist/prose.d.ts",
34
- "import": "./dist/prose.js"
35
- },
36
- "./plugins/headings": {
37
- "types": "./dist/plugins/headings.d.ts",
38
- "import": "./dist/plugins/headings.js"
47
+ "import": "./dist/prose.js",
48
+ "default": "./dist/prose.js"
39
49
  },
40
- "./plugins/toc": {
41
- "types": "./dist/plugins/toc.d.ts",
42
- "import": "./dist/plugins/toc.js"
43
- },
44
- "./plugins/highlight": {
45
- "types": "./dist/plugins/highlight.d.ts",
46
- "import": "./dist/plugins/highlight.js"
47
- },
48
- "./plugins/alert": {
49
- "types": "./dist/plugins/alert.d.ts",
50
- "import": "./dist/plugins/alert.js"
51
- },
52
- "./plugins/binding": {
53
- "types": "./dist/plugins/binding.d.ts",
54
- "import": "./dist/plugins/binding.js"
50
+ "./plugins/*": {
51
+ "types": "./dist/plugins/*.d.ts",
52
+ "import": "./dist/plugins/*.js",
53
+ "default": "./dist/plugins/*.js"
55
54
  },
56
55
  "./package.json": "./package.json"
57
56
  },
@@ -72,32 +71,21 @@
72
71
  "prose": [
73
72
  "./dist/prose.d.ts"
74
73
  ],
75
- "plugins/headings": [
76
- "./dist/plugins/headings.d.ts"
77
- ],
78
- "plugins/toc": [
79
- "./dist/plugins/toc.d.ts"
80
- ],
81
- "plugins/highlight": [
82
- "./dist/plugins/highlight.d.ts"
83
- ],
84
- "plugins/alert": [
85
- "./dist/plugins/alert.d.ts"
86
- ],
87
- "plugins/binding": [
88
- "./dist/plugins/binding.d.ts"
74
+ "plugins/*": [
75
+ "./dist/plugins/*.d.ts"
89
76
  ]
90
77
  }
91
78
  },
92
- "types": "./dist/index.d.ts",
93
- "module": "./dist/index.js",
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "sideEffects": false,
94
83
  "files": [
95
84
  "dist",
96
85
  "LICENSE.md",
97
86
  "THIRD-PARTY-NOTICES.txt",
98
87
  "README.md"
99
88
  ],
100
- "sideEffects": false,
101
89
  "dependencies": {
102
90
  "comark": "^0.5.1"
103
91
  },
@@ -112,19 +100,19 @@
112
100
  "devDependencies": {
113
101
  "@shikijs/transformers": "^4.4.2",
114
102
  "cross-env": "^10.1.0",
115
- "tsup": "^8.5.1",
116
103
  "typescript": "~6.0.0",
117
- "vitest": "4.1.10",
118
- "@primeui-devkit/test-config": "0.0.0",
119
- "@primeui-devkit/ts-config": "0.0.0",
120
- "@primeui-devkit/bundler": "0.0.0"
104
+ "vitest": "4.1.11",
105
+ "@primeui-devkit/bundle": "0.1.0-rc.1",
106
+ "@primeui-devkit/cli": "0.1.0-rc.1",
107
+ "@primeui-devkit/test-config": "0.1.0-rc.1",
108
+ "@primeui-devkit/ts-config": "0.1.0-rc.1"
121
109
  },
122
- "publishConfig": {
123
- "access": "public"
110
+ "engines": {
111
+ "node": ">=22.18.0"
124
112
  },
125
113
  "scripts": {
126
114
  "build": "pnpm run build:package",
127
- "build:package": "pnpm run test && tsup",
115
+ "build:package": "pnpm run test && devkit bundle build",
128
116
  "type:check": "tsc --noEmit",
129
117
  "test": "cross-env NODE_ENV=test vitest run",
130
118
  "test:watch": "vitest --watch",