@b4moss/hyogen-md 0.10.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 +130 -0
- package/README_ja.md +130 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.js +2930 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +3109 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
2
|
+
|
|
3
|
+
export declare type BuildOptions = RenderOptions & {
|
|
4
|
+
input: string | string[];
|
|
5
|
+
outDir: string;
|
|
6
|
+
includeUnderscoreEntries?: boolean;
|
|
7
|
+
context?: HyogenContext;
|
|
8
|
+
serverContext?: HyogenContext;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare type BuildResult = {
|
|
12
|
+
files: {
|
|
13
|
+
path: string;
|
|
14
|
+
markdown: string;
|
|
15
|
+
}[];
|
|
16
|
+
warnings: HyogenWarning[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
declare type ClientRenderOptions = RenderOptions & {
|
|
20
|
+
/** Rejected on client — use renderServer/build instead */
|
|
21
|
+
serverContext?: HyogenContext;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export declare function createFsLoader(options?: FsLoaderOptions): Loader;
|
|
25
|
+
|
|
26
|
+
export declare function createHyogenError(options: {
|
|
27
|
+
code: string;
|
|
28
|
+
message?: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
details?: Record<string, unknown>;
|
|
31
|
+
}): HyogenError;
|
|
32
|
+
|
|
33
|
+
export declare function createNodeLoader(options?: NodeLoaderOptions): Loader;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Formats a diagnostic as multi-line log text (api.md).
|
|
37
|
+
* Does not write to console — callers decide how to output.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatDiagnosticLog(kind: "error" | "warning", diagnostic: HyogenDiagnostic): string;
|
|
40
|
+
|
|
41
|
+
/** Unknown codes resolve to empty string (implementation choice for v0.1). */
|
|
42
|
+
export declare function formatMessage(code: string, details?: Record<string, unknown>): string;
|
|
43
|
+
|
|
44
|
+
declare type FsLoaderOptions = {
|
|
45
|
+
from?: string;
|
|
46
|
+
via?: "include" | "component" | "extend";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export declare type HyogenContext = Record<string, unknown>;
|
|
50
|
+
|
|
51
|
+
export declare type HyogenDiagnostic = {
|
|
52
|
+
code: string;
|
|
53
|
+
message: string;
|
|
54
|
+
path?: string;
|
|
55
|
+
details?: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export declare type HyogenError = Error & HyogenDiagnostic;
|
|
59
|
+
|
|
60
|
+
export declare type HyogenWarning = HyogenDiagnostic;
|
|
61
|
+
|
|
62
|
+
/** Returns true when path is an http(s) URL. */
|
|
63
|
+
export declare function isRemotePath(path: string): boolean;
|
|
64
|
+
|
|
65
|
+
export declare type Loader = (path: string) => Promise<string>;
|
|
66
|
+
|
|
67
|
+
declare type NodeLoaderOptions = FsLoaderOptions;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Client-side render entry. Requires an injected loader; never uses
|
|
71
|
+
* createNodeLoader / resolveRenderInput (no FS or network in the library).
|
|
72
|
+
*/
|
|
73
|
+
export declare function renderClient(input: string | {
|
|
74
|
+
path: string;
|
|
75
|
+
}, context?: HyogenContext, options?: ClientRenderOptions): Promise<RenderResult>;
|
|
76
|
+
|
|
77
|
+
export declare type RenderOptions = {
|
|
78
|
+
preserveFrontMatter?: boolean;
|
|
79
|
+
preserveHgComments?: boolean;
|
|
80
|
+
loader?: Loader;
|
|
81
|
+
root?: string;
|
|
82
|
+
path?: string;
|
|
83
|
+
constrainToRoot?: boolean;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export declare type RenderResult = {
|
|
87
|
+
markdown: string;
|
|
88
|
+
warnings: HyogenWarning[];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export declare function renderServer(input: string | {
|
|
92
|
+
path: string;
|
|
93
|
+
}, context?: HyogenContext, options?: ServerRenderOptions): Promise<RenderResult>;
|
|
94
|
+
|
|
95
|
+
export declare type ServerRenderOptions = RenderOptions & {
|
|
96
|
+
serverContext?: HyogenContext;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { }
|