@changerawr/markdown 1.0.1 → 1.0.3
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.mts +8 -233
- package/dist/index.d.ts +8 -233
- package/dist/index.js +35 -481
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -454
- package/dist/index.mjs.map +1 -1
- package/dist/standalone.d.mts +3 -2
- package/dist/standalone.d.ts +3 -2
- package/dist/standalone.js +1 -8
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +1 -8
- package/dist/standalone.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -164,88 +164,6 @@ declare function renderToHTMLWithConfig(markdown: string, rendererConfig: {
|
|
|
164
164
|
*/
|
|
165
165
|
declare function renderToHTMLUnsafe(markdown: string): string;
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
* JSON AST output renderer - returns structured token data
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Parse markdown and return the token array as JSON
|
|
173
|
-
*/
|
|
174
|
-
declare function renderToJSON(markdown: string, config?: Omit<EngineConfig, 'renderer'>): MarkdownToken[];
|
|
175
|
-
/**
|
|
176
|
-
* Parse markdown and return a hierarchical AST structure
|
|
177
|
-
*/
|
|
178
|
-
declare function renderToAST(markdown: string, config?: Omit<EngineConfig, 'renderer'>): JsonAstNode[];
|
|
179
|
-
/**
|
|
180
|
-
* Convert flat token array to hierarchical AST
|
|
181
|
-
*/
|
|
182
|
-
declare function tokensToAST(tokens: MarkdownToken[]): JsonAstNode[];
|
|
183
|
-
/**
|
|
184
|
-
* Convert AST back to flat tokens
|
|
185
|
-
*/
|
|
186
|
-
declare function astToTokens(ast: JsonAstNode[]): MarkdownToken[];
|
|
187
|
-
/**
|
|
188
|
-
* Serialize tokens to JSON string with formatting
|
|
189
|
-
*/
|
|
190
|
-
declare function tokensToJSONString(tokens: MarkdownToken[], pretty?: boolean): string;
|
|
191
|
-
/**
|
|
192
|
-
* Serialize AST to JSON string with formatting
|
|
193
|
-
*/
|
|
194
|
-
declare function astToJSONString(ast: JsonAstNode[], pretty?: boolean): string;
|
|
195
|
-
/**
|
|
196
|
-
* Parse JSON string back to tokens
|
|
197
|
-
*/
|
|
198
|
-
declare function parseTokensFromJSON(jsonString: string): MarkdownToken[];
|
|
199
|
-
/**
|
|
200
|
-
* Parse JSON string back to AST
|
|
201
|
-
*/
|
|
202
|
-
declare function parseASTFromJSON(jsonString: string): JsonAstNode[];
|
|
203
|
-
/**
|
|
204
|
-
* Get comprehensive statistics from parsed tokens
|
|
205
|
-
*/
|
|
206
|
-
declare function getTokenStats(tokens: MarkdownToken[]): TokenStatistics;
|
|
207
|
-
/**
|
|
208
|
-
* Get AST-specific statistics
|
|
209
|
-
*/
|
|
210
|
-
declare function getASTStats(ast: JsonAstNode[]): ASTStatistics;
|
|
211
|
-
/**
|
|
212
|
-
* Compare two token arrays for differences
|
|
213
|
-
*/
|
|
214
|
-
declare function compareTokens(tokensA: MarkdownToken[], tokensB: MarkdownToken[]): TokenComparison;
|
|
215
|
-
interface TokenStatistics {
|
|
216
|
-
totalTokens: number;
|
|
217
|
-
tokenTypes: Record<string, number>;
|
|
218
|
-
extensionTokens: Record<string, number>;
|
|
219
|
-
totalContent: number;
|
|
220
|
-
totalRaw: number;
|
|
221
|
-
tokensWithAttributes: number;
|
|
222
|
-
averageContentLength: number;
|
|
223
|
-
averageRawLength: number;
|
|
224
|
-
attributeUsageRate: number;
|
|
225
|
-
}
|
|
226
|
-
interface ASTStatistics {
|
|
227
|
-
totalNodes: number;
|
|
228
|
-
maxDepth: number;
|
|
229
|
-
nodesWithChildren: number;
|
|
230
|
-
totalChildren: number;
|
|
231
|
-
nodeTypes: Record<string, number>;
|
|
232
|
-
averageChildrenPerParent: number;
|
|
233
|
-
hierarchyComplexity: number;
|
|
234
|
-
}
|
|
235
|
-
interface TokenDifference {
|
|
236
|
-
index: number;
|
|
237
|
-
type: 'added' | 'removed' | 'modified';
|
|
238
|
-
tokenA?: MarkdownToken;
|
|
239
|
-
tokenB?: MarkdownToken;
|
|
240
|
-
}
|
|
241
|
-
interface TokenComparison {
|
|
242
|
-
identical: boolean;
|
|
243
|
-
differences: TokenDifference[];
|
|
244
|
-
addedCount: number;
|
|
245
|
-
removedCount: number;
|
|
246
|
-
modifiedCount: number;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
167
|
/**
|
|
250
168
|
* Tailwind CSS output renderer - HTML with Tailwind CSS classes
|
|
251
169
|
*/
|
|
@@ -267,70 +185,19 @@ declare function renderToTailwindWithConfig(markdown: string, rendererConfig: {
|
|
|
267
185
|
customClasses?: Record<string, string>;
|
|
268
186
|
debugMode?: boolean;
|
|
269
187
|
}): string;
|
|
188
|
+
|
|
270
189
|
/**
|
|
271
|
-
*
|
|
272
|
-
*/
|
|
273
|
-
declare const defaultTailwindClasses: {
|
|
274
|
-
'heading-1': string;
|
|
275
|
-
'heading-2': string;
|
|
276
|
-
'heading-3': string;
|
|
277
|
-
'heading-4': string;
|
|
278
|
-
'heading-5': string;
|
|
279
|
-
'heading-6': string;
|
|
280
|
-
paragraph: string;
|
|
281
|
-
blockquote: string;
|
|
282
|
-
'code-inline': string;
|
|
283
|
-
'code-block': string;
|
|
284
|
-
link: string;
|
|
285
|
-
button: string;
|
|
286
|
-
list: string;
|
|
287
|
-
'list-item': string;
|
|
288
|
-
image: string;
|
|
289
|
-
embed: string;
|
|
290
|
-
alert: string;
|
|
291
|
-
'alert-info': string;
|
|
292
|
-
'alert-warning': string;
|
|
293
|
-
'alert-error': string;
|
|
294
|
-
'alert-success': string;
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* Prose-friendly Tailwind classes for blog/article content
|
|
190
|
+
* JSON AST output renderer - returns structured token data
|
|
298
191
|
*/
|
|
299
|
-
|
|
300
|
-
'heading-1': string;
|
|
301
|
-
'heading-2': string;
|
|
302
|
-
'heading-3': string;
|
|
303
|
-
paragraph: string;
|
|
304
|
-
blockquote: string;
|
|
305
|
-
'code-inline': string;
|
|
306
|
-
'code-block': string;
|
|
307
|
-
link: string;
|
|
308
|
-
};
|
|
192
|
+
|
|
309
193
|
/**
|
|
310
|
-
*
|
|
194
|
+
* Parse markdown and return the token array as JSON
|
|
311
195
|
*/
|
|
312
|
-
declare
|
|
313
|
-
'heading-1': string;
|
|
314
|
-
'heading-2': string;
|
|
315
|
-
'heading-3': string;
|
|
316
|
-
paragraph: string;
|
|
317
|
-
blockquote: string;
|
|
318
|
-
'code-inline': string;
|
|
319
|
-
'code-block': string;
|
|
320
|
-
link: string;
|
|
321
|
-
};
|
|
322
|
-
|
|
196
|
+
declare function renderToJSON(markdown: string, config?: Omit<EngineConfig, 'renderer'>): MarkdownToken[];
|
|
323
197
|
/**
|
|
324
|
-
*
|
|
325
|
-
* No React dependencies - works in browser and Node.js environments
|
|
198
|
+
* Parse markdown and return a hierarchical AST structure
|
|
326
199
|
*/
|
|
327
|
-
|
|
328
|
-
declare function renderCum(markdown: string, config?: EngineConfig): string;
|
|
329
|
-
declare function parseCum(markdown: string, config?: EngineConfig): MarkdownToken[];
|
|
330
|
-
declare function createCumEngine(config?: EngineConfig): ChangerawrMarkdown;
|
|
331
|
-
declare function renderCumToHtml(markdown: string): string;
|
|
332
|
-
declare function renderCumToTailwind(markdown: string): string;
|
|
333
|
-
declare function renderCumToJson(markdown: string): MarkdownToken[];
|
|
200
|
+
declare function renderToAST(markdown: string, config?: Omit<EngineConfig, 'renderer'>): JsonAstNode[];
|
|
334
201
|
|
|
335
202
|
/**
|
|
336
203
|
* Utility functions for Changerawr Markdown
|
|
@@ -347,34 +214,10 @@ declare function generateId(text: string): string;
|
|
|
347
214
|
* Sanitize HTML content using DOMPurify
|
|
348
215
|
*/
|
|
349
216
|
declare function sanitizeHtml(html: string): string;
|
|
350
|
-
/**
|
|
351
|
-
* Basic HTML sanitization - removes dangerous content
|
|
352
|
-
*/
|
|
353
|
-
declare function basicSanitize(html: string): string;
|
|
354
|
-
/**
|
|
355
|
-
* Check if code is running in browser environment
|
|
356
|
-
*/
|
|
357
|
-
declare function isBrowser(): boolean;
|
|
358
|
-
/**
|
|
359
|
-
* Check if code is running in Node.js environment
|
|
360
|
-
*/
|
|
361
|
-
declare function isNode(): boolean;
|
|
362
|
-
/**
|
|
363
|
-
* Debounce function for performance optimization
|
|
364
|
-
*/
|
|
365
|
-
declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
366
|
-
/**
|
|
367
|
-
* Deep merge two objects
|
|
368
|
-
*/
|
|
369
|
-
declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
|
|
370
217
|
/**
|
|
371
218
|
* Extract domain from URL
|
|
372
219
|
*/
|
|
373
220
|
declare function extractDomain(url: string): string;
|
|
374
|
-
/**
|
|
375
|
-
* Check if URL is valid
|
|
376
|
-
*/
|
|
377
|
-
declare function isValidUrl(url: string): boolean;
|
|
378
221
|
/**
|
|
379
222
|
* Parse options string into key-value object
|
|
380
223
|
*/
|
|
@@ -497,8 +340,6 @@ declare const markdown: {
|
|
|
497
340
|
readonly createDebugEngine: typeof createDebugEngine;
|
|
498
341
|
readonly createMinimalEngine: typeof createMinimalEngine;
|
|
499
342
|
readonly createCustomEngine: typeof createCustomEngine;
|
|
500
|
-
readonly renderCum: typeof renderCum;
|
|
501
|
-
readonly parseCum: typeof parseCum;
|
|
502
343
|
readonly ChangerawrMarkdown: typeof ChangerawrMarkdown;
|
|
503
344
|
readonly extensions: {
|
|
504
345
|
readonly Alert: Extension;
|
|
@@ -516,70 +357,4 @@ declare const markdown: {
|
|
|
516
357
|
};
|
|
517
358
|
};
|
|
518
359
|
|
|
519
|
-
|
|
520
|
-
* Preset configurations for common use cases
|
|
521
|
-
*/
|
|
522
|
-
declare const presets: {
|
|
523
|
-
/**
|
|
524
|
-
* Blog/article preset with prose-friendly styling
|
|
525
|
-
*/
|
|
526
|
-
readonly blog: {
|
|
527
|
-
readonly renderer: {
|
|
528
|
-
readonly format: "tailwind";
|
|
529
|
-
readonly customClasses: {
|
|
530
|
-
readonly 'heading-1': "text-4xl font-bold tracking-tight mt-10 mb-6";
|
|
531
|
-
readonly 'heading-2': "text-3xl font-semibold tracking-tight mt-8 mb-4";
|
|
532
|
-
readonly 'heading-3': "text-2xl font-medium tracking-tight mt-6 mb-3";
|
|
533
|
-
readonly paragraph: "text-lg leading-8 mb-6";
|
|
534
|
-
readonly blockquote: "border-l-4 border-gray-300 pl-6 py-2 italic text-gray-700 my-6";
|
|
535
|
-
readonly 'code-inline': "bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm font-mono";
|
|
536
|
-
readonly 'code-block': "bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto my-6 text-sm";
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
};
|
|
540
|
-
/**
|
|
541
|
-
* Documentation preset with clean, technical styling
|
|
542
|
-
*/
|
|
543
|
-
readonly docs: {
|
|
544
|
-
readonly renderer: {
|
|
545
|
-
readonly format: "tailwind";
|
|
546
|
-
readonly customClasses: {
|
|
547
|
-
readonly 'heading-1': "text-3xl font-bold border-b border-gray-200 pb-2 mb-6";
|
|
548
|
-
readonly 'heading-2': "text-2xl font-semibold mt-8 mb-4";
|
|
549
|
-
readonly 'heading-3': "text-xl font-medium mt-6 mb-3";
|
|
550
|
-
readonly paragraph: "leading-7 mb-4";
|
|
551
|
-
readonly 'code-inline': "bg-blue-50 text-blue-800 px-2 py-1 rounded text-sm font-mono";
|
|
552
|
-
readonly 'code-block': "bg-gray-50 border border-gray-200 p-4 rounded-lg overflow-x-auto my-4 text-sm";
|
|
553
|
-
readonly alert: "border border-blue-200 bg-blue-50 text-blue-800 p-4 rounded-lg mb-4";
|
|
554
|
-
};
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Minimal preset with basic styling
|
|
559
|
-
*/
|
|
560
|
-
readonly minimal: {
|
|
561
|
-
readonly renderer: {
|
|
562
|
-
readonly format: "html";
|
|
563
|
-
readonly sanitize: true;
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
/**
|
|
567
|
-
* Performance preset with minimal processing
|
|
568
|
-
*/
|
|
569
|
-
readonly fast: {
|
|
570
|
-
readonly parser: {
|
|
571
|
-
readonly validateMarkdown: false;
|
|
572
|
-
readonly maxIterations: 1000;
|
|
573
|
-
};
|
|
574
|
-
readonly renderer: {
|
|
575
|
-
readonly format: "html";
|
|
576
|
-
readonly sanitize: false;
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
};
|
|
580
|
-
/**
|
|
581
|
-
* Create engine with preset configuration
|
|
582
|
-
*/
|
|
583
|
-
declare function createEngineWithPreset(presetName: keyof typeof presets, additionalConfig?: EngineConfig): ChangerawrMarkdown;
|
|
584
|
-
|
|
585
|
-
export { type ASTStatistics, AlertExtension, ButtonExtension, ChangerawrMarkdown, type DebugInfo, EmbedExtension, type EngineConfig, type EngineEvents, type Extension, ExtensionError, type Extension as ExtensionInterface, type ExtensionRegistration, type JsonAstNode, Logger, MarkdownParseError, MarkdownParser, MarkdownRenderError, MarkdownRenderer, type MarkdownToken, type OutputFormat, type ParseRule, type ParserConfig, type PerformanceMetrics, PerformanceTimer, type RenderRule, type RendererConfig, type TokenComparison, type TokenDifference, type TokenStatistics, type TokenType, astToJSONString, astToTokens, basicSanitize, compareTokens, createCumEngine, createCustomEngine, createDebugEngine, createEngine, createEngineWithPreset, createHTMLEngine, createMinimalEngine, createTailwindEngine, debounce, deepMerge, markdown as default, defaultTailwindClasses, escapeHtml, extractDomain, generateId, getASTStats, getTokenStats, isBrowser, isNode, isValidUrl, markdown, minimalClasses, parseASTFromJSON, parseCum, parseMarkdown, parseOptions, parseTokensFromJSON, presets, proseClasses, renderCum, renderCumToHtml, renderCumToJson, renderCumToTailwind, renderMarkdown, renderToAST, renderToHTML, renderToHTMLUnsafe, renderToHTMLWithConfig, renderToJSON, renderToTailwind, renderToTailwindWithClasses, renderToTailwindWithConfig, sanitizeHtml, tokensToAST, tokensToJSONString };
|
|
360
|
+
export { AlertExtension, ButtonExtension, ChangerawrMarkdown, type DebugInfo, EmbedExtension, type EngineConfig, type EngineEvents, type Extension, ExtensionError, type Extension as ExtensionInterface, type ExtensionRegistration, type JsonAstNode, Logger, MarkdownParseError, MarkdownParser, MarkdownRenderError, MarkdownRenderer, type MarkdownToken, type OutputFormat, type ParseRule, type ParserConfig, type PerformanceMetrics, PerformanceTimer, type RenderRule, type RendererConfig, type TokenType, createCustomEngine, createDebugEngine, createEngine, createHTMLEngine, createMinimalEngine, createTailwindEngine, markdown as default, escapeHtml, extractDomain, generateId, markdown, parseMarkdown, parseOptions, renderMarkdown, renderToAST, renderToHTML, renderToHTMLUnsafe, renderToHTMLWithConfig, renderToJSON, renderToTailwind, renderToTailwindWithClasses, renderToTailwindWithConfig, sanitizeHtml };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,88 +164,6 @@ declare function renderToHTMLWithConfig(markdown: string, rendererConfig: {
|
|
|
164
164
|
*/
|
|
165
165
|
declare function renderToHTMLUnsafe(markdown: string): string;
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
* JSON AST output renderer - returns structured token data
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Parse markdown and return the token array as JSON
|
|
173
|
-
*/
|
|
174
|
-
declare function renderToJSON(markdown: string, config?: Omit<EngineConfig, 'renderer'>): MarkdownToken[];
|
|
175
|
-
/**
|
|
176
|
-
* Parse markdown and return a hierarchical AST structure
|
|
177
|
-
*/
|
|
178
|
-
declare function renderToAST(markdown: string, config?: Omit<EngineConfig, 'renderer'>): JsonAstNode[];
|
|
179
|
-
/**
|
|
180
|
-
* Convert flat token array to hierarchical AST
|
|
181
|
-
*/
|
|
182
|
-
declare function tokensToAST(tokens: MarkdownToken[]): JsonAstNode[];
|
|
183
|
-
/**
|
|
184
|
-
* Convert AST back to flat tokens
|
|
185
|
-
*/
|
|
186
|
-
declare function astToTokens(ast: JsonAstNode[]): MarkdownToken[];
|
|
187
|
-
/**
|
|
188
|
-
* Serialize tokens to JSON string with formatting
|
|
189
|
-
*/
|
|
190
|
-
declare function tokensToJSONString(tokens: MarkdownToken[], pretty?: boolean): string;
|
|
191
|
-
/**
|
|
192
|
-
* Serialize AST to JSON string with formatting
|
|
193
|
-
*/
|
|
194
|
-
declare function astToJSONString(ast: JsonAstNode[], pretty?: boolean): string;
|
|
195
|
-
/**
|
|
196
|
-
* Parse JSON string back to tokens
|
|
197
|
-
*/
|
|
198
|
-
declare function parseTokensFromJSON(jsonString: string): MarkdownToken[];
|
|
199
|
-
/**
|
|
200
|
-
* Parse JSON string back to AST
|
|
201
|
-
*/
|
|
202
|
-
declare function parseASTFromJSON(jsonString: string): JsonAstNode[];
|
|
203
|
-
/**
|
|
204
|
-
* Get comprehensive statistics from parsed tokens
|
|
205
|
-
*/
|
|
206
|
-
declare function getTokenStats(tokens: MarkdownToken[]): TokenStatistics;
|
|
207
|
-
/**
|
|
208
|
-
* Get AST-specific statistics
|
|
209
|
-
*/
|
|
210
|
-
declare function getASTStats(ast: JsonAstNode[]): ASTStatistics;
|
|
211
|
-
/**
|
|
212
|
-
* Compare two token arrays for differences
|
|
213
|
-
*/
|
|
214
|
-
declare function compareTokens(tokensA: MarkdownToken[], tokensB: MarkdownToken[]): TokenComparison;
|
|
215
|
-
interface TokenStatistics {
|
|
216
|
-
totalTokens: number;
|
|
217
|
-
tokenTypes: Record<string, number>;
|
|
218
|
-
extensionTokens: Record<string, number>;
|
|
219
|
-
totalContent: number;
|
|
220
|
-
totalRaw: number;
|
|
221
|
-
tokensWithAttributes: number;
|
|
222
|
-
averageContentLength: number;
|
|
223
|
-
averageRawLength: number;
|
|
224
|
-
attributeUsageRate: number;
|
|
225
|
-
}
|
|
226
|
-
interface ASTStatistics {
|
|
227
|
-
totalNodes: number;
|
|
228
|
-
maxDepth: number;
|
|
229
|
-
nodesWithChildren: number;
|
|
230
|
-
totalChildren: number;
|
|
231
|
-
nodeTypes: Record<string, number>;
|
|
232
|
-
averageChildrenPerParent: number;
|
|
233
|
-
hierarchyComplexity: number;
|
|
234
|
-
}
|
|
235
|
-
interface TokenDifference {
|
|
236
|
-
index: number;
|
|
237
|
-
type: 'added' | 'removed' | 'modified';
|
|
238
|
-
tokenA?: MarkdownToken;
|
|
239
|
-
tokenB?: MarkdownToken;
|
|
240
|
-
}
|
|
241
|
-
interface TokenComparison {
|
|
242
|
-
identical: boolean;
|
|
243
|
-
differences: TokenDifference[];
|
|
244
|
-
addedCount: number;
|
|
245
|
-
removedCount: number;
|
|
246
|
-
modifiedCount: number;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
167
|
/**
|
|
250
168
|
* Tailwind CSS output renderer - HTML with Tailwind CSS classes
|
|
251
169
|
*/
|
|
@@ -267,70 +185,19 @@ declare function renderToTailwindWithConfig(markdown: string, rendererConfig: {
|
|
|
267
185
|
customClasses?: Record<string, string>;
|
|
268
186
|
debugMode?: boolean;
|
|
269
187
|
}): string;
|
|
188
|
+
|
|
270
189
|
/**
|
|
271
|
-
*
|
|
272
|
-
*/
|
|
273
|
-
declare const defaultTailwindClasses: {
|
|
274
|
-
'heading-1': string;
|
|
275
|
-
'heading-2': string;
|
|
276
|
-
'heading-3': string;
|
|
277
|
-
'heading-4': string;
|
|
278
|
-
'heading-5': string;
|
|
279
|
-
'heading-6': string;
|
|
280
|
-
paragraph: string;
|
|
281
|
-
blockquote: string;
|
|
282
|
-
'code-inline': string;
|
|
283
|
-
'code-block': string;
|
|
284
|
-
link: string;
|
|
285
|
-
button: string;
|
|
286
|
-
list: string;
|
|
287
|
-
'list-item': string;
|
|
288
|
-
image: string;
|
|
289
|
-
embed: string;
|
|
290
|
-
alert: string;
|
|
291
|
-
'alert-info': string;
|
|
292
|
-
'alert-warning': string;
|
|
293
|
-
'alert-error': string;
|
|
294
|
-
'alert-success': string;
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* Prose-friendly Tailwind classes for blog/article content
|
|
190
|
+
* JSON AST output renderer - returns structured token data
|
|
298
191
|
*/
|
|
299
|
-
|
|
300
|
-
'heading-1': string;
|
|
301
|
-
'heading-2': string;
|
|
302
|
-
'heading-3': string;
|
|
303
|
-
paragraph: string;
|
|
304
|
-
blockquote: string;
|
|
305
|
-
'code-inline': string;
|
|
306
|
-
'code-block': string;
|
|
307
|
-
link: string;
|
|
308
|
-
};
|
|
192
|
+
|
|
309
193
|
/**
|
|
310
|
-
*
|
|
194
|
+
* Parse markdown and return the token array as JSON
|
|
311
195
|
*/
|
|
312
|
-
declare
|
|
313
|
-
'heading-1': string;
|
|
314
|
-
'heading-2': string;
|
|
315
|
-
'heading-3': string;
|
|
316
|
-
paragraph: string;
|
|
317
|
-
blockquote: string;
|
|
318
|
-
'code-inline': string;
|
|
319
|
-
'code-block': string;
|
|
320
|
-
link: string;
|
|
321
|
-
};
|
|
322
|
-
|
|
196
|
+
declare function renderToJSON(markdown: string, config?: Omit<EngineConfig, 'renderer'>): MarkdownToken[];
|
|
323
197
|
/**
|
|
324
|
-
*
|
|
325
|
-
* No React dependencies - works in browser and Node.js environments
|
|
198
|
+
* Parse markdown and return a hierarchical AST structure
|
|
326
199
|
*/
|
|
327
|
-
|
|
328
|
-
declare function renderCum(markdown: string, config?: EngineConfig): string;
|
|
329
|
-
declare function parseCum(markdown: string, config?: EngineConfig): MarkdownToken[];
|
|
330
|
-
declare function createCumEngine(config?: EngineConfig): ChangerawrMarkdown;
|
|
331
|
-
declare function renderCumToHtml(markdown: string): string;
|
|
332
|
-
declare function renderCumToTailwind(markdown: string): string;
|
|
333
|
-
declare function renderCumToJson(markdown: string): MarkdownToken[];
|
|
200
|
+
declare function renderToAST(markdown: string, config?: Omit<EngineConfig, 'renderer'>): JsonAstNode[];
|
|
334
201
|
|
|
335
202
|
/**
|
|
336
203
|
* Utility functions for Changerawr Markdown
|
|
@@ -347,34 +214,10 @@ declare function generateId(text: string): string;
|
|
|
347
214
|
* Sanitize HTML content using DOMPurify
|
|
348
215
|
*/
|
|
349
216
|
declare function sanitizeHtml(html: string): string;
|
|
350
|
-
/**
|
|
351
|
-
* Basic HTML sanitization - removes dangerous content
|
|
352
|
-
*/
|
|
353
|
-
declare function basicSanitize(html: string): string;
|
|
354
|
-
/**
|
|
355
|
-
* Check if code is running in browser environment
|
|
356
|
-
*/
|
|
357
|
-
declare function isBrowser(): boolean;
|
|
358
|
-
/**
|
|
359
|
-
* Check if code is running in Node.js environment
|
|
360
|
-
*/
|
|
361
|
-
declare function isNode(): boolean;
|
|
362
|
-
/**
|
|
363
|
-
* Debounce function for performance optimization
|
|
364
|
-
*/
|
|
365
|
-
declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
366
|
-
/**
|
|
367
|
-
* Deep merge two objects
|
|
368
|
-
*/
|
|
369
|
-
declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
|
|
370
217
|
/**
|
|
371
218
|
* Extract domain from URL
|
|
372
219
|
*/
|
|
373
220
|
declare function extractDomain(url: string): string;
|
|
374
|
-
/**
|
|
375
|
-
* Check if URL is valid
|
|
376
|
-
*/
|
|
377
|
-
declare function isValidUrl(url: string): boolean;
|
|
378
221
|
/**
|
|
379
222
|
* Parse options string into key-value object
|
|
380
223
|
*/
|
|
@@ -497,8 +340,6 @@ declare const markdown: {
|
|
|
497
340
|
readonly createDebugEngine: typeof createDebugEngine;
|
|
498
341
|
readonly createMinimalEngine: typeof createMinimalEngine;
|
|
499
342
|
readonly createCustomEngine: typeof createCustomEngine;
|
|
500
|
-
readonly renderCum: typeof renderCum;
|
|
501
|
-
readonly parseCum: typeof parseCum;
|
|
502
343
|
readonly ChangerawrMarkdown: typeof ChangerawrMarkdown;
|
|
503
344
|
readonly extensions: {
|
|
504
345
|
readonly Alert: Extension;
|
|
@@ -516,70 +357,4 @@ declare const markdown: {
|
|
|
516
357
|
};
|
|
517
358
|
};
|
|
518
359
|
|
|
519
|
-
|
|
520
|
-
* Preset configurations for common use cases
|
|
521
|
-
*/
|
|
522
|
-
declare const presets: {
|
|
523
|
-
/**
|
|
524
|
-
* Blog/article preset with prose-friendly styling
|
|
525
|
-
*/
|
|
526
|
-
readonly blog: {
|
|
527
|
-
readonly renderer: {
|
|
528
|
-
readonly format: "tailwind";
|
|
529
|
-
readonly customClasses: {
|
|
530
|
-
readonly 'heading-1': "text-4xl font-bold tracking-tight mt-10 mb-6";
|
|
531
|
-
readonly 'heading-2': "text-3xl font-semibold tracking-tight mt-8 mb-4";
|
|
532
|
-
readonly 'heading-3': "text-2xl font-medium tracking-tight mt-6 mb-3";
|
|
533
|
-
readonly paragraph: "text-lg leading-8 mb-6";
|
|
534
|
-
readonly blockquote: "border-l-4 border-gray-300 pl-6 py-2 italic text-gray-700 my-6";
|
|
535
|
-
readonly 'code-inline': "bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm font-mono";
|
|
536
|
-
readonly 'code-block': "bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto my-6 text-sm";
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
};
|
|
540
|
-
/**
|
|
541
|
-
* Documentation preset with clean, technical styling
|
|
542
|
-
*/
|
|
543
|
-
readonly docs: {
|
|
544
|
-
readonly renderer: {
|
|
545
|
-
readonly format: "tailwind";
|
|
546
|
-
readonly customClasses: {
|
|
547
|
-
readonly 'heading-1': "text-3xl font-bold border-b border-gray-200 pb-2 mb-6";
|
|
548
|
-
readonly 'heading-2': "text-2xl font-semibold mt-8 mb-4";
|
|
549
|
-
readonly 'heading-3': "text-xl font-medium mt-6 mb-3";
|
|
550
|
-
readonly paragraph: "leading-7 mb-4";
|
|
551
|
-
readonly 'code-inline': "bg-blue-50 text-blue-800 px-2 py-1 rounded text-sm font-mono";
|
|
552
|
-
readonly 'code-block': "bg-gray-50 border border-gray-200 p-4 rounded-lg overflow-x-auto my-4 text-sm";
|
|
553
|
-
readonly alert: "border border-blue-200 bg-blue-50 text-blue-800 p-4 rounded-lg mb-4";
|
|
554
|
-
};
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Minimal preset with basic styling
|
|
559
|
-
*/
|
|
560
|
-
readonly minimal: {
|
|
561
|
-
readonly renderer: {
|
|
562
|
-
readonly format: "html";
|
|
563
|
-
readonly sanitize: true;
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
/**
|
|
567
|
-
* Performance preset with minimal processing
|
|
568
|
-
*/
|
|
569
|
-
readonly fast: {
|
|
570
|
-
readonly parser: {
|
|
571
|
-
readonly validateMarkdown: false;
|
|
572
|
-
readonly maxIterations: 1000;
|
|
573
|
-
};
|
|
574
|
-
readonly renderer: {
|
|
575
|
-
readonly format: "html";
|
|
576
|
-
readonly sanitize: false;
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
};
|
|
580
|
-
/**
|
|
581
|
-
* Create engine with preset configuration
|
|
582
|
-
*/
|
|
583
|
-
declare function createEngineWithPreset(presetName: keyof typeof presets, additionalConfig?: EngineConfig): ChangerawrMarkdown;
|
|
584
|
-
|
|
585
|
-
export { type ASTStatistics, AlertExtension, ButtonExtension, ChangerawrMarkdown, type DebugInfo, EmbedExtension, type EngineConfig, type EngineEvents, type Extension, ExtensionError, type Extension as ExtensionInterface, type ExtensionRegistration, type JsonAstNode, Logger, MarkdownParseError, MarkdownParser, MarkdownRenderError, MarkdownRenderer, type MarkdownToken, type OutputFormat, type ParseRule, type ParserConfig, type PerformanceMetrics, PerformanceTimer, type RenderRule, type RendererConfig, type TokenComparison, type TokenDifference, type TokenStatistics, type TokenType, astToJSONString, astToTokens, basicSanitize, compareTokens, createCumEngine, createCustomEngine, createDebugEngine, createEngine, createEngineWithPreset, createHTMLEngine, createMinimalEngine, createTailwindEngine, debounce, deepMerge, markdown as default, defaultTailwindClasses, escapeHtml, extractDomain, generateId, getASTStats, getTokenStats, isBrowser, isNode, isValidUrl, markdown, minimalClasses, parseASTFromJSON, parseCum, parseMarkdown, parseOptions, parseTokensFromJSON, presets, proseClasses, renderCum, renderCumToHtml, renderCumToJson, renderCumToTailwind, renderMarkdown, renderToAST, renderToHTML, renderToHTMLUnsafe, renderToHTMLWithConfig, renderToJSON, renderToTailwind, renderToTailwindWithClasses, renderToTailwindWithConfig, sanitizeHtml, tokensToAST, tokensToJSONString };
|
|
360
|
+
export { AlertExtension, ButtonExtension, ChangerawrMarkdown, type DebugInfo, EmbedExtension, type EngineConfig, type EngineEvents, type Extension, ExtensionError, type Extension as ExtensionInterface, type ExtensionRegistration, type JsonAstNode, Logger, MarkdownParseError, MarkdownParser, MarkdownRenderError, MarkdownRenderer, type MarkdownToken, type OutputFormat, type ParseRule, type ParserConfig, type PerformanceMetrics, PerformanceTimer, type RenderRule, type RendererConfig, type TokenType, createCustomEngine, createDebugEngine, createEngine, createHTMLEngine, createMinimalEngine, createTailwindEngine, markdown as default, escapeHtml, extractDomain, generateId, markdown, parseMarkdown, parseOptions, renderMarkdown, renderToAST, renderToHTML, renderToHTMLUnsafe, renderToHTMLWithConfig, renderToJSON, renderToTailwind, renderToTailwindWithClasses, renderToTailwindWithConfig, sanitizeHtml };
|