@primeui-devkit/markdown-core 0.1.0-rc.2 → 0.1.0-rc.4
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 +5 -79
- package/THIRD-PARTY-NOTICES.txt +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/llms.d.ts +7 -10
- package/dist/llms.js +3 -8
- package/dist/plugins/alert.js +1 -1
- package/dist/plugins/binding.js +1 -1
- package/dist/plugins/headings.js +1 -1
- package/dist/plugins/highlight.d.ts +8 -52
- package/dist/plugins/highlight.js +1 -1
- package/dist/plugins/sanitize.d.ts +43 -0
- package/dist/plugins/sanitize.js +1 -0
- package/dist/plugins/toc.js +1 -1
- package/dist/preset.d.ts +8 -14
- package/dist/preset.js +1 -1
- package/dist/prose.d.ts +2 -1
- package/dist/prose.js +1 -1
- package/dist/search.d.ts +4 -12
- package/dist/search.js +1 -1
- package/dist/tree.d.ts +5 -12
- package/dist/tree.js +1 -1
- package/package.json +40 -52
package/README.md
CHANGED
|
@@ -1,92 +1,18 @@
|
|
|
1
1
|
# @primeui-devkit/markdown-core
|
|
2
2
|
|
|
3
|
-
Framework-agnostic markdown engine
|
|
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
|
-
|
|
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
|
|
8
|
+
pnpm add @primeui-devkit/markdown-core
|
|
30
9
|
```
|
|
31
10
|
|
|
32
|
-
|
|
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
|
|
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
|
```
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -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
|
-
|
|
12
|
+
https://comark.dev
|
|
13
13
|
|
|
14
14
|
Licensed under the MIT License.
|
|
15
15
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
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';
|
|
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
|
+
export { SanitizeOptions, componentMap, defaultAllowedProtocols, defaultBlockedTags, isPrototypeKey, isSafeAttribute, sanitizeOptions, sanitizeTree } from './plugins/sanitize.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +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};
|
package/dist/llms.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ interface LlmsPage {
|
|
|
3
3
|
route: string;
|
|
4
4
|
/** Raw markdown source of the page. */
|
|
5
5
|
markdown: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Explicit title; defaults to the first `# ` heading. */
|
|
7
7
|
title?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** One-line description, appended to index links and full sections. */
|
|
9
9
|
description?: string;
|
|
10
10
|
}
|
|
11
11
|
interface LlmsIndexOptions {
|
|
@@ -15,11 +15,7 @@ interface LlmsIndexOptions {
|
|
|
15
15
|
description?: string;
|
|
16
16
|
/** Absolute origin used in links, e.g. 'https://vue.example.dev'. */
|
|
17
17
|
siteUrl: string;
|
|
18
|
-
/**
|
|
19
|
-
* How each link points at a page, given its route:
|
|
20
|
-
* - 'page' (default): `${siteUrl}/${route}`
|
|
21
|
-
* - 'raw': `${siteUrl}/raw/${route}.md`
|
|
22
|
-
*/
|
|
18
|
+
/** Link target: 'page' (default) is `${siteUrl}/${route}`, 'raw' is `${siteUrl}/raw/${route}.md`. */
|
|
23
19
|
linkTarget?: 'page' | 'raw';
|
|
24
20
|
/** Heading above the link list. @default 'Documentation' */
|
|
25
21
|
heading?: string;
|
|
@@ -33,13 +29,14 @@ interface LlmsFullOptions {
|
|
|
33
29
|
transform?: (page: LlmsPage) => string;
|
|
34
30
|
}
|
|
35
31
|
declare function pageTitle(page: LlmsPage): string;
|
|
36
|
-
/** llms.txt
|
|
32
|
+
/** Renders llms.txt: site summary plus one link per page. */
|
|
37
33
|
declare function renderLlmsIndex(pages: LlmsPage[], options: LlmsIndexOptions): string;
|
|
38
|
-
/** llms-full.txt
|
|
34
|
+
/** Renders llms-full.txt: every page's markdown in one document. */
|
|
39
35
|
declare function renderLlmsFull(pages: LlmsPage[], options: LlmsFullOptions): string;
|
|
40
36
|
/** File plan for the raw markdown mirror: [route, content]. */
|
|
41
37
|
declare function rawMarkdownFiles(pages: LlmsPage[], options?: {
|
|
42
38
|
transform?: (page: LlmsPage) => string;
|
|
43
39
|
}): Array<[string, string]>;
|
|
44
40
|
|
|
45
|
-
export {
|
|
41
|
+
export { pageTitle, rawMarkdownFiles, renderLlmsFull, renderLlmsIndex };
|
|
42
|
+
export type { LlmsFullOptions, LlmsIndexOptions, LlmsPage };
|
package/dist/llms.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)}function
|
|
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
|
-
|
|
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};
|
package/dist/plugins/alert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import e from"comark/plugins/alert";export*from"comark/plugins/alert";export{e as default};
|
package/dist/plugins/binding.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import e from"comark/plugins/binding";export*from"comark/plugins/binding";export{e as default};
|
package/dist/plugins/headings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import e from"comark/plugins/headings";export*from"comark/plugins/headings";export{e as default};
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import { ComarkPlugin, ComarkTree } from 'comark';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* NOTE ON THE OPTIONAL PEER — importing this subpath without `shiki` installed fails at
|
|
5
|
-
* module load with `Cannot find package 'shiki'`, thrown from inside the backend rather
|
|
6
|
-
* than from here. That cannot be caught: the failing import is the static one above, which
|
|
7
|
-
* runs before any code in this file. Making it dynamic would push the cost onto every
|
|
8
|
-
* caller and would still not help {@link default}, which is synchronous by contract.
|
|
9
|
-
*
|
|
10
|
-
* So the message stays as it is, and the requirement is documented instead: the README and
|
|
11
|
-
* the package's `peerDependenciesMeta` both state that highlighting needs `shiki`.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Syntax highlighting for code blocks.
|
|
15
|
-
*
|
|
16
|
-
* The options below are this package's own. The backend exposes the highlighting engine's
|
|
17
|
-
* types directly — themes, language registrations, transformers — and re-exporting those
|
|
18
|
-
* would tie every caller to that engine through a package whose whole purpose is to keep
|
|
19
|
-
* it out of sight.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* A theme, either by name or as a full definition.
|
|
23
|
-
*
|
|
24
|
-
* The definition form is deliberately opaque: describing it would pull the highlighting
|
|
25
|
-
* engine's types into this package's public surface, which is what it exists to avoid.
|
|
26
|
-
* Pass the value a `shiki/themes/*` module default-exports.
|
|
27
|
-
*/
|
|
3
|
+
/** A theme name, or a definition as a `shiki/themes/*` module default-exports. */
|
|
28
4
|
type HighlightTheme = string | (object & {
|
|
29
5
|
name?: string;
|
|
30
6
|
});
|
|
@@ -33,27 +9,14 @@ type HighlightLanguage = object;
|
|
|
33
9
|
/** A code-block transformer, as `@shikijs/transformers` returns. */
|
|
34
10
|
type HighlightTransformer = object;
|
|
35
11
|
interface HighlightOptions {
|
|
36
|
-
/**
|
|
37
|
-
* Themes to render with. Both are emitted, so a page can switch between light and dark
|
|
38
|
-
* without highlighting anything again.
|
|
39
|
-
*
|
|
40
|
-
* A registered name works, as does a theme definition — pass the latter to use a theme
|
|
41
|
-
* the backend does not ship. Names are checked first, because a name the backend does
|
|
42
|
-
* not know leaves every block unhighlighted without reporting anything.
|
|
43
|
-
*/
|
|
12
|
+
/** Light and dark themes, both emitted. Unknown theme names throw. */
|
|
44
13
|
themes?: {
|
|
45
14
|
light: HighlightTheme;
|
|
46
15
|
dark: HighlightTheme;
|
|
47
16
|
};
|
|
48
|
-
/**
|
|
49
|
-
* Languages to preload. Left unset, languages load on demand, which needs the backend's
|
|
50
|
-
* full bundle; preloading keeps a build to the grammars it actually uses.
|
|
51
|
-
*/
|
|
17
|
+
/** Languages to preload. Unset loads them on demand from the full bundle. */
|
|
52
18
|
languages?: HighlightLanguage[];
|
|
53
|
-
/**
|
|
54
|
-
* Transformers applied to every block — line markers such as `[!code highlight]` come
|
|
55
|
-
* from these.
|
|
56
|
-
*/
|
|
19
|
+
/** Transformers applied to every block, e.g. for `[!code highlight]` markers. */
|
|
57
20
|
transformers?: HighlightTransformer[];
|
|
58
21
|
/** Whether to inline the theme's background and colour on the block. Defaults to `false`. */
|
|
59
22
|
inlineStyles?: boolean;
|
|
@@ -66,9 +29,7 @@ declare const defaultThemes: {
|
|
|
66
29
|
/** Themes available without registering any of your own. */
|
|
67
30
|
declare function availableThemes(): Promise<string[]>;
|
|
68
31
|
/**
|
|
69
|
-
* Highlight every code block in a parsed tree.
|
|
70
|
-
*
|
|
71
|
-
* Highlighting is asynchronous and happens after parsing, so it runs as its own step:
|
|
32
|
+
* Highlight every code block in a parsed tree, as an async step after parsing.
|
|
72
33
|
*
|
|
73
34
|
* @example
|
|
74
35
|
* ```ts
|
|
@@ -80,13 +41,8 @@ declare function availableThemes(): Promise<string[]>;
|
|
|
80
41
|
* ```
|
|
81
42
|
*/
|
|
82
43
|
declare function highlightTree(tree: ComarkTree, options?: HighlightOptions): Promise<ComarkTree>;
|
|
83
|
-
/**
|
|
84
|
-
* The same highlighting as a parser plugin.
|
|
85
|
-
*
|
|
86
|
-
* Kept for parsers that drive the plugin pipeline themselves. Prefer {@link highlightTree}:
|
|
87
|
-
* the plugin form marks blocks as highlighted without tokenising them, because tokenising
|
|
88
|
-
* is asynchronous and the plugin hook is not.
|
|
89
|
-
*/
|
|
44
|
+
/** Parser plugin form: tokenises every block while parsing. {@link highlightTree} does the same for a tree parsed earlier or cached. */
|
|
90
45
|
declare function highlight(options?: HighlightOptions): ComarkPlugin<any, any>;
|
|
91
46
|
|
|
92
|
-
export {
|
|
47
|
+
export { availableThemes, highlight as default, defaultThemes, highlightTree };
|
|
48
|
+
export type { HighlightLanguage, HighlightOptions, HighlightTheme, HighlightTransformer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as comark from 'comark';
|
|
2
|
+
import { ComarkNode } from 'comark';
|
|
3
|
+
|
|
4
|
+
interface SanitizeOptions {
|
|
5
|
+
/** Tags removed with everything inside them, added to the default list. */
|
|
6
|
+
blockedTags?: string[];
|
|
7
|
+
/** Tags taken off the blocked list, e.g. `['iframe']` for embeds you trust or `['form', 'input', 'button']` for a form. */
|
|
8
|
+
allowedTags?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* URL schemes allowed in links and sources. Relative URLs and `data:image/` image sources always pass.
|
|
11
|
+
* @default ['http', 'https', 'mailto', 'tel']
|
|
12
|
+
*/
|
|
13
|
+
allowedProtocols?: string[];
|
|
14
|
+
/** Keeps every inline style. Off, a style keeps only colour and font declarations, which cannot move content or lay it over the page. @default false */
|
|
15
|
+
allowStyle?: boolean;
|
|
16
|
+
/** Components the `as` attribute may switch an element to; any other `as` is removed. @default [] */
|
|
17
|
+
allowedComponents?: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Elements that run code, load another document, change how the page resolves URLs, or submit or capture input. */
|
|
20
|
+
declare const defaultBlockedTags: string[];
|
|
21
|
+
declare const defaultAllowedProtocols: string[];
|
|
22
|
+
/** Whether a name would read Object.prototype from a plain object, `constructor` and `toString` among them. */
|
|
23
|
+
declare function isPrototypeKey(name: string): boolean;
|
|
24
|
+
/** Whether an attribute is safe to write: a plain name, not an event handler, not HTML, not a style unless allowed, not a URL outside `allowedProtocols`. A binding counts only when it is a literal. */
|
|
25
|
+
declare function isSafeAttribute(tag: string, key: string, value: unknown, options?: SanitizeOptions): boolean;
|
|
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
|
+
declare function sanitizeTree<T extends {
|
|
28
|
+
nodes: ComarkNode[];
|
|
29
|
+
}>(tree: T, options?: SanitizeOptions): T;
|
|
30
|
+
/** The `sanitize` option every renderer takes, as options to pass on, or `false` when it is off. Unset means on. */
|
|
31
|
+
declare function sanitizeOptions(setting: boolean | SanitizeOptions | undefined): SanitizeOptions | false;
|
|
32
|
+
/** A component map whose lookups never reach Object.prototype, so a `::constructor` node renders as an element, not as `Object`. */
|
|
33
|
+
/**
|
|
34
|
+
* Whether a component registered app-wide may render a markdown tag. `Prose*` components restyle the elements sanitizing
|
|
35
|
+
* already allowed, so they always may; any other one only when sanitizing is off or `allowedComponents` names it.
|
|
36
|
+
*/
|
|
37
|
+
declare function allowsGlobalComponent(setting: boolean | SanitizeOptions | undefined, name: string): boolean;
|
|
38
|
+
declare function componentMap<T>(components: Record<string, T> | null | undefined): Record<string, T>;
|
|
39
|
+
/** Removes blocked elements, event handler, HTML and style attributes, unlisted `as` targets and disallowed URL schemes. Use for untrusted markdown; add it last so it sees what other plugins add. */
|
|
40
|
+
declare const _default: comark.ComarkPluginFactory<SanitizeOptions, {}, {}>;
|
|
41
|
+
|
|
42
|
+
export { allowsGlobalComponent, componentMap, _default as default, defaultAllowedProtocols, defaultBlockedTags, isPrototypeKey, isSafeAttribute, sanitizeOptions, sanitizeTree };
|
|
43
|
+
export type { SanitizeOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineComarkPlugin as e}from"comark";const t=[`script`,`style`,`iframe`,`frame`,`frameset`,`object`,`embed`,`applet`,`portal`,`base`,`meta`,`link`,`animate`,`animatemotion`,`animatetransform`,`animatecolor`,`set`,`handler`,`listener`,`form`,`input`,`button`,`textarea`,`select`],n=[`http`,`https`,`mailto`,`tel`],r=/^[a-z_][a-z0-9_.:-]*$/i,i=/^[a-z][a-z0-9_.:-]*$/i,a=/* @__PURE__ */ new Set([`innerhtml`,`outerhtml`,`dangerouslysetinnerhtml`,`srcdoc`]),o=/* @__PURE__ */ new Set([`href`,`src`,`action`,`formaction`,`xlink:href`,`xlinkhref`,`poster`,`background`,`cite`,`data`,`ping`,`lowsrc`,`dynsrc`,`longdesc`,`to`,`url`]),s=/^(?:color|background-color|font-style|font-weight|text-align|text-decoration(?:-line|-color|-style)?|--shiki-[a-z0-9-]+)$/,c=/^[\w\s#%.,()+-]+$/,l=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function u(e){return Object.prototype.hasOwnProperty.call(Object.prototype,e)}function d(e){return/^on[a-z]+$/.test(e.toLowerCase())||/^on[^a-z]/.test(e)}function f(e){return Number.isInteger(e)&&e>0&&e<=1114111&&(e<55296||e>57343)?String.fromCodePoint(e):`�`}function p(e){return e.replace(/&#x([0-9a-f]+);?/gi,(e,t)=>f(Number.parseInt(t,16))).replace(/&#(\d+);?/g,(e,t)=>f(Number(t))).replace(/:?/gi,`:`).replace(/&tab;?|&newline;?/gi,``).replace(/[\u0000- \u007f-\u009f]/g,``).toLowerCase()}function m(e,t,n,r){let i=p(e),a=/^([a-z][a-z0-9+.-]*):/.exec(i)?.[1];return!a||r.has(a)?!0:a===`data`&&t===`src`&&n===`img`&&i.startsWith(`data:image/`)}const h=e=>e.replace(/[-_]/g,``).toLowerCase();function g(e={}){let r=new Set((e.allowedTags??[]).map(e=>e.toLowerCase()));return{blocked:new Set([...t,...e.blockedTags??[]].map(e=>e.toLowerCase()).filter(e=>!r.has(e))),allowedProtocols:new Set((e.allowedProtocols??n).map(e=>e.toLowerCase().replace(/:$/,``))),allowStyle:e.allowStyle===!0,allowedComponents:new Set((e.allowedComponents??[]).map(h))}}const _=(e,t)=>s.test(e.toLowerCase())&&c.test(t)&&!/url\(|expression|image/i.test(t);function v(e){if(typeof e==`string`){let t=e.split(`;`).map(e=>/^([-a-z0-9]+)\s*:([\s\S]*)$/i.exec(e.trim())).filter(e=>e!==null&&_(e[1],e[2].trim())).map(([,e,t])=>`${e}:${t.trim()}`);return t.length?t.join(`;`):void 0}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=Object.entries(e).filter(([e,t])=>(typeof t==`string`||typeof t==`number`)&&_(e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),String(t)));return t.length?Object.fromEntries(t):void 0}}const y=Symbol(`unknown`);function b(e,t){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{}let[n,...r]=e.split(`.`);if(!t||n!==`frontmatter`&&n!==`meta`||r.some(e=>l.has(e)))return y;let i=t[n];for(let e of r){if(!i||typeof i!=`object`||!Object.hasOwn(i,e))return;i=i[e]}return i}function x(e,t){return typeof e==`string`&&!u(e)&&t.allowedComponents.has(h(e))}function S(e,t,n,i,s){let c=t.startsWith(`:`),u=c?t.slice(1):t,f=u.toLowerCase();if(!r.test(u)||d(u)||a.has(f))return;if(f===`style`&&!i.allowStyle){let e=v(c?b(n,s):n);return e===void 0?void 0:c?[t,JSON.stringify(e)]:[t,e]}if((!o.has(f)||f===`data`&&e!==`object`)&&f!==`as`)return c&&typeof n==`string`&&n.split(`.`).some(e=>l.has(e))?void 0:[t,n];let p=c?b(n,s):n;if(p!==y&&typeof p==`string`&&!(f===`as`?!x(p,i):!m(p,f,e,i.allowedProtocols)))return c?[t,JSON.stringify(p)]:[t,n]}function C(e,t,n,r={}){return t===`$`||S(e.toLowerCase(),t,n,g(r))!==void 0}function w(e){let t=`:disabled`in e?e[`:disabled`]===`true`||e[`:disabled`]===!0:e.disabled===``||e.disabled===!0||e.disabled===`disabled`||e.disabled===`true`;return e.type===`checkbox`&&!(`:type`in e)&&t}function T(e,t,n,r){let i={};for(let[a,o]of Object.entries(t)){let t=a===`$`?[a,o]:S(e,a,o,n,r);t&&(i[t[0]]=t[1])}return i}function E(e,t,n){if(!Array.isArray(e))return typeof e==`string`?e:void 0;let[r,a,...o]=e;if(r===null)return e;if(typeof r!=`string`||!i.test(r)||u(r))return;let s=r.toLowerCase(),c=a&&typeof a==`object`?a:{};if(t.blocked.has(s)&&!(s===`input`&&w(c)))return;let l=o.map(e=>E(e,t,n)).filter(e=>e!==void 0);return[r,T(s,c,t,n),...l]}function D(e,t={}){let n=g(t),r=e,i={frontmatter:r.frontmatter??r.data??{},meta:r.meta??{}};return{...e,nodes:(e.nodes??[]).map(e=>E(e,n,i)).filter(e=>e!==void 0)}}function O(e){return e===!1?!1:typeof e==`object`&&e?e:{}}function k(e,t){let n=O(e);return n===!1||/^prose[-_]?/i.test(t)?!0:!u(t)&&g(n).allowedComponents.has(h(t))}function A(e){let t=Object.create(null);for(let e of Object.getOwnPropertyNames(Object.prototype))t[e]=void 0;return Object.assign(t,e??{})}var j=e((e={})=>({name:`primeui:sanitize`,post(t){t.tree.nodes=D(t.tree,e).nodes}}));export{k as allowsGlobalComponent,A as componentMap,j as default,n as defaultAllowedProtocols,t as defaultBlockedTags,u as isPrototypeKey,C as isSafeAttribute,O as sanitizeOptions,D as sanitizeTree};
|
package/dist/plugins/toc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import e from"comark/plugins/toc";export*from"comark/plugins/toc";export{e as default};
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { ComarkPlugin, ComarkParseFn } from 'comark';
|
|
2
|
+
import { SanitizeOptions } from './plugins/sanitize.js';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* Options handed to the parser underneath.
|
|
5
|
-
*
|
|
6
|
-
* Deliberately loose: the parsing backend accepts more than this preset models, and
|
|
7
|
-
* naming its option type here would put its full schema — and its name — into a public
|
|
8
|
-
* signature. Anything valid for the backend passes through.
|
|
9
|
-
*/
|
|
4
|
+
/** Options passed through to the underlying parser, kept loose so the backend type stays private. */
|
|
10
5
|
type ParserPassthrough = Record<string, unknown>;
|
|
11
6
|
interface DocsParserOptions {
|
|
12
7
|
/** Heading ids for anchors. @default true */
|
|
@@ -17,16 +12,15 @@ interface DocsParserOptions {
|
|
|
17
12
|
alert?: boolean;
|
|
18
13
|
/** {{ binding }} interpolation. @default true */
|
|
19
14
|
binding?: boolean;
|
|
20
|
-
/** Extra plugins
|
|
15
|
+
/** Extra plugins, e.g. a configured highlight plugin from ./plugins/highlight. */
|
|
21
16
|
plugins?: ComarkPlugin<any, any>[];
|
|
17
|
+
/** Strips script, event handlers, styles, form controls and unsafe URLs after every other plugin. Disable only for trusted markdown. @default true */
|
|
18
|
+
sanitize?: boolean | SanitizeOptions;
|
|
22
19
|
/** Options forwarded to the underlying parser. Plugins are set by this preset. */
|
|
23
20
|
parse?: ParserPassthrough;
|
|
24
21
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Docs-flavored parser preset: the plugin set every showcase/docs app needs,
|
|
27
|
-
* assembled once. Syntax highlighting is intentionally NOT bundled — shiki is
|
|
28
|
-
* heavy and optional; pass a configured highlight plugin via `plugins`.
|
|
29
|
-
*/
|
|
22
|
+
/** Docs parser preset. Highlighting is not bundled; pass a configured highlight plugin via `plugins`. */
|
|
30
23
|
declare function createDocsParser(options?: DocsParserOptions): ComarkParseFn<any, any>;
|
|
31
24
|
|
|
32
|
-
export {
|
|
25
|
+
export { createDocsParser };
|
|
26
|
+
export type { DocsParserOptions, ParserPassthrough };
|
package/dist/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {createParse}from
|
|
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};
|
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
|
|
4
|
+
export { PROSE_COMPONENTS };
|
|
5
|
+
export type { ProseComponentName };
|
package/dist/prose.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
@@ -13,18 +13,10 @@ interface SearchDocument {
|
|
|
13
13
|
heading: string;
|
|
14
14
|
text: string;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Flattens parsed pages into heading-level search documents. The output is
|
|
18
|
-
* plain JSON: ship it to the client for local search, hand it to Algolia, or
|
|
19
|
-
* serve it to agents — same records everywhere.
|
|
20
|
-
*/
|
|
16
|
+
/** Flattens parsed pages into heading-level search documents as plain JSON. */
|
|
21
17
|
declare function buildSearchIndex(pages: SearchPage[]): SearchDocument[];
|
|
22
|
-
/**
|
|
23
|
-
* Dependency-free local search over an index: case-insensitive, every term
|
|
24
|
-
* must match, heading/title hits outrank body hits. Good enough for docs-size
|
|
25
|
-
* indexes; swap in Algolia or MiniSearch behind the same SearchDocument shape
|
|
26
|
-
* when the corpus outgrows it.
|
|
27
|
-
*/
|
|
18
|
+
/** Case-insensitive local search; every term must match, heading hits rank above body hits. */
|
|
28
19
|
declare function searchDocuments(index: SearchDocument[], query: string, limit?: number): SearchDocument[];
|
|
29
20
|
|
|
30
|
-
export {
|
|
21
|
+
export { buildSearchIndex, searchDocuments };
|
|
22
|
+
export type { SearchDocument, SearchPage };
|
package/dist/search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComarkElement, ComarkNode, ComarkTree } from 'comark';
|
|
2
|
-
import 'comark/utils';
|
|
3
2
|
|
|
4
3
|
interface TocItem {
|
|
5
4
|
id: string;
|
|
@@ -17,12 +16,9 @@ declare function isElement(node: ComarkNode): node is ComarkElement;
|
|
|
17
16
|
declare function tagOf(node: ComarkElement): string;
|
|
18
17
|
declare function propsOf(node: ComarkElement): Record<string, unknown>;
|
|
19
18
|
declare function childrenOf(node: ComarkElement): ComarkNode[];
|
|
20
|
-
/**
|
|
21
|
-
* Depth-first walk over every node in the tree. Return `false` from the
|
|
22
|
-
* visitor to skip a node's children.
|
|
23
|
-
*/
|
|
19
|
+
/** Depth-first walk; return `false` from the visitor to skip a node's children. */
|
|
24
20
|
declare function walkTree(tree: ComarkTree, visit: (node: ComarkNode, parent: ComarkElement | null) => void | boolean): void;
|
|
25
|
-
/** Plain-text content of a node
|
|
21
|
+
/** Plain-text content of a node or node list, markup stripped. */
|
|
26
22
|
declare function textOf(node: ComarkNode | ComarkNode[]): string;
|
|
27
23
|
interface HeadingSection {
|
|
28
24
|
/** Heading id (anchor target); empty for content before the first heading. */
|
|
@@ -34,11 +30,8 @@ interface HeadingSection {
|
|
|
34
30
|
/** Plain text of everything under this heading, code blocks excluded. */
|
|
35
31
|
text: string;
|
|
36
32
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Splits a page into heading-anchored sections of plain text — the natural
|
|
39
|
-
* unit for search indexing and llms excerpts. Code blocks are excluded so
|
|
40
|
-
* indexes stay prose-focused.
|
|
41
|
-
*/
|
|
33
|
+
/** Splits a page into heading-anchored plain-text sections, code blocks excluded. */
|
|
42
34
|
declare function headingSections(tree: ComarkTree): HeadingSection[];
|
|
43
35
|
|
|
44
|
-
export {
|
|
36
|
+
export { childrenOf, descriptionFromTree, headingSections, isElement, propsOf, tagOf, textOf, titleFromTree, tocFromTree, walkTree };
|
|
37
|
+
export type { HeadingSection, TocItem };
|
package/dist/tree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
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.
|
|
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.4",
|
|
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
|
|
41
|
-
"types": "./dist/plugins
|
|
42
|
-
"import": "./dist/plugins
|
|
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
|
|
76
|
-
"./dist/plugins
|
|
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
|
-
"
|
|
93
|
-
|
|
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.
|
|
118
|
-
"@primeui-devkit/
|
|
119
|
-
"@primeui-devkit/
|
|
120
|
-
"@primeui-devkit/
|
|
104
|
+
"vitest": "4.1.11",
|
|
105
|
+
"@primeui-devkit/bundle": "0.1.0-rc.2",
|
|
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"
|
|
121
109
|
},
|
|
122
|
-
"
|
|
123
|
-
"
|
|
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 &&
|
|
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",
|