create-markdown 0.2.2 → 0.4.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.
@@ -1,30 +0,0 @@
1
- /**
2
- * create-markdown — Markdown Serializer
3
- * Convert: blocks to markdown strings
4
- */
5
- import type { Block, TextSpan, MarkdownSerializeOptions, Document } from '../types';
6
- /**
7
- * Converts: array of blocks to a markdown string
8
- */
9
- export declare function blocksToMarkdown(blocks: Block[], options?: MarkdownSerializeOptions): string;
10
- /**
11
- * Converts: document to a markdown string
12
- */
13
- export declare function documentToMarkdown(doc: Document, options?: MarkdownSerializeOptions): string;
14
- /**
15
- * Serializes: single block to markdown
16
- */
17
- export declare function serializeBlock(block: Block, depth: number, options: Required<MarkdownSerializeOptions>, index?: number, siblings?: Block[]): string;
18
- /**
19
- * Serializes: array of text spans to markdown
20
- */
21
- export declare function serializeInlineContent(spans: TextSpan[], options: Required<MarkdownSerializeOptions>): string;
22
- /**
23
- * Serializes: single text span with its styles
24
- */
25
- export declare function serializeSpan(span: TextSpan, options: Required<MarkdownSerializeOptions>): string;
26
- /**
27
- * Quick stringify function - converts: blocks to markdown
28
- */
29
- export declare function stringify(blocks: Block[], options?: MarkdownSerializeOptions): string;
30
- //# sourceMappingURL=markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/serializers/markdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACR,KAAK,EACL,QAAQ,EAER,wBAAwB,EACxB,QAAQ,EAOX,MAAM,UAAU,CAAC;AAoBlB;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,KAAK,EAAE,EACf,OAAO,GAAE,wBAA6B,GACvC,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,GAAG,EAAE,QAAQ,EACb,OAAO,GAAE,wBAA6B,GACvC,MAAM,CAER;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,EAC3C,KAAK,GAAE,MAAU,EACjB,QAAQ,GAAE,KAAK,EAAO,GACvB,MAAM,CAuCR;AAgOD;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,GAC5C,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,aAAa,CACzB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,GAC5C,MAAM,CAuDR;AAqBD;;GAEG;AACH,wBAAgB,SAAS,CACrB,MAAM,EAAE,KAAK,EAAE,EACf,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAER"}
@@ -1,199 +0,0 @@
1
- /**
2
- * create-markdown - Type Definitions
3
- * Block-based document structure for markdown notes
4
- */
5
- /**
6
- * All supported block types in the document
7
- */
8
- export type BlockType = 'paragraph' | 'heading' | 'bulletList' | 'numberedList' | 'checkList' | 'codeBlock' | 'blockquote' | 'table' | 'image' | 'divider' | 'callout';
9
- /**
10
- * Callout variants for styled callout blocks
11
- */
12
- export type CalloutType = 'info' | 'warning' | 'tip' | 'danger' | 'note';
13
- /**
14
- * Link data for inline links
15
- */
16
- export interface LinkData {
17
- url: string;
18
- title?: string;
19
- }
20
- /**
21
- * Inline styles that can be applied to text spans
22
- */
23
- export interface InlineStyle {
24
- bold?: boolean;
25
- italic?: boolean;
26
- underline?: boolean;
27
- strikethrough?: boolean;
28
- code?: boolean;
29
- highlight?: boolean;
30
- link?: LinkData;
31
- }
32
- /**
33
- * A span of text with optional inline styles
34
- */
35
- export interface TextSpan {
36
- text: string;
37
- styles: InlineStyle;
38
- }
39
- /**
40
- * Properties for heading blocks
41
- */
42
- export interface HeadingProps {
43
- level: 1 | 2 | 3 | 4 | 5 | 6;
44
- }
45
- /**
46
- * Properties for code blocks
47
- */
48
- export interface CodeBlockProps {
49
- language?: string;
50
- }
51
- /**
52
- * Properties for checklist items
53
- */
54
- export interface CheckListProps {
55
- checked: boolean;
56
- }
57
- /**
58
- * Properties for image blocks
59
- */
60
- export interface ImageProps {
61
- url: string;
62
- alt?: string;
63
- title?: string;
64
- width?: number;
65
- height?: number;
66
- }
67
- /**
68
- * Properties for callout blocks
69
- */
70
- export interface CalloutProps {
71
- type: CalloutType;
72
- }
73
- /**
74
- * Properties for table blocks
75
- */
76
- export interface TableProps {
77
- headers: string[];
78
- rows: string[][];
79
- alignments?: ('left' | 'center' | 'right' | null)[];
80
- }
81
- /**
82
- * Empty props for blocks that don't need additional properties
83
- */
84
- export interface EmptyProps {
85
- }
86
- /**
87
- * Map of block types to their property interfaces
88
- */
89
- export interface BlockPropsMap {
90
- paragraph: EmptyProps;
91
- heading: HeadingProps;
92
- bulletList: EmptyProps;
93
- numberedList: EmptyProps;
94
- checkList: CheckListProps;
95
- codeBlock: CodeBlockProps;
96
- blockquote: EmptyProps;
97
- table: TableProps;
98
- image: ImageProps;
99
- divider: EmptyProps;
100
- callout: CalloutProps;
101
- }
102
- /**
103
- * Get the props type for a specific block type
104
- */
105
- export type BlockProps<T extends BlockType> = BlockPropsMap[T];
106
- /**
107
- * Block in the document
108
- * @template T - The block type
109
- */
110
- export interface Block<T extends BlockType = BlockType> {
111
- /** Unique identifier for the block */
112
- id: string;
113
- /** The type of block */
114
- type: T;
115
- /** Inline content (text spans with styles) */
116
- content: TextSpan[];
117
- /** Nested child blocks (for lists, etc.) */
118
- children: Block[];
119
- /** Type-specific properties */
120
- props: BlockProps<T>;
121
- }
122
- /**
123
- * Type-safe block creators
124
- */
125
- export type ParagraphBlock = Block<'paragraph'>;
126
- export type HeadingBlock = Block<'heading'>;
127
- export type BulletListBlock = Block<'bulletList'>;
128
- export type NumberedListBlock = Block<'numberedList'>;
129
- export type CheckListBlock = Block<'checkList'>;
130
- export type CodeBlockBlock = Block<'codeBlock'>;
131
- export type BlockquoteBlock = Block<'blockquote'>;
132
- export type TableBlock = Block<'table'>;
133
- export type ImageBlock = Block<'image'>;
134
- export type DividerBlock = Block<'divider'>;
135
- export type CalloutBlock = Block<'callout'>;
136
- /**
137
- * Document metadata
138
- */
139
- export interface DocumentMeta {
140
- /** Document title */
141
- title?: string;
142
- /** Document description */
143
- description?: string;
144
- /** Author information */
145
- author?: string;
146
- /** Creation timestamp */
147
- createdAt?: Date;
148
- /** Last modification timestamp */
149
- updatedAt?: Date;
150
- /** Custom metadata fields */
151
- [key: string]: unknown;
152
- }
153
- /**
154
- * Complete markdown document
155
- */
156
- export interface Document {
157
- /** Document version for migrations */
158
- version: number;
159
- /** Array of blocks in the document */
160
- blocks: Block[];
161
- /** Document metadata */
162
- meta: DocumentMeta;
163
- }
164
- /**
165
- * Options for markdown serialization
166
- */
167
- export interface MarkdownSerializeOptions {
168
- /** Line ending character(s) */
169
- lineEnding?: '\n' | '\r\n';
170
- /** Number of spaces for list indentation */
171
- listIndent?: number;
172
- /** Heading style */
173
- headingStyle?: 'atx' | 'setext';
174
- /** Code block style */
175
- codeBlockStyle?: 'fenced' | 'indented';
176
- /** Bullet character for unordered lists */
177
- bulletChar?: '-' | '*' | '+';
178
- /** Emphasis character for bold/italic */
179
- emphasisChar?: '*' | '_';
180
- }
181
- /**
182
- * Options for markdown parsing
183
- */
184
- export interface MarkdownParseOptions {
185
- /** Custom ID generator function */
186
- generateId?: () => string;
187
- /** Enable strict parsing mode */
188
- strict?: boolean;
189
- }
190
- /**
191
- * Options for document creation
192
- */
193
- export interface DocumentOptions {
194
- /** Initial metadata */
195
- meta?: Partial<DocumentMeta>;
196
- /** Custom ID generator */
197
- generateId?: () => string;
198
- }
199
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AAC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