@canofold/markdown 0.2.0
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/LICENSE +21 -0
- package/README.md +50 -0
- package/README.zh-CN.md +50 -0
- package/dist/Markdown-DgolXL7g.js +2116 -0
- package/dist/Markdown-iU2W4KgV.js +2116 -0
- package/dist/base.css +2 -0
- package/dist/client/chunks/client-BkvCIcoZ.js +334 -0
- package/dist/client/chunks/client-kVNIqHQd.js +334 -0
- package/dist/client/chunks/gallery-BTg1qJjd.js +40 -0
- package/dist/client/chunks/gallery-q0WKbDeW.js +40 -0
- package/dist/client/chunks/image-BuMCsr5L.js +36 -0
- package/dist/client/chunks/image-_I24969q.js +36 -0
- package/dist/client/chunks/provider-DNSHvvN7.js +841 -0
- package/dist/client/chunks/provider-SSQfNDJA.js +841 -0
- package/dist/client/chunks/react-runtime-Dzgdzn6D.js +10571 -0
- package/dist/client/chunks/serialized-DajnRKXi.js +3464 -0
- package/dist/client/chunks/serialized-T1PzI4rG.js +3464 -0
- package/dist/client/chunks/table-JOSJsHgy.js +30 -0
- package/dist/client/chunks/table-PQvrpt1p.js +30 -0
- package/dist/client/index.js +4 -0
- package/dist/client/nativeBehaviors.d.ts +4 -0
- package/dist/client.d.ts +15 -0
- package/dist/compiler/analyze.d.ts +27 -0
- package/dist/compiler/assets.d.ts +29 -0
- package/dist/compiler/ast.d.ts +68 -0
- package/dist/compiler/createPipeline.d.ts +18 -0
- package/dist/compiler/defaultLabels.d.ts +28 -0
- package/dist/compiler/directiveValidation.d.ts +17 -0
- package/dist/compiler/highlighter.d.ts +3 -0
- package/dist/compiler/mdxModules.d.ts +19 -0
- package/dist/compiler/mdxPlugins.d.ts +16 -0
- package/dist/compiler/normalizeOptions.d.ts +16 -0
- package/dist/compiler/pluginPlan.d.ts +18 -0
- package/dist/compiler/plugins/code.d.ts +16 -0
- package/dist/compiler/plugins/directives.d.ts +24 -0
- package/dist/compiler/plugins/documentBlocks.d.ts +5 -0
- package/dist/compiler/plugins/tables.d.ts +5 -0
- package/dist/compiler/plugins.d.ts +24 -0
- package/dist/compiler/prepareMarkdown.d.ts +11 -0
- package/dist/compiler/sanitizeBoundary.d.ts +18 -0
- package/dist/compiler/stableJson.d.ts +2 -0
- package/dist/compiler/syntaxFeatures.d.ts +10 -0
- package/dist/compiler/types.d.ts +177 -0
- package/dist/components/blocks/MarkdownCodeBlock.d.ts +10 -0
- package/dist/components/blocks/MarkdownCopySnippet.d.ts +10 -0
- package/dist/components/blocks/MarkdownHeading.d.ts +13 -0
- package/dist/components/blocks/MarkdownImage.d.ts +16 -0
- package/dist/components/blocks/MarkdownTable.d.ts +12 -0
- package/dist/components/blocks/MarkdownTerminal.d.ts +9 -0
- package/dist/components/composite/MarkdownComposite.d.ts +37 -0
- package/dist/components/composite/MarkdownFileTree.d.ts +5 -0
- package/dist/components/composite/MarkdownTabs.d.ts +6 -0
- package/dist/components/gallery/ImageGallery.d.ts +25 -0
- package/dist/components/shared/MarkdownActions.d.ts +18 -0
- package/dist/components/shared/MarkdownDialog.d.ts +11 -0
- package/dist/components/shared/MarkdownFileIcon.d.ts +4 -0
- package/dist/components/shared/MarkdownIcon.d.ts +8 -0
- package/dist/components/shared/interactionConstants.d.ts +1 -0
- package/dist/components/shared/reactText.d.ts +14 -0
- package/dist/directiveValidation-CwXRsn5k.js +741 -0
- package/dist/directiveValidation-KWUIIjKw.js +741 -0
- package/dist/file-icons/LICENSE +21 -0
- package/dist/file-icons/astro.svg +1 -0
- package/dist/file-icons/bun.svg +1 -0
- package/dist/file-icons/bun_light.svg +1 -0
- package/dist/file-icons/config.svg +1 -0
- package/dist/file-icons/console.svg +1 -0
- package/dist/file-icons/css.svg +1 -0
- package/dist/file-icons/database.svg +1 -0
- package/dist/file-icons/deno.svg +1 -0
- package/dist/file-icons/deno_light.svg +1 -0
- package/dist/file-icons/diff.svg +1 -0
- package/dist/file-icons/docker.svg +1 -0
- package/dist/file-icons/document.svg +1 -0
- package/dist/file-icons/download.svg +1 -0
- package/dist/file-icons/environment.svg +1 -0
- package/dist/file-icons/excel.svg +1 -0
- package/dist/file-icons/git.svg +1 -0
- package/dist/file-icons/github-actions.svg +1 -0
- package/dist/file-icons/go.svg +1 -0
- package/dist/file-icons/javascript.svg +1 -0
- package/dist/file-icons/json.svg +1 -0
- package/dist/file-icons/markdown.svg +1 -0
- package/dist/file-icons/nodejs.svg +1 -0
- package/dist/file-icons/npm.svg +1 -0
- package/dist/file-icons/pdf.svg +1 -0
- package/dist/file-icons/pnpm.svg +1 -0
- package/dist/file-icons/pnpm_light.svg +1 -0
- package/dist/file-icons/powerpoint.svg +1 -0
- package/dist/file-icons/python.svg +1 -0
- package/dist/file-icons/react.svg +1 -0
- package/dist/file-icons/rust.svg +1 -0
- package/dist/file-icons/sass.svg +1 -0
- package/dist/file-icons/settings.svg +1 -0
- package/dist/file-icons/svelte.svg +1 -0
- package/dist/file-icons/typescript.svg +1 -0
- package/dist/file-icons/vue.svg +1 -0
- package/dist/file-icons/word.svg +1 -0
- package/dist/file-icons/yaml.svg +1 -0
- package/dist/file-icons/yarn.svg +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/islands/gallery.d.ts +2 -0
- package/dist/islands/image.d.ts +2 -0
- package/dist/islands/options.d.ts +8 -0
- package/dist/islands/provider.d.ts +4 -0
- package/dist/islands/serialized.d.ts +4 -0
- package/dist/islands/table.d.ts +2 -0
- package/dist/islands.d.ts +13 -0
- package/dist/plugins-CeQ-Bo89.js +288 -0
- package/dist/plugins-DQ-VUuCT.js +288 -0
- package/dist/prepareMarkdown-8N-OdLDS.js +852 -0
- package/dist/prepareMarkdown-Bug1ncYk.js +852 -0
- package/dist/protocol/serializedNode.d.ts +3 -0
- package/dist/react/Markdown.d.ts +54 -0
- package/dist/react/componentMap.d.ts +172 -0
- package/dist/react/semanticOverrideProps.d.ts +4 -0
- package/dist/react/slots.d.ts +39 -0
- package/dist/react/urlTransform.d.ts +12 -0
- package/dist/server/analyze.d.ts +6 -0
- package/dist/server/analyze.js +132 -0
- package/dist/server/cache.d.ts +16 -0
- package/dist/server/createMarkdownRenderer.d.ts +39 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +137 -0
- package/dist/shared/copyText.d.ts +2 -0
- package/dist/shared/fileKinds.d.ts +6 -0
- package/dist/theme.css +183 -0
- package/dist/theme.d.ts +167 -0
- package/dist/theme.js +228 -0
- package/package.json +110 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { MarkdownAssets } from './assets';
|
|
2
|
+
import type { Root } from 'hast';
|
|
3
|
+
import type { LanguageInput } from '@shikijs/types';
|
|
4
|
+
import type { PluggableList } from 'unified';
|
|
5
|
+
export type MarkdownHtmlPolicy = 'trusted' | 'sanitize' | 'strip';
|
|
6
|
+
export type MarkdownUnknownLanguagePolicy = 'warn' | 'error' | 'plain-text';
|
|
7
|
+
export type MarkdownPluginCacheValue = string | number | boolean | null | MarkdownPluginCacheValue[] | {
|
|
8
|
+
[key: string]: MarkdownPluginCacheValue;
|
|
9
|
+
};
|
|
10
|
+
export interface MarkdownPluginBrowserCompiler {
|
|
11
|
+
/** Browser-safe package export that contains the plugin factory. */
|
|
12
|
+
module: string;
|
|
13
|
+
/** Named factory export, for example `mermaid` or `plantUml`. */
|
|
14
|
+
exportName: string;
|
|
15
|
+
/** JSON-serializable factory options used by browser-side Markdown compilers. */
|
|
16
|
+
options?: MarkdownPluginCacheValue;
|
|
17
|
+
}
|
|
18
|
+
export interface MarkdownCodeOptions {
|
|
19
|
+
themes?: {
|
|
20
|
+
light?: string;
|
|
21
|
+
dark?: string;
|
|
22
|
+
};
|
|
23
|
+
fallbackLanguage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Additional fence-language loaders keyed by the label authors use after
|
|
26
|
+
* the opening fence. Built-in technical-document languages remain enabled.
|
|
27
|
+
*/
|
|
28
|
+
languages?: Readonly<Record<string, LanguageInput>>;
|
|
29
|
+
/** Behavior when neither a built-in nor custom language matches a fence. */
|
|
30
|
+
unknownLanguage?: MarkdownUnknownLanguagePolicy;
|
|
31
|
+
}
|
|
32
|
+
export interface MarkdownFeatureOptions {
|
|
33
|
+
callouts?: boolean;
|
|
34
|
+
tabs?: boolean;
|
|
35
|
+
codeGroups?: boolean;
|
|
36
|
+
steps?: boolean;
|
|
37
|
+
terminals?: boolean;
|
|
38
|
+
documentBlocks?: boolean;
|
|
39
|
+
/** Enhance GFM tables independently from other rich document blocks. */
|
|
40
|
+
tables?: boolean;
|
|
41
|
+
codeBlocks?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface MarkdownLabels {
|
|
44
|
+
copyCode: string;
|
|
45
|
+
copyFailed: string;
|
|
46
|
+
copySnippet: string;
|
|
47
|
+
copyTerminal: string;
|
|
48
|
+
terminalTitle: string;
|
|
49
|
+
tabsTitle: string;
|
|
50
|
+
tabItem: string;
|
|
51
|
+
codeGroupTitle: string;
|
|
52
|
+
codeGroupItem: string;
|
|
53
|
+
taskCompleted: string;
|
|
54
|
+
taskIncomplete: string;
|
|
55
|
+
copySectionLink: string;
|
|
56
|
+
tableTitle: string;
|
|
57
|
+
copyTableCsv: string;
|
|
58
|
+
downloadTableCsv: string;
|
|
59
|
+
zoomTable: string;
|
|
60
|
+
closeTablePreview: string;
|
|
61
|
+
sortTableColumn: string;
|
|
62
|
+
zoomImage: string;
|
|
63
|
+
closeImagePreview: string;
|
|
64
|
+
imageGallery: string;
|
|
65
|
+
closeImageGallery: string;
|
|
66
|
+
previousGalleryImage: string;
|
|
67
|
+
nextGalleryImage: string;
|
|
68
|
+
galleryThumbnails: string;
|
|
69
|
+
galleryImage: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A build-time trusted compiler plugin. Plugins extend the shared Markdown and
|
|
73
|
+
* MDX pipeline with additional remark (mdast) and rehype (hast) transforms.
|
|
74
|
+
*
|
|
75
|
+
* Plugin functions cannot participate in cache fingerprints, so `name`,
|
|
76
|
+
* `version` and `cacheKey` carry the cache identity instead: bump `version`
|
|
77
|
+
* whenever the transform behavior changes and derive `cacheKey` from the
|
|
78
|
+
* plugin's resolved options.
|
|
79
|
+
*/
|
|
80
|
+
export interface MarkdownPlugin {
|
|
81
|
+
/** Unique lowercase kebab-case slug, e.g. "external-links". */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Implementation revision; part of the cache identity. */
|
|
84
|
+
version?: string;
|
|
85
|
+
/** JSON-serializable configuration identity, typically resolved options. */
|
|
86
|
+
cacheKey?: MarkdownPluginCacheValue;
|
|
87
|
+
/**
|
|
88
|
+
* Optional browser compiler entry. Static sites use this only for explicit
|
|
89
|
+
* authoring surfaces such as the Playground; ordinary pages do not load it.
|
|
90
|
+
*/
|
|
91
|
+
browserCompiler?: MarkdownPluginBrowserCompiler;
|
|
92
|
+
/** Applied before the core rich-block conversion, before remark-rehype. */
|
|
93
|
+
remarkPlugins?: PluggableList;
|
|
94
|
+
/** Appended after the built-in rehype plugins, at the end of the pipeline. */
|
|
95
|
+
rehypePlugins?: PluggableList;
|
|
96
|
+
/**
|
|
97
|
+
* Fenced-code language labels consumed by this plugin's remark transforms.
|
|
98
|
+
* Declaring them prevents the core Shiki loader from treating plugin-owned
|
|
99
|
+
* fences as ordinary code or reporting them as unsupported languages.
|
|
100
|
+
*/
|
|
101
|
+
fenceLanguages?: readonly string[];
|
|
102
|
+
/**
|
|
103
|
+
* Directive names owned by this plugin. Undeclared directive names are
|
|
104
|
+
* rejected so author typos cannot silently degrade to generic HTML.
|
|
105
|
+
*/
|
|
106
|
+
directiveNames?: readonly string[];
|
|
107
|
+
/**
|
|
108
|
+
* Optional source-level activation gate. Use this for expensive opt-in
|
|
109
|
+
* syntax so ordinary documents do not load or run the plugin.
|
|
110
|
+
*/
|
|
111
|
+
appliesTo?: (context: MarkdownPluginContext) => boolean;
|
|
112
|
+
/** Static assets required whenever this plugin is active for a document. */
|
|
113
|
+
assets?: {
|
|
114
|
+
math?: boolean;
|
|
115
|
+
/** Browser entry points loaded only for pages that activate this plugin. */
|
|
116
|
+
clients?: readonly MarkdownPluginClientAsset[];
|
|
117
|
+
/** Published CSS entry points appended only for pages that activate this plugin. */
|
|
118
|
+
styles?: readonly MarkdownPluginStyleAsset[];
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface MarkdownPluginClientAsset {
|
|
122
|
+
/** Stable identifier used for output naming and de-duplication. */
|
|
123
|
+
id: string;
|
|
124
|
+
/** Public package export, for example `@scope/plugin/client`. */
|
|
125
|
+
module: string;
|
|
126
|
+
/** Extra package files copied beside this client under a directory named after `id`. */
|
|
127
|
+
resources?: readonly MarkdownPluginClientResource[];
|
|
128
|
+
}
|
|
129
|
+
export interface MarkdownPluginClientResourceDirectory {
|
|
130
|
+
/** Directory relative to the resource entry point. Parent traversal is rejected. */
|
|
131
|
+
source: string;
|
|
132
|
+
/** Output directory relative to this client's resource directory. */
|
|
133
|
+
output: string;
|
|
134
|
+
/** Optional file suffix allowlist, for example `[".mjs"]`. */
|
|
135
|
+
extensions?: readonly string[];
|
|
136
|
+
}
|
|
137
|
+
export interface MarkdownPluginClientResource {
|
|
138
|
+
/** Package export resolved from the client asset's owning package. */
|
|
139
|
+
module: string;
|
|
140
|
+
/** Output file relative to this client's resource directory. */
|
|
141
|
+
output: string;
|
|
142
|
+
/** Chunk directories located beside the resolved resource entry. */
|
|
143
|
+
directories?: readonly MarkdownPluginClientResourceDirectory[];
|
|
144
|
+
}
|
|
145
|
+
export interface MarkdownPluginStyleAsset {
|
|
146
|
+
/** Stable identifier used for output naming and de-duplication. */
|
|
147
|
+
id: string;
|
|
148
|
+
/** Public package export, for example `@canofold/plugins/diagram.css`. */
|
|
149
|
+
module: string;
|
|
150
|
+
}
|
|
151
|
+
export interface MarkdownPluginContext {
|
|
152
|
+
source: string;
|
|
153
|
+
mode: 'markdown' | 'mdx';
|
|
154
|
+
}
|
|
155
|
+
export interface RenderMarkdownOptions {
|
|
156
|
+
/**
|
|
157
|
+
* Raw HTML policy for markdown input.
|
|
158
|
+
*
|
|
159
|
+
* `trusted` preserves inline HTML and is intended for build-time docs content.
|
|
160
|
+
* `sanitize` parses HTML and removes unsafe elements, attributes and URLs.
|
|
161
|
+
* `strip` disables raw HTML parsing entirely.
|
|
162
|
+
* MDX remains executable trusted code and does not support safe HTML modes.
|
|
163
|
+
*/
|
|
164
|
+
html?: MarkdownHtmlPolicy;
|
|
165
|
+
code?: MarkdownCodeOptions;
|
|
166
|
+
features?: MarkdownFeatureOptions;
|
|
167
|
+
labels?: Partial<MarkdownLabels>;
|
|
168
|
+
/** BCP 47 locale exposed to compiler plugins for locale-aware output. */
|
|
169
|
+
locale?: string;
|
|
170
|
+
/** Compiler plugins applied to both the Markdown and MDX pipelines. */
|
|
171
|
+
plugins?: readonly MarkdownPlugin[];
|
|
172
|
+
}
|
|
173
|
+
/** Serializable HAST output before HTML stringification. */
|
|
174
|
+
export interface PreparedMarkdown {
|
|
175
|
+
document: Root;
|
|
176
|
+
assets: MarkdownAssets;
|
|
177
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownCodeBlockProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
language?: string;
|
|
5
|
+
filename?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
copyLabel?: string;
|
|
8
|
+
copyFailureLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function MarkdownCodeBlock({ children, source: directSource, language: directLanguage, filename: directFilename, copyLabel: directCopyLabel, copyFailureLabel: directCopyFailureLabel, ...inputProps }: MarkdownCodeBlockProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownCopySnippetProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
value?: string;
|
|
5
|
+
copyLabel?: string;
|
|
6
|
+
copyFailureLabel?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Inline copy interaction shared by React applications and static islands. */
|
|
10
|
+
export declare function MarkdownCopySnippet(props: MarkdownCopySnippetProps): ReactNode;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ElementType, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
interface MarkdownHeadingProps extends Omit<HTMLAttributes<HTMLHeadingElement>, 'children' | 'id'> {
|
|
3
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
id?: string;
|
|
6
|
+
anchor?: string;
|
|
7
|
+
anchorLabel?: string;
|
|
8
|
+
copyFailureLabel?: string;
|
|
9
|
+
'data-cf-element'?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function MarkdownHeading({ level, as, id, anchor, anchorLabel, copyFailureLabel, children, className, ...props }: MarkdownHeadingProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownImageProps extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'title'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
src?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
caption?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
loading?: 'eager' | 'lazy';
|
|
11
|
+
srcSet?: string;
|
|
12
|
+
sizes?: string;
|
|
13
|
+
zoomLabel?: string;
|
|
14
|
+
closeLabel?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function MarkdownImage(props: MarkdownImageProps): ReactNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownTableProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
tableTitle?: string;
|
|
5
|
+
copyLabel?: string;
|
|
6
|
+
copyFailureLabel?: string;
|
|
7
|
+
downloadLabel?: string;
|
|
8
|
+
zoomLabel?: string;
|
|
9
|
+
closeLabel?: string;
|
|
10
|
+
sortLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function MarkdownTable(props: MarkdownTableProps): ReactNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownTerminalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
title?: string;
|
|
5
|
+
source?: string;
|
|
6
|
+
copyLabel?: string;
|
|
7
|
+
copyFailureLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function MarkdownTerminal(props: MarkdownTerminalProps): ReactNode;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type DetailsHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { MarkdownCodeBlock } from '../blocks/MarkdownCodeBlock';
|
|
3
|
+
import { MarkdownCopySnippet } from '../blocks/MarkdownCopySnippet';
|
|
4
|
+
import { MarkdownImage } from '../blocks/MarkdownImage';
|
|
5
|
+
import { MarkdownTable } from '../blocks/MarkdownTable';
|
|
6
|
+
import { MarkdownTerminal } from '../blocks/MarkdownTerminal';
|
|
7
|
+
type MarkdownCompositeKind = 'callout' | 'tabs' | 'code-group' | 'steps' | 'code-block' | 'copy-snippet' | 'table' | 'image' | 'terminal' | 'details' | 'file-tree' | 'gallery' | 'card-grid' | 'api' | 'aside' | 'badge';
|
|
8
|
+
export interface MarkdownCompositeProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface MarkdownDetailsProps extends Omit<DetailsHTMLAttributes<HTMLDetailsElement>, 'children'> {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function MarkdownCallout({ children, ...props }: MarkdownCompositeProps): import("react").DetailedReactHTMLElement<{
|
|
15
|
+
'data-cf-component': MarkdownCompositeKind;
|
|
16
|
+
'data-cf-slot': string;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
}, HTMLElement>;
|
|
19
|
+
export declare function MarkdownSteps({ children, ...props }: MarkdownCompositeProps): import("react").DetailedReactHTMLElement<{
|
|
20
|
+
'data-cf-component': MarkdownCompositeKind;
|
|
21
|
+
'data-cf-slot': string;
|
|
22
|
+
className?: string | undefined;
|
|
23
|
+
}, HTMLElement>;
|
|
24
|
+
/**
|
|
25
|
+
* Keeps native <details> semantics for static output, then upgrades its content
|
|
26
|
+
* area to a deterministic React disclosure transition after hydration.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MarkdownDetails(props: MarkdownDetailsProps): ReactNode;
|
|
29
|
+
/** Structural React wrappers for trusted/document extension blocks. */
|
|
30
|
+
export { ImageGallery as MarkdownGallery } from '../gallery/ImageGallery';
|
|
31
|
+
export { MarkdownTabs } from './MarkdownTabs';
|
|
32
|
+
export { MarkdownFileTree } from './MarkdownFileTree';
|
|
33
|
+
export declare function MarkdownCardGrid({ children, ...props }: MarkdownCompositeProps): import("react").JSX.Element;
|
|
34
|
+
export declare function MarkdownApiBlock({ children, ...props }: MarkdownCompositeProps): import("react").JSX.Element;
|
|
35
|
+
export declare function MarkdownAside({ children, ...props }: MarkdownCompositeProps): import("react").JSX.Element;
|
|
36
|
+
export declare function MarkdownBadge({ children, ...props }: MarkdownCompositeProps): import("react").JSX.Element;
|
|
37
|
+
export { MarkdownCodeBlock, MarkdownCopySnippet, MarkdownImage, MarkdownTable, MarkdownTerminal };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownFileTreeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function MarkdownFileTree(props: MarkdownFileTreeProps): ReactNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownTabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
kind?: 'tabs' | 'code-group';
|
|
5
|
+
}
|
|
6
|
+
export declare function MarkdownTabs(props: MarkdownTabsProps): ReactNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface MarkdownGalleryItem {
|
|
3
|
+
src: string;
|
|
4
|
+
alt: string;
|
|
5
|
+
caption?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
srcSet?: string;
|
|
8
|
+
sizes?: string;
|
|
9
|
+
width?: number | string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
}
|
|
12
|
+
export interface ImageGalleryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role'> {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
items?: MarkdownGalleryItem[];
|
|
15
|
+
role?: 'group' | 'region';
|
|
16
|
+
labels?: Partial<{
|
|
17
|
+
gallery: string;
|
|
18
|
+
close: string;
|
|
19
|
+
previous: string;
|
|
20
|
+
next: string;
|
|
21
|
+
thumbnails: string;
|
|
22
|
+
image: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export declare function ImageGallery(props: ImageGalleryProps): ReactNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type MarkdownIconName } from './MarkdownIcon';
|
|
2
|
+
export { copyMarkdownText } from '../../shared/copyText';
|
|
3
|
+
export declare function MarkdownCopyButton({ value, label, action, className, icon, failureLabel }: {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
action: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
icon?: MarkdownIconName;
|
|
9
|
+
failureLabel?: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function MarkdownDownloadButton({ value, filename, label, action, className, contentType }: {
|
|
12
|
+
value: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
label: string;
|
|
15
|
+
action: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
contentType?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type KeyboardEvent, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
export declare function MarkdownDialogPortal({ children }: {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}): import("react").ReactPortal | null;
|
|
5
|
+
export declare function useMarkdownDialog({ open, close, dialogRef, initialFocusRef, triggerRef }: {
|
|
6
|
+
open: boolean;
|
|
7
|
+
close: () => void;
|
|
8
|
+
dialogRef: RefObject<HTMLElement | null>;
|
|
9
|
+
initialFocusRef: RefObject<HTMLElement | null>;
|
|
10
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
11
|
+
}): (event: KeyboardEvent<HTMLElement>) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type MarkdownIconName } from '../../react/slots';
|
|
2
|
+
export type { MarkdownIconName } from '../../react/slots';
|
|
3
|
+
export declare function MarkdownIcon({ name, size, className }: {
|
|
4
|
+
name: MarkdownIconName;
|
|
5
|
+
size?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
direction?: 'asc' | 'desc';
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ACTION_FEEDBACK_DURATION_MS = 1500;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
export declare function reactText(value: unknown): string;
|
|
3
|
+
export type MarkdownReactElement = ReactElement<Record<string, unknown> & {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function elementChildren(value: ReactNode): MarkdownReactElement[];
|
|
7
|
+
/** Resolve names from raw elements and the mapped Markdown element functions. */
|
|
8
|
+
export declare function elementTag(element: MarkdownReactElement): string;
|
|
9
|
+
export declare function readProp(props: object, ...names: string[]): {} | undefined;
|
|
10
|
+
export declare function stringProp(props: object, ...names: string[]): string;
|
|
11
|
+
export declare function markdownDomProps(props: object, omitted?: readonly string[]): {
|
|
12
|
+
[k: string]: any;
|
|
13
|
+
};
|
|
14
|
+
export declare function mergeMarkdownClasses(base: string, value: unknown): string;
|