@leadertechie/md2html 0.1.0-alpha.5 → 0.1.0-alpha.6
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/index.d.ts +83 -7
- package/package.json +3 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/lit-renderer.d.ts +0 -10
- package/dist/lit-renderer.d.ts.map +0 -1
- package/dist/parser.d.ts +0 -16
- package/dist/parser.d.ts.map +0 -1
- package/dist/pipeline.d.ts +0 -18
- package/dist/pipeline.d.ts.map +0 -1
- package/dist/renderer.d.ts +0 -15
- package/dist/renderer.d.ts.map +0 -1
- package/dist/types.d.ts +0 -33
- package/dist/types.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare interface ContentNode {
|
|
4
|
+
type: ContentNodeType;
|
|
5
|
+
content?: string;
|
|
6
|
+
children?: ContentNode[];
|
|
7
|
+
attributes?: Record<string, unknown>;
|
|
8
|
+
className?: string;
|
|
9
|
+
src?: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
ordered?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare type ContentNodeType = 'text' | 'heading' | 'paragraph' | 'list' | 'list-item' | 'image' | 'code' | 'container' | 'strong' | 'emphasis';
|
|
15
|
+
|
|
16
|
+
declare class LitRenderer {
|
|
17
|
+
private renderTextNode;
|
|
18
|
+
renderNode(node: ContentNode): TemplateResult;
|
|
19
|
+
renderNodes(nodes: ContentNode[]): TemplateResult;
|
|
20
|
+
renderToHTMLString(nodes: ContentNode[]): string;
|
|
21
|
+
private nodeToHTMLString;
|
|
22
|
+
}
|
|
23
|
+
export { LitRenderer as HTMLRenderer }
|
|
24
|
+
export { LitRenderer }
|
|
25
|
+
|
|
26
|
+
export declare interface MarkdownContent {
|
|
27
|
+
title: string;
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
content: ContentNode[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare class MarkdownParser {
|
|
33
|
+
private imagePathPrefix;
|
|
34
|
+
private imageBaseUrl;
|
|
35
|
+
constructor(options?: {
|
|
36
|
+
imagePathPrefix?: string;
|
|
37
|
+
imageBaseUrl?: string;
|
|
38
|
+
});
|
|
39
|
+
private processImagePath;
|
|
40
|
+
private processInlineFormatting;
|
|
41
|
+
private parseTokens;
|
|
42
|
+
private parseToken;
|
|
43
|
+
parse(markdown: string, options?: ParseOptions): MarkdownContent;
|
|
44
|
+
parseToNodes(markdown: string, options?: ParseOptions): ContentNode[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare class MarkdownPipeline {
|
|
48
|
+
private parser;
|
|
49
|
+
private renderer;
|
|
50
|
+
private config;
|
|
51
|
+
constructor(config?: PipelineConfig);
|
|
52
|
+
parse(markdown: string): ContentNode[];
|
|
53
|
+
parseWithMetadata(markdown: string): MarkdownContent;
|
|
54
|
+
render(nodes: ContentNode[]): string;
|
|
55
|
+
renderMarkdown(markdown: string): string;
|
|
56
|
+
renderPage(title: string, nodes: ContentNode[], options?: {
|
|
57
|
+
lang?: string;
|
|
58
|
+
charset?: string;
|
|
59
|
+
}): string;
|
|
60
|
+
getConfig(): Readonly<Required<PipelineConfig>>;
|
|
61
|
+
getCustomCSS(): string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare interface ParseOptions {
|
|
65
|
+
gfm?: boolean;
|
|
66
|
+
breaks?: boolean;
|
|
67
|
+
pedantic?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export declare interface PipelineConfig {
|
|
71
|
+
imagePathPrefix?: string;
|
|
72
|
+
imageBaseUrl?: string;
|
|
73
|
+
parseOptions?: ParseOptions;
|
|
74
|
+
styleOptions?: StyleConfig;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare interface StyleConfig {
|
|
78
|
+
classPrefix?: string;
|
|
79
|
+
customCSS?: string;
|
|
80
|
+
addHeadingIds?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leadertechie/md2html",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.6",
|
|
4
4
|
"description": "Markdown to HTML pipeline - parse markdown to AST, render to HTML or Lit templates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "vite build
|
|
16
|
+
"build": "vite build",
|
|
17
17
|
"test": "vitest run"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@types/node": "^20.0.0",
|
|
27
27
|
"typescript": "^5.0.0",
|
|
28
28
|
"vite": "^7.3.1",
|
|
29
|
+
"vite-plugin-dts": "^4.5.4",
|
|
29
30
|
"vitest": "^3.0.0"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/lit-renderer.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit';
|
|
2
|
-
import { ContentNode } from './types';
|
|
3
|
-
export declare class LitRenderer {
|
|
4
|
-
private renderTextNode;
|
|
5
|
-
renderNode(node: ContentNode): TemplateResult;
|
|
6
|
-
renderNodes(nodes: ContentNode[]): TemplateResult;
|
|
7
|
-
renderToHTMLString(nodes: ContentNode[]): string;
|
|
8
|
-
private nodeToHTMLString;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=lit-renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lit-renderer.d.ts","sourceRoot":"","sources":["../src/lit-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc;IAOtB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc;IAyC7C,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc;IAOjD,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM;IAOhD,OAAO,CAAC,gBAAgB;CAuBzB"}
|
package/dist/parser.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ContentNode, MarkdownContent, ParseOptions } from './types';
|
|
2
|
-
export declare class MarkdownParser {
|
|
3
|
-
private imagePathPrefix;
|
|
4
|
-
private imageBaseUrl;
|
|
5
|
-
constructor(options?: {
|
|
6
|
-
imagePathPrefix?: string;
|
|
7
|
-
imageBaseUrl?: string;
|
|
8
|
-
});
|
|
9
|
-
private processImagePath;
|
|
10
|
-
private processInlineFormatting;
|
|
11
|
-
private parseTokens;
|
|
12
|
-
private parseToken;
|
|
13
|
-
parse(markdown: string, options?: ParseOptions): MarkdownContent;
|
|
14
|
-
parseToNodes(markdown: string, options?: ParseOptions): ContentNode[];
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=parser.d.ts.map
|
package/dist/parser.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErE,qBAAa,cAAc;IACzB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;IAKzE,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IAgFlB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe;IAgBhE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,EAAE;CAGtE"}
|
package/dist/pipeline.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ContentNode, MarkdownContent, PipelineConfig } from './types.js';
|
|
2
|
-
export declare class MarkdownPipeline {
|
|
3
|
-
private parser;
|
|
4
|
-
private renderer;
|
|
5
|
-
private config;
|
|
6
|
-
constructor(config?: PipelineConfig);
|
|
7
|
-
parse(markdown: string): ContentNode[];
|
|
8
|
-
parseWithMetadata(markdown: string): MarkdownContent;
|
|
9
|
-
render(nodes: ContentNode[]): string;
|
|
10
|
-
renderMarkdown(markdown: string): string;
|
|
11
|
-
renderPage(title: string, nodes: ContentNode[], options?: {
|
|
12
|
-
lang?: string;
|
|
13
|
-
charset?: string;
|
|
14
|
-
}): string;
|
|
15
|
-
getConfig(): Readonly<Required<PipelineConfig>>;
|
|
16
|
-
getCustomCSS(): string;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=pipeline.d.ts.map
|
package/dist/pipeline.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAEvF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAA2B;gBAE7B,MAAM,GAAE,cAAmB;IAuBvC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IAItC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAIpD,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM;IAIpC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAKxC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE;QACxD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,MAAM;IAeV,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAI/C,YAAY,IAAI,MAAM;CAGvB"}
|
package/dist/renderer.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ContentNode, StyleConfig } from './types.js';
|
|
2
|
-
export declare class HTMLRenderer {
|
|
3
|
-
private config;
|
|
4
|
-
constructor(config?: StyleConfig);
|
|
5
|
-
private hasClassConfig;
|
|
6
|
-
private getClass;
|
|
7
|
-
private generateHeadingId;
|
|
8
|
-
private renderWithClass;
|
|
9
|
-
renderNode(node: ContentNode): string;
|
|
10
|
-
renderNodes(nodes: ContentNode[]): string;
|
|
11
|
-
renderToHTMLString(nodes: ContentNode[]): string;
|
|
12
|
-
render(markdown: string): string;
|
|
13
|
-
getCustomCSS(): string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=renderer.d.ts.map
|
package/dist/renderer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAwB;gBAE1B,MAAM,GAAE,WAAgB;IAQpC,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,eAAe;IAOvB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;IA4DrC,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM;IAOzC,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM;IAIhD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIhC,YAAY,IAAI,MAAM;CAGvB"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type ContentNodeType = 'text' | 'heading' | 'paragraph' | 'list' | 'list-item' | 'image' | 'code' | 'container' | 'strong' | 'emphasis';
|
|
2
|
-
export interface ContentNode {
|
|
3
|
-
type: ContentNodeType;
|
|
4
|
-
content?: string;
|
|
5
|
-
children?: ContentNode[];
|
|
6
|
-
attributes?: Record<string, unknown>;
|
|
7
|
-
className?: string;
|
|
8
|
-
src?: string;
|
|
9
|
-
alt?: string;
|
|
10
|
-
ordered?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface MarkdownContent {
|
|
13
|
-
title: string;
|
|
14
|
-
metadata?: Record<string, unknown>;
|
|
15
|
-
content: ContentNode[];
|
|
16
|
-
}
|
|
17
|
-
export interface ParseOptions {
|
|
18
|
-
gfm?: boolean;
|
|
19
|
-
breaks?: boolean;
|
|
20
|
-
pedantic?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface StyleConfig {
|
|
23
|
-
classPrefix?: string;
|
|
24
|
-
customCSS?: string;
|
|
25
|
-
addHeadingIds?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface PipelineConfig {
|
|
28
|
-
imagePathPrefix?: string;
|
|
29
|
-
imageBaseUrl?: string;
|
|
30
|
-
parseOptions?: ParseOptions;
|
|
31
|
-
styleOptions?: StyleConfig;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,SAAS,GACT,WAAW,GACX,MAAM,GACN,WAAW,GACX,OAAO,GACP,MAAM,GACN,WAAW,GACX,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B"}
|