docmedown 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +101 -5
- package/dist/docmedown.cjs +44 -44
- package/dist/docmedown.iife.js +311 -311
- package/dist/docmedown.mjs +3795 -3597
- package/dist/types/runtime/components/OfflineNotice.d.ts +6 -0
- package/dist/types/runtime/config-schema.d.ts +9 -0
- package/dist/types/runtime/markdown/inline-text.d.ts +11 -0
- package/dist/types/runtime/offline-export.d.ts +25 -0
- package/dist/types/runtime/types.d.ts +3 -0
- package/package.json +1 -1
- package/schemas/docs.schema.json +11 -0
- package/templates/docs.json +3 -0
|
@@ -137,6 +137,9 @@ export declare const docSearchConfigSchema: z.ZodObject<{
|
|
|
137
137
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
138
138
|
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
139
139
|
}, z.core.$strict>;
|
|
140
|
+
export declare const docOfflineConfigSchema: z.ZodObject<{
|
|
141
|
+
embedNestedDocs: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
}, z.core.$strict>;
|
|
140
143
|
/**
|
|
141
144
|
* Schema for unmerged user configuration. It intentionally keeps `name` optional
|
|
142
145
|
* because callers may provide a partial override that inherits the default name.
|
|
@@ -247,6 +250,9 @@ export declare const docConfigSchema: z.ZodObject<{
|
|
|
247
250
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
248
251
|
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
249
252
|
}, z.core.$strict>>;
|
|
253
|
+
offline: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
embedNestedDocs: z.ZodOptional<z.ZodBoolean>;
|
|
255
|
+
}, z.core.$strict>>;
|
|
250
256
|
footer: z.ZodOptional<z.ZodObject<{
|
|
251
257
|
copyright: z.ZodOptional<z.ZodString>;
|
|
252
258
|
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -366,6 +372,9 @@ export declare const normalizedDocConfigSchema: z.ZodObject<{
|
|
|
366
372
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
367
373
|
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
368
374
|
}, z.core.$strict>>;
|
|
375
|
+
offline: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
embedNestedDocs: z.ZodOptional<z.ZodBoolean>;
|
|
377
|
+
}, z.core.$strict>>;
|
|
369
378
|
footer: z.ZodOptional<z.ZodObject<{
|
|
370
379
|
copyright: z.ZodOptional<z.ZodString>;
|
|
371
380
|
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-text conversion for document headings.
|
|
3
|
+
*
|
|
4
|
+
* README-style headings routinely carry badge images, inline code, links, and
|
|
5
|
+
* HTML entities. The page map renders the full inline HTML (from the same
|
|
6
|
+
* pipeline as article headings), while search indexing, document titles, and
|
|
7
|
+
* accessibility strings need the readable plain-text form produced here.
|
|
8
|
+
*/
|
|
9
|
+
export declare function decodeHtmlEntities(value: string): string;
|
|
10
|
+
/** Reduces a heading's raw Markdown to readable plain text. */
|
|
11
|
+
export declare function inlineHeadingToPlainText(raw: string): string;
|
|
@@ -5,7 +5,17 @@ export interface OfflineDocumentationData {
|
|
|
5
5
|
manifest: DocManifest;
|
|
6
6
|
docs: Record<string, string>;
|
|
7
7
|
componentsSource?: string;
|
|
8
|
+
nestedSites?: Record<string, OfflineNestedSiteData>;
|
|
8
9
|
}
|
|
10
|
+
/** A nested documentation root embedded inside a parent offline bundle. */
|
|
11
|
+
export interface OfflineNestedSiteData {
|
|
12
|
+
name: string;
|
|
13
|
+
manifest: DocManifest;
|
|
14
|
+
docs: Record<string, string>;
|
|
15
|
+
componentsSource?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Emitted when a reader selects a file link a self-contained copy cannot fulfill. */
|
|
18
|
+
export declare const OFFLINE_LINK_EVENT = "docmedown:offline-link-unavailable";
|
|
9
19
|
export interface OfflineEnvelope {
|
|
10
20
|
version: number;
|
|
11
21
|
data: OfflineDocumentationData;
|
|
@@ -13,6 +23,9 @@ export interface OfflineEnvelope {
|
|
|
13
23
|
}
|
|
14
24
|
export declare function sanitizeDownloadName(name: string): string;
|
|
15
25
|
export declare function isOfflineDocumentation(): boolean;
|
|
26
|
+
/** True only for self-contained single-file copies, not the serveable site under file://. */
|
|
27
|
+
export declare function isSelfContainedOffline(): boolean;
|
|
28
|
+
export declare function notifyUnavailableOfflineLink(message?: string): void;
|
|
16
29
|
/**
|
|
17
30
|
* Generates the tiny self-extracting HTML shell shared by CLI and browser
|
|
18
31
|
* exporters. The payload is a base64-encoded gzip stream containing compact
|
|
@@ -24,3 +37,15 @@ export declare function createOfflineDownload(): Promise<{
|
|
|
24
37
|
filename: string;
|
|
25
38
|
}>;
|
|
26
39
|
export declare function downloadOfflineCopy(): Promise<void>;
|
|
40
|
+
export declare function getEmbeddedNestedSites(): Record<string, OfflineNestedSiteData> | null;
|
|
41
|
+
/** True for relative links to other HTML files; hash routes and remote URLs are excluded. */
|
|
42
|
+
export declare function isRelativeHtmlLink(href: string): boolean;
|
|
43
|
+
/** Maps a clicked file link onto an embedded nested documentation site, if any. */
|
|
44
|
+
export declare function matchEmbeddedNestedSite(href: string, sites: Record<string, OfflineNestedSiteData> | null | undefined): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Opens an embedded nested documentation site from inside a self-contained
|
|
47
|
+
* offline copy. The nested site is rebuilt in memory as its own
|
|
48
|
+
* self-extracting page and opened from a blob URL, so no external file or
|
|
49
|
+
* relative link is ever required.
|
|
50
|
+
*/
|
|
51
|
+
export declare function openEmbeddedNestedSite(siteKey: string, href?: string): Promise<void>;
|
|
@@ -36,7 +36,10 @@ export interface DocMeDownInstance {
|
|
|
36
36
|
}
|
|
37
37
|
export interface DocHeading {
|
|
38
38
|
level: number;
|
|
39
|
+
/** Readable plain text (badges become alt text; entities decoded) for search and titles. */
|
|
39
40
|
text: string;
|
|
41
|
+
/** Inline-rendered Markdown for display; omitted in manifest-only heading sets. */
|
|
42
|
+
html?: string;
|
|
40
43
|
id: string;
|
|
41
44
|
}
|
|
42
45
|
export interface DocFrontmatter {
|
package/package.json
CHANGED
package/schemas/docs.schema.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"sidebar": { "type": "array", "items": { "$ref": "#/$defs/sidebarItem" } },
|
|
25
25
|
"autoIndex": { "$ref": "#/$defs/autoIndex" },
|
|
26
26
|
"search": { "$ref": "#/$defs/search" },
|
|
27
|
+
"offline": { "$ref": "#/$defs/offline" },
|
|
27
28
|
"footer": { "$ref": "#/$defs/footer" },
|
|
28
29
|
"componentsUrl": { "type": "string" },
|
|
29
30
|
"editUrl": { "type": "string" }
|
|
@@ -144,6 +145,16 @@
|
|
|
144
145
|
"maxResults": { "type": "integer", "minimum": 1, "maximum": 100 }
|
|
145
146
|
}
|
|
146
147
|
},
|
|
148
|
+
"offline": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"properties": {
|
|
152
|
+
"embedNestedDocs": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"description": "Embed nested documentation sites into the single-file offline bundle so no external files are needed. Defaults to true; when false, links to other documentation files render as disabled links offline."
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
147
158
|
"footer": {
|
|
148
159
|
"type": "object",
|
|
149
160
|
"additionalProperties": false,
|