@changerawr/markdown 1.0.3 → 1.0.5
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/README.md +1 -1
- package/dist/index.d.mts +233 -8
- package/dist/index.d.ts +233 -8
- package/dist/index.js +462 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +435 -36
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +0 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +0 -2
- package/dist/react/index.mjs.map +1 -1
- package/dist/standalone.browser.js +2547 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -299,7 +299,7 @@ const minimalEngine = createMinimalEngine();
|
|
|
299
299
|
Perfect for Node.js, vanilla JavaScript, or any non-React environment:
|
|
300
300
|
|
|
301
301
|
```html
|
|
302
|
-
<script src="https://unpkg.com/@changerawr/markdown/dist/standalone.js"></script>
|
|
302
|
+
<script src="https://unpkg.com/@changerawr/markdown/dist/standalone.browser.js"></script>
|
|
303
303
|
<script>
|
|
304
304
|
const html = ChangerawrMarkdown.renderCum('# Hello World!');
|
|
305
305
|
document.body.innerHTML = html;
|
package/dist/index.d.mts
CHANGED
|
@@ -164,6 +164,88 @@ 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
|
+
|
|
167
249
|
/**
|
|
168
250
|
* Tailwind CSS output renderer - HTML with Tailwind CSS classes
|
|
169
251
|
*/
|
|
@@ -185,19 +267,70 @@ declare function renderToTailwindWithConfig(markdown: string, rendererConfig: {
|
|
|
185
267
|
customClasses?: Record<string, string>;
|
|
186
268
|
debugMode?: boolean;
|
|
187
269
|
}): string;
|
|
188
|
-
|
|
189
270
|
/**
|
|
190
|
-
*
|
|
271
|
+
* Default Tailwind configuration for common use cases
|
|
191
272
|
*/
|
|
192
|
-
|
|
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
|
+
};
|
|
193
296
|
/**
|
|
194
|
-
*
|
|
297
|
+
* Prose-friendly Tailwind classes for blog/article content
|
|
195
298
|
*/
|
|
196
|
-
declare
|
|
299
|
+
declare const proseClasses: {
|
|
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
|
+
};
|
|
197
309
|
/**
|
|
198
|
-
*
|
|
310
|
+
* Minimal Tailwind classes for clean, simple styling
|
|
199
311
|
*/
|
|
200
|
-
declare
|
|
312
|
+
declare const minimalClasses: {
|
|
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
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Standalone version of Changerawr Markdown for vanilla JavaScript usage
|
|
325
|
+
* No React dependencies - works in browser and Node.js environments
|
|
326
|
+
*/
|
|
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[];
|
|
201
334
|
|
|
202
335
|
/**
|
|
203
336
|
* Utility functions for Changerawr Markdown
|
|
@@ -214,10 +347,34 @@ declare function generateId(text: string): string;
|
|
|
214
347
|
* Sanitize HTML content using DOMPurify
|
|
215
348
|
*/
|
|
216
349
|
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;
|
|
217
370
|
/**
|
|
218
371
|
* Extract domain from URL
|
|
219
372
|
*/
|
|
220
373
|
declare function extractDomain(url: string): string;
|
|
374
|
+
/**
|
|
375
|
+
* Check if URL is valid
|
|
376
|
+
*/
|
|
377
|
+
declare function isValidUrl(url: string): boolean;
|
|
221
378
|
/**
|
|
222
379
|
* Parse options string into key-value object
|
|
223
380
|
*/
|
|
@@ -340,6 +497,8 @@ declare const markdown: {
|
|
|
340
497
|
readonly createDebugEngine: typeof createDebugEngine;
|
|
341
498
|
readonly createMinimalEngine: typeof createMinimalEngine;
|
|
342
499
|
readonly createCustomEngine: typeof createCustomEngine;
|
|
500
|
+
readonly renderCum: typeof renderCum;
|
|
501
|
+
readonly parseCum: typeof parseCum;
|
|
343
502
|
readonly ChangerawrMarkdown: typeof ChangerawrMarkdown;
|
|
344
503
|
readonly extensions: {
|
|
345
504
|
readonly Alert: Extension;
|
|
@@ -357,4 +516,70 @@ declare const markdown: {
|
|
|
357
516
|
};
|
|
358
517
|
};
|
|
359
518
|
|
|
360
|
-
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,88 @@ 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
|
+
|
|
167
249
|
/**
|
|
168
250
|
* Tailwind CSS output renderer - HTML with Tailwind CSS classes
|
|
169
251
|
*/
|
|
@@ -185,19 +267,70 @@ declare function renderToTailwindWithConfig(markdown: string, rendererConfig: {
|
|
|
185
267
|
customClasses?: Record<string, string>;
|
|
186
268
|
debugMode?: boolean;
|
|
187
269
|
}): string;
|
|
188
|
-
|
|
189
270
|
/**
|
|
190
|
-
*
|
|
271
|
+
* Default Tailwind configuration for common use cases
|
|
191
272
|
*/
|
|
192
|
-
|
|
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
|
+
};
|
|
193
296
|
/**
|
|
194
|
-
*
|
|
297
|
+
* Prose-friendly Tailwind classes for blog/article content
|
|
195
298
|
*/
|
|
196
|
-
declare
|
|
299
|
+
declare const proseClasses: {
|
|
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
|
+
};
|
|
197
309
|
/**
|
|
198
|
-
*
|
|
310
|
+
* Minimal Tailwind classes for clean, simple styling
|
|
199
311
|
*/
|
|
200
|
-
declare
|
|
312
|
+
declare const minimalClasses: {
|
|
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
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Standalone version of Changerawr Markdown for vanilla JavaScript usage
|
|
325
|
+
* No React dependencies - works in browser and Node.js environments
|
|
326
|
+
*/
|
|
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[];
|
|
201
334
|
|
|
202
335
|
/**
|
|
203
336
|
* Utility functions for Changerawr Markdown
|
|
@@ -214,10 +347,34 @@ declare function generateId(text: string): string;
|
|
|
214
347
|
* Sanitize HTML content using DOMPurify
|
|
215
348
|
*/
|
|
216
349
|
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;
|
|
217
370
|
/**
|
|
218
371
|
* Extract domain from URL
|
|
219
372
|
*/
|
|
220
373
|
declare function extractDomain(url: string): string;
|
|
374
|
+
/**
|
|
375
|
+
* Check if URL is valid
|
|
376
|
+
*/
|
|
377
|
+
declare function isValidUrl(url: string): boolean;
|
|
221
378
|
/**
|
|
222
379
|
* Parse options string into key-value object
|
|
223
380
|
*/
|
|
@@ -340,6 +497,8 @@ declare const markdown: {
|
|
|
340
497
|
readonly createDebugEngine: typeof createDebugEngine;
|
|
341
498
|
readonly createMinimalEngine: typeof createMinimalEngine;
|
|
342
499
|
readonly createCustomEngine: typeof createCustomEngine;
|
|
500
|
+
readonly renderCum: typeof renderCum;
|
|
501
|
+
readonly parseCum: typeof parseCum;
|
|
343
502
|
readonly ChangerawrMarkdown: typeof ChangerawrMarkdown;
|
|
344
503
|
readonly extensions: {
|
|
345
504
|
readonly Alert: Extension;
|
|
@@ -357,4 +516,70 @@ declare const markdown: {
|
|
|
357
516
|
};
|
|
358
517
|
};
|
|
359
518
|
|
|
360
|
-
|
|
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 };
|