@coderminer/vue-markdown 0.0.0-stage → 1.0.1
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/CHANGELOG.md +226 -0
- package/LICENSE +21 -0
- package/README.md +584 -3
- package/README.zh-CN.md +550 -0
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
- package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
- package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
- package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
- package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
- package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
- package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
- package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
- package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
- package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
- package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
- package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
- package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
- package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
- package/dist/chunks/adapters-CMwX_NEI.js +26 -0
- package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
- package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
- package/dist/chunks/codemirror-DyphMAEg.js +82 -0
- package/dist/chunks/config-aRYo2R8_.js +10 -0
- package/dist/chunks/context-8NfW6fxI.js +30 -0
- package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
- package/dist/chunks/default-ZQ5aHh-N.js +3 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
- package/dist/chunks/export-BrgMLgUp.js +1574 -0
- package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
- package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
- package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
- package/dist/chunks/identity-Bi27FKyx.js +6243 -0
- package/dist/chunks/labels-BtHiUTQI.js +47 -0
- package/dist/chunks/lib-CCnkLL6S.js +252 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
- package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
- package/dist/chunks/normalize-VKfQXZiK.js +226 -0
- package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
- package/dist/chunks/plugin-YWo5uqTh.js +27 -0
- package/dist/chunks/preset-BjaOuJUL.js +44 -0
- package/dist/chunks/registry-B7BfEkuy.js +6150 -0
- package/dist/chunks/render-DAqK0w5J.js +1754 -0
- package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
- package/dist/chunks/runtime-D95F41zG.js +574 -0
- package/dist/chunks/security-y4EwUyAs.js +212 -0
- package/dist/chunks/shared-NjFDPmkb.js +67 -0
- package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
- package/dist/chunks/url-D2BoivaE.js +24 -0
- package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
- package/dist/components/CodeBlock.d.ts +73 -0
- package/dist/components/CodeBlock.js +1 -0
- package/dist/components/Icon.d.ts +6 -0
- package/dist/components/MarkdownBlockquote.d.ts +18 -0
- package/dist/components/MarkdownBlockquote.js +1 -0
- package/dist/components/MarkdownBreak.d.ts +8 -0
- package/dist/components/MarkdownBreak.js +1 -0
- package/dist/components/MarkdownChildren.d.ts +17 -0
- package/dist/components/MarkdownCode.d.ts +29 -0
- package/dist/components/MarkdownCode.js +1 -0
- package/dist/components/MarkdownConfigProvider.d.ts +33 -0
- package/dist/components/MarkdownConfigProvider.js +1 -0
- package/dist/components/MarkdownContent.d.ts +16 -0
- package/dist/components/MarkdownContent.js +1 -0
- package/dist/components/MarkdownCustomTag.d.ts +20 -0
- package/dist/components/MarkdownCustomTag.js +1 -0
- package/dist/components/MarkdownEmphasis.d.ts +18 -0
- package/dist/components/MarkdownEmphasis.js +1 -0
- package/dist/components/MarkdownEmpty.d.ts +8 -0
- package/dist/components/MarkdownEmpty.js +1 -0
- package/dist/components/MarkdownError.d.ts +11 -0
- package/dist/components/MarkdownError.js +1 -0
- package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
- package/dist/components/MarkdownFootnoteReference.js +1 -0
- package/dist/components/MarkdownFootnotes.d.ts +17 -0
- package/dist/components/MarkdownFootnotes.js +1 -0
- package/dist/components/MarkdownHeading.d.ts +18 -0
- package/dist/components/MarkdownHeading.js +1 -0
- package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
- package/dist/components/MarkdownHorizontalRule.js +1 -0
- package/dist/components/MarkdownHtml.d.ts +8 -0
- package/dist/components/MarkdownHtml.js +1 -0
- package/dist/components/MarkdownImage.d.ts +15 -0
- package/dist/components/MarkdownImage.js +1 -0
- package/dist/components/MarkdownInlineCode.d.ts +18 -0
- package/dist/components/MarkdownInlineCode.js +1 -0
- package/dist/components/MarkdownLink.d.ts +22 -0
- package/dist/components/MarkdownLink.js +1 -0
- package/dist/components/MarkdownList.d.ts +18 -0
- package/dist/components/MarkdownList.js +1 -0
- package/dist/components/MarkdownListItem.d.ts +18 -0
- package/dist/components/MarkdownListItem.js +1 -0
- package/dist/components/MarkdownLoading.d.ts +8 -0
- package/dist/components/MarkdownLoading.js +1 -0
- package/dist/components/MarkdownMath.d.ts +12 -0
- package/dist/components/MarkdownMath.js +1 -0
- package/dist/components/MarkdownMermaid.d.ts +78 -0
- package/dist/components/MarkdownMermaid.js +1 -0
- package/dist/components/MarkdownParagraph.d.ts +18 -0
- package/dist/components/MarkdownParagraph.js +1 -0
- package/dist/components/MarkdownRenderer.d.ts +167 -0
- package/dist/components/MarkdownRenderer.js +1 -0
- package/dist/components/MarkdownRoot.d.ts +24 -0
- package/dist/components/MarkdownRoot.js +1 -0
- package/dist/components/MarkdownStrikethrough.d.ts +18 -0
- package/dist/components/MarkdownStrikethrough.js +1 -0
- package/dist/components/MarkdownStrong.d.ts +18 -0
- package/dist/components/MarkdownStrong.js +1 -0
- package/dist/components/MarkdownTable.d.ts +18 -0
- package/dist/components/MarkdownTable.js +1 -0
- package/dist/components/MarkdownTableCell.d.ts +20 -0
- package/dist/components/MarkdownTableCell.js +1 -0
- package/dist/components/MarkdownTableRow.d.ts +18 -0
- package/dist/components/MarkdownTableRow.js +1 -0
- package/dist/components/MarkdownTableSection.d.ts +18 -0
- package/dist/components/MarkdownTableSection.js +1 -0
- package/dist/components/MarkdownTaskItem.d.ts +20 -0
- package/dist/components/MarkdownTaskItem.js +1 -0
- package/dist/components/MarkdownToc.d.ts +36 -0
- package/dist/components/MarkdownToc.js +1 -0
- package/dist/components/MarkdownTocItem.d.ts +14 -0
- package/dist/components/MarkdownTocItem.js +1 -0
- package/dist/components/MermaidBlock.d.ts +50 -0
- package/dist/components/MermaidBlock.js +1 -0
- package/dist/components/MermaidLiveEditor.d.ts +44 -0
- package/dist/components/MermaidLiveEditor.js +1 -0
- package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
- package/dist/components/VueSyntaxHighlighter.js +1 -0
- package/dist/components/codeRegion.d.ts +14 -0
- package/dist/components/config.d.ts +7 -0
- package/dist/components/context.d.ts +45 -0
- package/dist/components/index.d.ts +42 -0
- package/dist/components/index.js +38 -0
- package/dist/components/render.d.ts +9 -0
- package/dist/components/scroll-lock.d.ts +7 -0
- package/dist/components/types.d.ts +61 -0
- package/dist/composables/useActiveHeading.d.ts +12 -0
- package/dist/composables/useCodeHighlighter.d.ts +30 -0
- package/dist/composables/useLineWindow.d.ts +38 -0
- package/dist/composables/useMarkdownDocument.d.ts +25 -0
- package/dist/core/adapters.d.ts +7 -0
- package/dist/core/config.d.ts +5 -0
- package/dist/core/diagnostics.d.ts +9 -0
- package/dist/core/finalize.d.ts +18 -0
- package/dist/core/hast-nodes.d.ts +3 -0
- package/dist/core/hast-to-nodes.d.ts +9 -0
- package/dist/core/highlight-lines.d.ts +8 -0
- package/dist/core/identity.d.ts +4 -0
- package/dist/core/labels.d.ts +4 -0
- package/dist/core/manifest.d.ts +38 -0
- package/dist/core/memo.d.ts +5 -0
- package/dist/core/model-hast.d.ts +8 -0
- package/dist/core/model.d.ts +10 -0
- package/dist/core/normalize.d.ts +37 -0
- package/dist/core/parts.d.ts +136 -0
- package/dist/core/preset.d.ts +10 -0
- package/dist/core/run.d.ts +16 -0
- package/dist/core/search.d.ts +5 -0
- package/dist/core/security.d.ts +21 -0
- package/dist/core/slugger.d.ts +13 -0
- package/dist/core/types.d.ts +392 -0
- package/dist/core/url.d.ts +10 -0
- package/dist/editor/codemirror.d.ts +14 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/export/index.d.ts +6 -0
- package/dist/headless.d.ts +21 -0
- package/dist/headless.js +12 -0
- package/dist/highlight/convert-hast.d.ts +8 -0
- package/dist/highlight/highlightjs.d.ts +7 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.js +4 -0
- package/dist/highlight/shared.d.ts +11 -0
- package/dist/highlight/shiki.d.ts +7 -0
- package/dist/highlight/shiki.js +75 -0
- package/dist/html/index.d.ts +17 -0
- package/dist/html/index.js +11 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +53 -0
- package/dist/math/index.d.ts +4 -0
- package/dist/math/index.js +585 -0
- package/dist/math/katex.d.ts +4 -0
- package/dist/math/plugin.d.ts +20 -0
- package/dist/mermaid/index.d.ts +6 -0
- package/dist/mermaid/index.js +8 -0
- package/dist/mermaid/plugin.d.ts +17 -0
- package/dist/mermaid/runtime.d.ts +14 -0
- package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
- package/dist/mermaid/sanitize-svg.d.ts +3 -0
- package/dist/mermaid/sanitize.d.ts +16 -0
- package/dist/node-components.d.ts +1 -0
- package/dist/node-components.js +39 -0
- package/dist/pipeline/custom.d.ts +8 -0
- package/dist/pipeline/identity.d.ts +12 -0
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/official.d.ts +6 -0
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +1 -0
- package/dist/plugins/builtin.d.ts +15 -0
- package/dist/plugins/define.d.ts +7 -0
- package/dist/plugins/registry.d.ts +16 -0
- package/dist/plugins/source.d.ts +7 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +1 -0
- package/dist/presets.d.ts +3 -0
- package/dist/presets.js +1 -0
- package/dist/style.css +2 -0
- package/dist/styles/components.css +737 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/math-full.css +3 -0
- package/dist/styles/math.css +18 -0
- package/dist/styles/tokens.css +96 -0
- package/package.json +214 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, ShallowRef } from 'vue';
|
|
2
|
+
import { MarkdownDiagnostic, MarkdownDocument, MarkdownDocumentOptions, MarkdownLabels, MarkdownNodeComponents, MarkdownRegionComponents, MarkdownTagComponents, TocItem } from '../core/types';
|
|
3
|
+
export type MarkdownStatus = 'idle' | 'pending' | 'ready' | 'error';
|
|
4
|
+
export interface UseMarkdownDocumentReturn {
|
|
5
|
+
document: ShallowRef<MarkdownDocument | undefined>;
|
|
6
|
+
toc: ComputedRef<TocItem[]>;
|
|
7
|
+
status: ShallowRef<MarkdownStatus>;
|
|
8
|
+
diagnostics: ShallowRef<MarkdownDiagnostic[]>;
|
|
9
|
+
pipeline: ComputedRef<string>;
|
|
10
|
+
plugins: ComputedRef<string[]>;
|
|
11
|
+
/** Tag components contributed by plugins; local props are merged by the host. */
|
|
12
|
+
resolvedComponents: ComputedRef<MarkdownTagComponents>;
|
|
13
|
+
/** Semantic node components contributed by plugins. */
|
|
14
|
+
resolvedNodeComponents: ComputedRef<MarkdownNodeComponents>;
|
|
15
|
+
/** Structural regions contributed by plugins. */
|
|
16
|
+
resolvedRegions: ComputedRef<MarkdownRegionComponents>;
|
|
17
|
+
/** Labels contributed by plugins. */
|
|
18
|
+
resolvedLabels: ComputedRef<Partial<MarkdownLabels>>;
|
|
19
|
+
/** Design tokens contributed by plugins. */
|
|
20
|
+
resolvedTokens: ComputedRef<Record<string, string>>;
|
|
21
|
+
refresh: () => Promise<void>;
|
|
22
|
+
/** Clear the published diagnostics without changing the document. */
|
|
23
|
+
clearDiagnostics: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function useMarkdownDocument(source: MaybeRefOrGetter<string>, options?: MaybeRefOrGetter<MarkdownDocumentOptions>): UseMarkdownDocumentReturn;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DiagnosticFormatter, MarkdownHighlighter, MarkdownSlugger, MarkdownUrlTransform, MathEngine, MermaidRenderer } from './types';
|
|
2
|
+
export declare function isValidHighlighter(value: unknown): value is MarkdownHighlighter;
|
|
3
|
+
export declare function isValidMathEngine(value: unknown): value is MathEngine;
|
|
4
|
+
export declare function isValidMermaidRenderer(value: unknown): value is MermaidRenderer;
|
|
5
|
+
export declare function isValidDiagnosticFormatter(value: unknown): value is DiagnosticFormatter;
|
|
6
|
+
export declare function isValidSlugger(value: unknown): value is MarkdownSlugger;
|
|
7
|
+
export declare function isValidUrlTransform(value: unknown): value is MarkdownUrlTransform;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MarkdownConfig, MarkdownPreset } from './types';
|
|
2
|
+
/** Merge configuration maps with `next` taking precedence. */
|
|
3
|
+
export declare function mergeMarkdownConfig(base: MarkdownConfig | undefined, next: MarkdownConfig | undefined): MarkdownConfig;
|
|
4
|
+
/** Merge presets; later presets win and plugins are appended in order. */
|
|
5
|
+
export declare function mergeMarkdownPreset(base: MarkdownPreset | undefined, next: MarkdownPreset): MarkdownPreset;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MarkdownDiagnostic, DiagnosticPhase, SourceRange } from './types';
|
|
2
|
+
export declare function createDiagnostic(code: string, message: string, options?: {
|
|
3
|
+
severity?: MarkdownDiagnostic['severity'];
|
|
4
|
+
phase?: DiagnosticPhase;
|
|
5
|
+
plugin?: string;
|
|
6
|
+
source?: SourceRange;
|
|
7
|
+
details?: string;
|
|
8
|
+
}): MarkdownDiagnostic;
|
|
9
|
+
export declare function errorMessage(error: unknown): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MarkdownDiagnostic, MarkdownDocument, MarkdownDocumentOptions, MarkdownSlugger, PipelineResult } from './types';
|
|
2
|
+
import { ResolvedPlugins } from '../plugins/registry';
|
|
3
|
+
export interface FinalizeDocumentOptions {
|
|
4
|
+
source: string;
|
|
5
|
+
result: PipelineResult;
|
|
6
|
+
options: MarkdownDocumentOptions;
|
|
7
|
+
plugins: ResolvedPlugins;
|
|
8
|
+
pipelineName: string;
|
|
9
|
+
slugger: MarkdownSlugger;
|
|
10
|
+
idPrefix: string;
|
|
11
|
+
diagnostics: MarkdownDiagnostic[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Turn a pipeline result into the public document model. Both the reactive
|
|
15
|
+
* composable and static export use this path so filtering, URL policy, heading
|
|
16
|
+
* IDs, and plugin document transforms cannot diverge.
|
|
17
|
+
*/
|
|
18
|
+
export declare function finalizeMarkdownDocument(input: FinalizeDocumentOptions): MarkdownDocument;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RootContent } from 'hast';
|
|
2
|
+
import { MarkdownNode } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert an already-parsed trusted hast subtree into normalized nodes.
|
|
5
|
+
*
|
|
6
|
+
* This module deliberately has no HTML parser import so adapters that already
|
|
7
|
+
* produce hast (Shiki) do not pull one into their entry.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hastToMarkdownNodes(nodes: readonly RootContent[]): MarkdownNode[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HighlightLine } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Expand numeric lines and `start-end` ranges into a lookup set.
|
|
4
|
+
*
|
|
5
|
+
* Invalid, zero, negative, and reversed entries are ignored. Plain numeric
|
|
6
|
+
* strings are treated as a single line.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveHighlightedLines(values: readonly HighlightLine[] | undefined): Set<number>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Stable process-local identity for objects and functions. */
|
|
2
|
+
export declare function identityOf(value: unknown): string;
|
|
3
|
+
export declare function listIdentity(list: readonly unknown[] | undefined): string;
|
|
4
|
+
export declare function stringListIdentity(list: readonly string[] | undefined): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MarkdownLabelContext, MarkdownLabelValue, MarkdownLabels } from '../core/types';
|
|
2
|
+
/** Resolve a static or context-aware label value. */
|
|
3
|
+
export declare function resolveLabel(value: MarkdownLabelValue, context?: MarkdownLabelContext): string;
|
|
4
|
+
export declare const DEFAULT_LABELS: MarkdownLabels;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MarkdownPart } from './parts';
|
|
2
|
+
/**
|
|
3
|
+
* Machine-readable customization manifest for one public component.
|
|
4
|
+
*
|
|
5
|
+
* Manifests are Vue-free so documentation, the demo inspector, and validation
|
|
6
|
+
* tests can consume them without importing component code.
|
|
7
|
+
*/
|
|
8
|
+
export interface MarkdownComponentManifest {
|
|
9
|
+
name: string;
|
|
10
|
+
parts: readonly MarkdownPart[];
|
|
11
|
+
tokens: readonly string[];
|
|
12
|
+
slots: readonly string[];
|
|
13
|
+
labels: readonly string[];
|
|
14
|
+
overrideKeys: readonly string[];
|
|
15
|
+
tags?: readonly string[];
|
|
16
|
+
behaviors?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export type ManifestIssueCode = 'duplicate-manifest' | 'undeclared-part' | 'missing-part' | 'undeclared-label' | 'missing-slot';
|
|
19
|
+
export interface ManifestValidationIssue {
|
|
20
|
+
code: ManifestIssueCode;
|
|
21
|
+
component: string;
|
|
22
|
+
message: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ManifestRenderSnapshot {
|
|
25
|
+
parts?: readonly string[];
|
|
26
|
+
labels?: readonly string[];
|
|
27
|
+
slots?: readonly string[];
|
|
28
|
+
/** `strict` also requires every declared part to be rendered. */
|
|
29
|
+
mode?: 'strict' | 'observed';
|
|
30
|
+
}
|
|
31
|
+
export declare const COMPONENT_MANIFESTS: Record<string, MarkdownComponentManifest>;
|
|
32
|
+
export declare function getComponentManifest(name: string): MarkdownComponentManifest | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Compare a manifest with rendered output. Missing snapshot fields are skipped
|
|
35
|
+
* so a test can validate only the parts, labels, or slots it can observe.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateManifest(entry: MarkdownComponentManifest, snapshot: ManifestRenderSnapshot): ManifestValidationIssue[];
|
|
38
|
+
export declare function validateManifestRegistry(manifests?: Record<string, MarkdownComponentManifest>): ManifestValidationIssue[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MarkdownDocument } from './types';
|
|
2
|
+
export declare function memoGet(key: string): MarkdownDocument | undefined;
|
|
3
|
+
export declare function memoSet(key: string, document: MarkdownDocument): void;
|
|
4
|
+
export declare function memoClear(): void;
|
|
5
|
+
export declare function memoSize(): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Root } from 'hast';
|
|
2
|
+
import { MarkdownDocument } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Serialize the normalized document model back to hast for static export.
|
|
5
|
+
* The model has already passed sanitization, filtering, URL policy, and plugin
|
|
6
|
+
* document transforms, so this function performs no new trust decisions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function modelToHast(document: MarkdownDocument): Root;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MarkdownDocument, MarkdownNode } from './types';
|
|
2
|
+
export interface BuildDocumentOptions {
|
|
3
|
+
nodes: MarkdownNode[];
|
|
4
|
+
plugins: string[];
|
|
5
|
+
pipeline: string;
|
|
6
|
+
frontmatter?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildDocument(options: BuildDocumentOptions): MarkdownDocument;
|
|
9
|
+
/** Recompute derived collections after a document transform. */
|
|
10
|
+
export declare function withDerivedDocument(document: MarkdownDocument): MarkdownDocument;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Root } from 'hast';
|
|
2
|
+
import { AllowElement, MarkdownDiagnostic, MarkdownDocument, MarkdownNode, MarkdownSlugger, MarkdownUrlTransform, TocItem } from './types';
|
|
3
|
+
export interface NormalizeOptions {
|
|
4
|
+
slugger: MarkdownSlugger;
|
|
5
|
+
idPrefix?: string;
|
|
6
|
+
urlTransform?: MarkdownUrlTransform;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
allowedElements?: string[];
|
|
9
|
+
disallowedElements?: string[];
|
|
10
|
+
unwrapDisallowed?: boolean;
|
|
11
|
+
allowElement?: AllowElement;
|
|
12
|
+
diagnostics?: MarkdownDiagnostic[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert custom-tag attributes into the camelCase props hosts receive.
|
|
16
|
+
*
|
|
17
|
+
* HTML parsing lowercases raw attribute names, so a camelCase attribute written
|
|
18
|
+
* in raw HTML (`startLine`) cannot be recovered. Authors should use kebab-case
|
|
19
|
+
* (`start-line`), which normalizes to `startLine`. `data-*` and `aria-*` keep
|
|
20
|
+
* their hyphenated form because they are DOM attributes rather than component
|
|
21
|
+
* props.
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeCustomTagProps(attrs: Record<string, string>): Record<string, string>;
|
|
24
|
+
export interface NormalizeResult {
|
|
25
|
+
nodes: MarkdownNode[];
|
|
26
|
+
toc: TocItem[];
|
|
27
|
+
customTags: MarkdownDocument['customTags'];
|
|
28
|
+
}
|
|
29
|
+
export declare function normalizeHast(root: Root, options: NormalizeOptions): NormalizeResult;
|
|
30
|
+
/**
|
|
31
|
+
* Keep headings up to `depth`. A missing, zero, negative, or non-finite depth
|
|
32
|
+
* means all available levels. Values above six are also effectively unlimited.
|
|
33
|
+
*/
|
|
34
|
+
export declare function filterTocByDepth(toc: readonly TocItem[], depth: number | undefined): TocItem[];
|
|
35
|
+
export declare function extractToc(nodes: readonly MarkdownNode[]): TocItem[];
|
|
36
|
+
export declare function collectCustomTags(nodes: readonly MarkdownNode[]): MarkdownDocument['customTags'];
|
|
37
|
+
export declare function walkNodes(nodes: readonly MarkdownNode[], visit: (node: MarkdownNode, parent: MarkdownNode | undefined) => void, parent?: MarkdownNode): void;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable part names and token names.
|
|
3
|
+
*
|
|
4
|
+
* Parts are rendered as `class="vmd-<part>"` plus `data-vmd-part="<part>"`.
|
|
5
|
+
* They are stable within a major version and are never generated or hashed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VMD_CLASS_PREFIX = "vmd-";
|
|
8
|
+
export declare const PARTS: {
|
|
9
|
+
readonly root: "root";
|
|
10
|
+
readonly body: "body";
|
|
11
|
+
readonly tocColumn: "toc-column";
|
|
12
|
+
readonly content: "content";
|
|
13
|
+
readonly toc: "toc";
|
|
14
|
+
readonly tocNav: "toc-nav";
|
|
15
|
+
readonly tocItem: "toc-item";
|
|
16
|
+
readonly paragraph: "paragraph";
|
|
17
|
+
readonly heading: "heading";
|
|
18
|
+
readonly headingAnchor: "heading-anchor";
|
|
19
|
+
readonly emphasis: "emphasis";
|
|
20
|
+
readonly strong: "strong";
|
|
21
|
+
readonly strikethrough: "strikethrough";
|
|
22
|
+
readonly link: "link";
|
|
23
|
+
readonly image: "image";
|
|
24
|
+
readonly list: "list";
|
|
25
|
+
readonly listItem: "list-item";
|
|
26
|
+
readonly blockquote: "blockquote";
|
|
27
|
+
readonly hr: "hr";
|
|
28
|
+
readonly break: "break";
|
|
29
|
+
readonly table: "table";
|
|
30
|
+
readonly tableSection: "table-section";
|
|
31
|
+
readonly tableRow: "table-row";
|
|
32
|
+
readonly tableCell: "table-cell";
|
|
33
|
+
readonly inlineCode: "inline-code";
|
|
34
|
+
readonly code: "code";
|
|
35
|
+
readonly codeHeader: "code-header";
|
|
36
|
+
readonly codeTitle: "code-title";
|
|
37
|
+
readonly codeFileName: "code-file-name";
|
|
38
|
+
readonly codeHeading: "code-heading";
|
|
39
|
+
readonly codeLang: "code-lang";
|
|
40
|
+
readonly codeToolbar: "code-toolbar";
|
|
41
|
+
readonly codeActions: "code-actions";
|
|
42
|
+
readonly codeAction: "code-action";
|
|
43
|
+
readonly codeBody: "code-body";
|
|
44
|
+
readonly codeFeedback: "code-feedback";
|
|
45
|
+
readonly highlighter: "highlighter";
|
|
46
|
+
readonly highlighterHeader: "highlighter-header";
|
|
47
|
+
readonly highlighterActions: "highlighter-actions";
|
|
48
|
+
readonly highlighterFooter: "highlighter-footer";
|
|
49
|
+
readonly highlighterBody: "highlighter-body";
|
|
50
|
+
readonly highlighterGutter: "highlighter-gutter";
|
|
51
|
+
readonly highlighterLine: "highlighter-line";
|
|
52
|
+
readonly highlighterHidden: "highlighter-hidden";
|
|
53
|
+
readonly highlighterEmpty: "highlighter-empty";
|
|
54
|
+
readonly highlighterToggle: "highlighter-toggle";
|
|
55
|
+
readonly math: "math";
|
|
56
|
+
readonly mathError: "math-error";
|
|
57
|
+
readonly mermaid: "mermaid";
|
|
58
|
+
readonly mermaidHeader: "mermaid-header";
|
|
59
|
+
readonly mermaidTabs: "mermaid-tabs";
|
|
60
|
+
readonly mermaidActions: "mermaid-actions";
|
|
61
|
+
readonly mermaidAction: "mermaid-action";
|
|
62
|
+
readonly mermaidPreview: "mermaid-preview";
|
|
63
|
+
readonly mermaidSource: "mermaid-source";
|
|
64
|
+
readonly mermaidPending: "mermaid-pending";
|
|
65
|
+
readonly mermaidError: "mermaid-error";
|
|
66
|
+
readonly mermaidFallback: "mermaid-fallback";
|
|
67
|
+
readonly mermaidRetry: "mermaid-retry";
|
|
68
|
+
readonly mermaidFullscreen: "mermaid-fullscreen";
|
|
69
|
+
readonly editor: "editor";
|
|
70
|
+
readonly editorPane: "editor-pane";
|
|
71
|
+
readonly editorDivider: "editor-divider";
|
|
72
|
+
readonly editorPreview: "editor-preview";
|
|
73
|
+
readonly editorDiagnostics: "editor-diagnostics";
|
|
74
|
+
readonly editorEmpty: "editor-empty";
|
|
75
|
+
readonly editorToolbar: "editor-toolbar";
|
|
76
|
+
readonly editorFullscreen: "editor-fullscreen";
|
|
77
|
+
readonly html: "html";
|
|
78
|
+
readonly customTag: "custom-tag";
|
|
79
|
+
readonly taskItem: "task-item";
|
|
80
|
+
readonly taskCheckbox: "task-checkbox";
|
|
81
|
+
readonly footnoteReference: "footnote-reference";
|
|
82
|
+
readonly footnotes: "footnotes";
|
|
83
|
+
readonly searchMatch: "search-match";
|
|
84
|
+
readonly error: "error";
|
|
85
|
+
readonly empty: "empty";
|
|
86
|
+
readonly loading: "loading";
|
|
87
|
+
};
|
|
88
|
+
export type MarkdownPart = (typeof PARTS)[keyof typeof PARTS];
|
|
89
|
+
export declare const TOKENS: {
|
|
90
|
+
readonly fontFamily: "--vmd-font-family";
|
|
91
|
+
readonly fontMono: "--vmd-font-mono";
|
|
92
|
+
readonly fontSize: "--vmd-font-size";
|
|
93
|
+
readonly lineHeight: "--vmd-line-height";
|
|
94
|
+
readonly colorText: "--vmd-color-text";
|
|
95
|
+
readonly colorMuted: "--vmd-color-muted";
|
|
96
|
+
readonly colorBg: "--vmd-color-bg";
|
|
97
|
+
readonly colorSurface: "--vmd-color-surface";
|
|
98
|
+
readonly colorBorder: "--vmd-color-border";
|
|
99
|
+
readonly colorAccent: "--vmd-color-accent";
|
|
100
|
+
readonly colorAccentContrast: "--vmd-color-accent-contrast";
|
|
101
|
+
readonly colorDanger: "--vmd-color-danger";
|
|
102
|
+
readonly colorSuccess: "--vmd-color-success";
|
|
103
|
+
readonly space1: "--vmd-space-1";
|
|
104
|
+
readonly space2: "--vmd-space-2";
|
|
105
|
+
readonly space3: "--vmd-space-3";
|
|
106
|
+
readonly space4: "--vmd-space-4";
|
|
107
|
+
readonly space5: "--vmd-space-5";
|
|
108
|
+
readonly space6: "--vmd-space-6";
|
|
109
|
+
readonly radiusSm: "--vmd-radius-sm";
|
|
110
|
+
readonly radiusMd: "--vmd-radius-md";
|
|
111
|
+
readonly radiusLg: "--vmd-radius-lg";
|
|
112
|
+
readonly shadowSm: "--vmd-shadow-sm";
|
|
113
|
+
readonly shadowMd: "--vmd-shadow-md";
|
|
114
|
+
readonly motionDuration: "--vmd-motion-duration";
|
|
115
|
+
readonly motionEasing: "--vmd-motion-easing";
|
|
116
|
+
readonly codeBg: "--vmd-code-bg";
|
|
117
|
+
readonly codeText: "--vmd-code-text";
|
|
118
|
+
readonly codeBorder: "--vmd-code-border";
|
|
119
|
+
readonly codeToolbarBg: "--vmd-code-toolbar-bg";
|
|
120
|
+
readonly mathColor: "--vmd-math-color";
|
|
121
|
+
readonly mathBg: "--vmd-math-bg";
|
|
122
|
+
readonly mermaidBg: "--vmd-mermaid-bg";
|
|
123
|
+
readonly mermaidBorder: "--vmd-mermaid-border";
|
|
124
|
+
readonly zFullscreen: "--vmd-z-fullscreen";
|
|
125
|
+
};
|
|
126
|
+
export type MarkdownToken = (typeof TOKENS)[keyof typeof TOKENS];
|
|
127
|
+
export interface PartAttributes {
|
|
128
|
+
class: string;
|
|
129
|
+
'data-vmd-part': string;
|
|
130
|
+
}
|
|
131
|
+
/** Build the class and `data-vmd-part` attributes for a documented part. */
|
|
132
|
+
export declare function partAttrs(part: MarkdownPart): PartAttributes;
|
|
133
|
+
/** Merge part attributes with host-provided class names. */
|
|
134
|
+
export declare function partClass(part: MarkdownPart, extra?: string): string;
|
|
135
|
+
export declare const PART_NAMES: readonly MarkdownPart[];
|
|
136
|
+
export declare const TOKEN_NAMES: readonly MarkdownToken[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MarkdownPreset } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Define a shareable preset. Presets contain components, plugin instances, and
|
|
4
|
+
* functions, so they are declarative and inspectable but not JSON-serializable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineMarkdownPreset(preset: MarkdownPreset): MarkdownPreset;
|
|
7
|
+
/** Compose presets in order; later presets override earlier values. */
|
|
8
|
+
export declare function composePresets(...presets: Array<MarkdownPreset | false | null | undefined>): MarkdownPreset;
|
|
9
|
+
/** Resolve a single preset, a preset list, or nothing. */
|
|
10
|
+
export declare function resolvePreset(input: MarkdownPreset | readonly MarkdownPreset[] | undefined): MarkdownPreset | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MarkdownDiagnostic, MarkdownDocumentOptions, MarkdownPipeline, MarkdownSlugger, PipelineContext } from './types';
|
|
2
|
+
import { ResolvedPlugins } from '../plugins/registry';
|
|
3
|
+
export interface MarkdownRun {
|
|
4
|
+
pipeline: MarkdownPipeline;
|
|
5
|
+
plugins: ResolvedPlugins;
|
|
6
|
+
source: string;
|
|
7
|
+
context: PipelineContext;
|
|
8
|
+
slugger: MarkdownSlugger;
|
|
9
|
+
diagnostics: MarkdownDiagnostic[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve and prepare one non-reactive pipeline run. Export uses this helper so
|
|
13
|
+
* source transforms, plugin resolution, and slugger setup match the
|
|
14
|
+
* composable's run.
|
|
15
|
+
*/
|
|
16
|
+
export declare function prepareMarkdownRun(source: string, options?: MarkdownDocumentOptions, diagnostics?: MarkdownDiagnostic[]): MarkdownRun;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MarkdownDocument, MarkdownNode, SearchOptions } from './types';
|
|
2
|
+
/** Split text nodes into match/non-match segments without changing structure. */
|
|
3
|
+
export declare function segmentSearch(nodes: readonly MarkdownNode[], options: SearchOptions): void;
|
|
4
|
+
export declare function searchDocument(document: MarkdownDocument, options: SearchOptions): MarkdownDocument;
|
|
5
|
+
export declare function countSearchMatches(nodes: readonly MarkdownNode[]): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Properties } from 'hast';
|
|
2
|
+
/** Tags that may appear in the normalized model. */
|
|
3
|
+
export declare const ALLOWED_TAGS: Set<string>;
|
|
4
|
+
/** Tags whose content must never reach the model. */
|
|
5
|
+
export declare const DANGEROUS_TAGS: Set<string>;
|
|
6
|
+
declare const URL_ATTRIBUTES: Set<string>;
|
|
7
|
+
export { URL_ATTRIBUTES };
|
|
8
|
+
export declare function toAttributeName(key: string): string;
|
|
9
|
+
export declare function isAllowedAttribute(tag: string, name: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate one URL-bearing attribute value. `srcset` holds a comma-separated
|
|
12
|
+
* candidate list, so each candidate is checked individually.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeUrlValue(value: string, key: string): string | undefined;
|
|
15
|
+
export declare function sanitizeStyleValue(value: string): string | undefined;
|
|
16
|
+
export interface PropertiesToAttrsOptions {
|
|
17
|
+
/** Allow a constrained inline-style subset for trusted engine output. */
|
|
18
|
+
allowStyle?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Convert hast properties into safe, normalized attributes. */
|
|
21
|
+
export declare function propertiesToAttrs(tag: string, properties: Properties | undefined, options?: PropertiesToAttrsOptions): Record<string, string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarkdownSlugger } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create the default heading slugger. `github-slugger` maps every space to a
|
|
4
|
+
* hyphen, so `My Heading` would become `my---heading`. Collapsing whitespace
|
|
5
|
+
* before slugging (and hyphen runs after) keeps IDs readable while preserving
|
|
6
|
+
* GitHub-compatible punctuation handling.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDefaultSlugger(): MarkdownSlugger;
|
|
9
|
+
/**
|
|
10
|
+
* Ensure a host slugger still produces unique heading IDs. The wrapper keeps
|
|
11
|
+
* the host's formatting and appends a numeric suffix for duplicates.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withUniqueSlugs(slugger: MarkdownSlugger): MarkdownSlugger;
|