@leadertechie/md2html 0.1.0-alpha.15 → 0.1.0-alpha.16

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 CHANGED
@@ -169,6 +169,7 @@ export declare class MarkdownParser {
169
169
  private errorRecovery;
170
170
  private maxRecursionDepth;
171
171
  private allowedHTMLTags;
172
+ private allowedAttributes;
172
173
  private handlerRegistry;
173
174
  private onUnhandledToken?;
174
175
  constructor(options?: ParserOptions);
@@ -177,6 +178,20 @@ export declare class MarkdownParser {
177
178
  private processImagePath;
178
179
  private processInlineFormatting;
179
180
  private processSlots;
181
+ /**
182
+ * Check if an attribute name is allowed for a given tag.
183
+ * Supports "data-*" wildcard prefix matching.
184
+ */
185
+ private isAttributeAllowed;
186
+ /**
187
+ * Check if an attribute name matches a list of allowed patterns.
188
+ * Supports "data-*" wildcard prefix matching.
189
+ */
190
+ private matchesAttributeList;
191
+ /**
192
+ * Filter attributes on an HTML tag, keeping only allowed ones.
193
+ */
194
+ private filterTagAttributes;
180
195
  private processRawHTML;
181
196
  /**
182
197
  * Build the ParseContext that is passed to every token handler.
@@ -255,8 +270,15 @@ export declare interface ParserOptions {
255
270
  errorRecovery?: 'throw' | 'warn' | 'silent';
256
271
  maxRecursionDepth?: number;
257
272
  allowedHTMLTags?: string[];
273
+ /**
274
+ * Allowed HTML attributes per tag for preserveRawHTML mode.
275
+ * Key "*" applies to all tags. Key "tag" applies to specific tags.
276
+ * Supports "data-*" wildcard prefix matching.
277
+ */
278
+ allowedAttributes?: Record<string, string[]>;
258
279
  /**
259
280
  * Callback invoked when a token type has no dedicated handler.
281
+
260
282
  * The catch-all handler will still produce a container node for the content,
261
283
  * but this callback allows callers to log, warn, or track unhandled types.
262
284
  *
@@ -290,6 +312,13 @@ export declare interface PipelineConfigV2 extends PipelineConfig {
290
312
  maxRecursionDepth?: number;
291
313
  /** Additional allowed HTML tags for preserveRawHTML mode */
292
314
  allowedHTMLTags?: string[];
315
+ /**
316
+ * Allowed HTML attributes per tag for preserveRawHTML mode.
317
+ * Key "*" applies to all tags. Key "tag" applies to specific tags.
318
+ * Supports "data-*" wildcard prefix matching.
319
+ * Example: { "*": ["id", "class"], "script": ["type", "src"] }
320
+ */
321
+ allowedAttributes?: Record<string, string[]>;
293
322
  }
294
323
 
295
324
  /** Scope hierarchy values for data-md-scope */
package/dist/index.js CHANGED
@@ -240,6 +240,7 @@ class MarkdownParser {
240
240
  ...defaultAllowedHTMLTags,
241
241
  ...options?.allowedHTMLTags ?? []
242
242
  ]);
243
+ this.allowedAttributes = options?.allowedAttributes ?? {};
243
244
  this.handlerRegistry = new TokenHandlerRegistry();
244
245
  this.onUnhandledToken = options?.onUnhandledToken;
245
246
  }
@@ -266,6 +267,65 @@ class MarkdownParser {
266
267
  return this.onSlot(name.trim());
267
268
  });
268
269
  }
270
+ /**
271
+ * Check if an attribute name is allowed for a given tag.
272
+ * Supports "data-*" wildcard prefix matching.
273
+ */
274
+ isAttributeAllowed(tagName, attrName) {
275
+ const globalAllowed = this.allowedAttributes["*"];
276
+ if (globalAllowed && this.matchesAttributeList(attrName, globalAllowed)) {
277
+ return true;
278
+ }
279
+ const tagAllowed = this.allowedAttributes[tagName];
280
+ if (tagAllowed && this.matchesAttributeList(attrName, tagAllowed)) {
281
+ return true;
282
+ }
283
+ return false;
284
+ }
285
+ /**
286
+ * Check if an attribute name matches a list of allowed patterns.
287
+ * Supports "data-*" wildcard prefix matching.
288
+ */
289
+ matchesAttributeList(attrName, allowed) {
290
+ const lower = attrName.toLowerCase();
291
+ for (const pattern of allowed) {
292
+ if (pattern.endsWith("-*")) {
293
+ const prefix = pattern.slice(0, -1).toLowerCase();
294
+ if (lower.startsWith(prefix)) return true;
295
+ } else if (pattern.toLowerCase() === lower) {
296
+ return true;
297
+ }
298
+ }
299
+ return false;
300
+ }
301
+ /**
302
+ * Filter attributes on an HTML tag, keeping only allowed ones.
303
+ */
304
+ filterTagAttributes(tag) {
305
+ const tagMatch = tag.match(/^<\/?(\w+)/);
306
+ if (!tagMatch) return tag;
307
+ const tagName = tagMatch[1].toLowerCase();
308
+ const hasRules = Object.keys(this.allowedAttributes).length > 0;
309
+ if (!hasRules) return tag;
310
+ const attrRegex = /(\S+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g;
311
+ const selfClosing = tag.endsWith("/>");
312
+ const tagOpen = tagMatch[0];
313
+ const remaining = tag.slice(tagOpen.length);
314
+ let filtered = tagOpen;
315
+ let match;
316
+ while ((match = attrRegex.exec(remaining)) !== null) {
317
+ const attrName = match[1];
318
+ const attrValue = match[2] ?? match[3] ?? match[4] ?? "";
319
+ if (this.isAttributeAllowed(tagName, attrName)) {
320
+ filtered += ` ${attrName}="${attrValue.replace(/"/g, '"')}"`;
321
+ }
322
+ }
323
+ if (selfClosing) {
324
+ filtered += " /";
325
+ }
326
+ filtered += ">";
327
+ return filtered;
328
+ }
269
329
  processRawHTML(html) {
270
330
  if (!this.allowedHTMLTags.has("script")) {
271
331
  html = html.replace(/<script[\s\S]*?<\/script>/gi, "");
@@ -275,6 +335,10 @@ class MarkdownParser {
275
335
  html = html.replace(/<style[\s\S]*?<\/style>/gi, "");
276
336
  html = html.replace(/<\/?style[^>]*>/gi, "");
277
337
  }
338
+ const hasAttrRules = Object.keys(this.allowedAttributes).length > 0;
339
+ if (hasAttrRules) {
340
+ html = html.replace(/<[^>]+>/g, (match) => this.filterTagAttributes(match));
341
+ }
278
342
  return html;
279
343
  }
280
344
  /**
@@ -492,7 +556,8 @@ class MarkdownPipeline {
492
556
  onSlot: config.onSlot,
493
557
  errorRecovery: config.errorRecovery ?? "throw",
494
558
  maxRecursionDepth: config.maxRecursionDepth ?? 100,
495
- allowedHTMLTags: config.allowedHTMLTags ?? []
559
+ allowedHTMLTags: config.allowedHTMLTags ?? [],
560
+ allowedAttributes: config.allowedAttributes ?? {}
496
561
  };
497
562
  this.parser = new MarkdownParser({
498
563
  imagePathPrefix: this.config.imagePathPrefix,
@@ -502,7 +567,8 @@ class MarkdownPipeline {
502
567
  onSlot: this.config.onSlot,
503
568
  errorRecovery: this.config.errorRecovery,
504
569
  maxRecursionDepth: this.config.maxRecursionDepth,
505
- allowedHTMLTags: this.config.allowedHTMLTags
570
+ allowedHTMLTags: this.config.allowedHTMLTags,
571
+ allowedAttributes: this.config.allowedAttributes
506
572
  });
507
573
  this.renderer = new HTMLRenderer(this.config.styleOptions);
508
574
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/types.ts","../src/handlers/heading-handler.ts","../src/handlers/paragraph-handler.ts","../src/handlers/list-handler.ts","../src/handlers/image-handler.ts","../src/handlers/code-handler.ts","../src/handlers/hr-handler.ts","../src/handlers/blockquote-handler.ts","../src/handlers/html-handler.ts","../src/handlers/catchall-handler.ts","../src/handlers/registry.ts","../src/parser.ts","../src/renderer.ts","../src/pipeline.ts"],"sourcesContent":["export type ContentNodeType = \n | 'text' \n | 'heading' \n | 'paragraph' \n | 'list' \n | 'list-item' \n | 'image' \n | 'code' \n | 'container'\n | 'strong'\n | 'emphasis'\n | 'link';\n\nexport interface ContentNode {\n type: ContentNodeType;\n content?: string;\n children?: ContentNode[];\n attributes?: Record<string, unknown>;\n className?: string;\n src?: string;\n alt?: string;\n ordered?: boolean;\n /** Raw HTML content for passthrough mode */\n rawHTML?: string;\n /** Scope anchor value for data-md-scope */\n scope?: string;\n}\n\nexport interface MarkdownContent {\n title: string;\n metadata?: Record<string, unknown>;\n content: ContentNode[];\n}\n\nexport interface ParseOptions {\n gfm?: boolean;\n breaks?: boolean;\n pedantic?: boolean;\n}\n\nexport interface StyleConfig {\n classPrefix?: string;\n customCSS?: string;\n addHeadingIds?: boolean;\n}\n\n/**\n * v2: Extended StyleConfig with scope anchor support.\n */\nexport interface StyleConfigV2 extends StyleConfig {\n /** Emit data-md-scope attributes for CSS @scope anchoring (default: false) */\n emitScopeAnchors?: boolean;\n}\n\nexport interface PipelineConfig {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n parseOptions?: ParseOptions;\n styleOptions?: StyleConfig | StyleConfigV2;\n}\n\n/**\n * v2: Extended PipelineConfig with raw HTML passthrough, slot hooks, and error recovery.\n */\nexport interface PipelineConfigV2 extends PipelineConfig {\n styleOptions?: StyleConfigV2;\n /** Preserve raw HTML tags in markdown (img, style, div, span, etc.) (default: false) */\n preserveRawHTML?: boolean;\n /** Regex pattern for slot placeholders like [[SLOT_NAME]] (default: /\\[\\[(.*?)\\]\\]/g) */\n slotPattern?: RegExp;\n /** Callback to resolve slot values. Called with the slot name, returns replacement string. */\n onSlot?: (name: string) => string;\n /** Error recovery mode (default: 'throw' — backward compatible) */\n errorRecovery?: 'throw' | 'warn' | 'silent';\n /** Max recursion depth to prevent stack overflow (default: 100) */\n maxRecursionDepth?: number;\n /** Additional allowed HTML tags for preserveRawHTML mode */\n allowedHTMLTags?: string[];\n}\n\n/** Default allowed HTML tags for preserveRawHTML mode */\nexport const defaultAllowedHTMLTags = [\n 'img', 'style', 'div', 'span', 'section', 'article',\n 'aside', 'header', 'footer', 'nav', 'main', 'figure',\n 'figcaption', 'details', 'summary', 'mark', 'time',\n 'video', 'audio', 'source', 'iframe', 'embed'\n];\n\n/** Scope hierarchy values for data-md-scope */\nexport type ScopeValue =\n | 'root'\n | 'heading'\n | 'paragraph'\n | 'list'\n | 'list-item'\n | 'image'\n | 'code'\n | 'strong'\n | 'emphasis'\n | 'link'\n | 'container';\n\n/** Maps ContentNodeType to ScopeValue */\nexport const nodeTypeToScope: Record<ContentNodeType, ScopeValue> = {\n 'text': 'root',\n 'heading': 'heading',\n 'paragraph': 'paragraph',\n 'list': 'list',\n 'list-item': 'list-item',\n 'image': 'image',\n 'code': 'code',\n 'container': 'container',\n 'strong': 'strong',\n 'emphasis': 'emphasis',\n 'link': 'link',\n};\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'heading' tokens (h1-h6).\n */\nexport class HeadingHandler implements TokenHandler {\n readonly type = 'heading';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'heading' as const,\n content: ctx.processSlots(token.text as string),\n attributes: { level: String(token.depth) }\n };\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'paragraph' tokens, including inline images and raw HTML.\n */\nexport class ParagraphHandler implements TokenHandler {\n readonly type = 'paragraph';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokens = (token.tokens as Array<Record<string, unknown>>) || [];\n const hasInlineImage = tokens.some(t => t.type === 'image');\n const hasInlineHTML = tokens.some(t => t.type === 'html');\n\n if (hasInlineImage || (ctx.preserveRawHTML && hasInlineHTML)) {\n const children = tokens.map(t => {\n if (t.type === 'image') {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(t.href as string),\n alt: t.text as string || ''\n };\n }\n if (t.type === 'html' && ctx.preserveRawHTML) {\n const processed = ctx.processRawHTML(t.raw as string);\n if (processed.trim()) {\n return { type: 'text' as const, content: processed };\n }\n return null;\n }\n return {\n type: 'text' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || ''))\n };\n }).filter(Boolean) as ContentNode[];\n\n if (children.length === 0) return null;\n\n return { type: 'paragraph' as const, children };\n }\n\n return {\n type: 'paragraph' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(token.text as string))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'list' tokens (ordered and unordered).\n */\nexport class ListHandler implements TokenHandler {\n readonly type = 'list';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'list' as const,\n ordered: token.ordered as boolean,\n children: (token.items as Array<Record<string, unknown>>).map((item) => ({\n type: 'list-item' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(item.text as string))\n }))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'image' tokens.\n */\nexport class ImageHandler implements TokenHandler {\n readonly type = 'image';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(token.href as string),\n alt: token.title as string || ''\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'code' tokens (fenced code blocks).\n */\nexport class CodeHandler implements TokenHandler {\n readonly type = 'code';\n\n handle(token: Record<string, unknown>, _ctx: ParseContext) {\n return {\n type: 'code' as const,\n content: token.text as string,\n attributes: { lang: token.lang as string || '' }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'hr' tokens (horizontal rules).\n */\nexport class HrHandler implements TokenHandler {\n readonly type = 'hr';\n\n handle(_token: Record<string, unknown>, _ctx: ParseContext) {\n return { type: 'container' as const, attributes: { tag: 'hr' } };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'blockquote' tokens.\n */\nexport class BlockquoteHandler implements TokenHandler {\n readonly type = 'blockquote';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'container' as const,\n attributes: { tag: 'blockquote' },\n children: ctx.parseTokens((token.tokens as unknown[]) || [], ctx.maxRecursionDepth + 1)\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'html' tokens (inline or block-level raw HTML).\n * In preserveRawHTML mode, passes through allowed HTML tags.\n * Otherwise, stores the raw content as a container node.\n */\nexport class HtmlHandler implements TokenHandler {\n readonly type = 'html';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n if (ctx.preserveRawHTML) {\n const raw = token.raw as string;\n const processed = ctx.processRawHTML(raw);\n if (processed.trim()) {\n return { type: 'container' as const, rawHTML: processed };\n }\n return null;\n }\n return { type: 'container' as const, content: token.raw as string };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Catch-all handler for any token type that doesn't have a dedicated handler.\n * Wraps the raw token content in a container node so content is never silently lost.\n * Reports the unhandled type via the context's reportUnhandled callback.\n */\nexport class CatchAllHandler implements TokenHandler {\n readonly type = '*';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokenType = token.type as string;\n\n // Report the unhandled token so callers can be notified\n ctx.reportUnhandled(tokenType, token);\n\n // Try to extract meaningful content from the raw token\n const raw = token.raw as string | undefined;\n const text = token.text as string | undefined;\n const content = raw || text || `[unhandled: ${tokenType}]`;\n\n return {\n type: 'container' as const,\n content,\n attributes: {\n 'data-unhandled': tokenType,\n tag: 'div'\n }\n };\n }\n}\n","import type { TokenHandler } from './types.js';\nimport { HeadingHandler } from './heading-handler.js';\nimport { ParagraphHandler } from './paragraph-handler.js';\nimport { ListHandler } from './list-handler.js';\nimport { ImageHandler } from './image-handler.js';\nimport { CodeHandler } from './code-handler.js';\nimport { HrHandler } from './hr-handler.js';\nimport { BlockquoteHandler } from './blockquote-handler.js';\nimport { HtmlHandler } from './html-handler.js';\nimport { CatchAllHandler } from './catchall-handler.js';\n\n/**\n * Registry of token handlers. Handlers can be added/overridden externally\n * to extend the parser without modifying its internals.\n *\n * The registry uses a two-tier lookup:\n * 1. First, check for a dedicated handler by token type name\n * 2. If none found, fall back to the catch-all handler (registered as '*')\n *\n * The catch-all handler ensures no content is silently lost — unhandled\n * token types are wrapped in a container node with `data-unhandled` attribute.\n */\nexport class TokenHandlerRegistry {\n private handlers = new Map<string, TokenHandler>();\n private catchAll: TokenHandler;\n\n constructor() {\n // Register all built-in handlers\n this.register(new HeadingHandler());\n this.register(new ParagraphHandler());\n this.register(new ListHandler());\n this.register(new ImageHandler());\n this.register(new CodeHandler());\n this.register(new HrHandler());\n this.register(new BlockquoteHandler());\n this.register(new HtmlHandler());\n\n // Catch-all handler for any unregistered token types\n this.catchAll = new CatchAllHandler();\n }\n\n /** Register a handler. Overrides any existing handler for the same token type. */\n register(handler: TokenHandler): void {\n this.handlers.set(handler.type, handler);\n }\n\n /** Unregister a handler by token type. */\n unregister(type: string): void {\n this.handlers.delete(type);\n }\n\n /**\n * Get a handler for the given token type.\n * Falls back to the catch-all handler if no dedicated handler is registered.\n */\n get(type: string): TokenHandler {\n return this.handlers.get(type) ?? this.catchAll;\n }\n\n /** Check if a dedicated handler exists for the given token type (excludes catch-all). */\n has(type: string): boolean {\n return this.handlers.has(type);\n }\n\n /** Get all registered dedicated handler types. */\n get types(): string[] {\n return Array.from(this.handlers.keys());\n }\n\n /** Replace the catch-all handler with a custom implementation. */\n setCatchAll(handler: TokenHandler): void {\n this.catchAll = handler;\n }\n\n /** Get the current catch-all handler. */\n getCatchAll(): TokenHandler {\n return this.catchAll;\n }\n}\n","import { marked } from 'marked';\nimport { ContentNode, MarkdownContent, ParseOptions, defaultAllowedHTMLTags } from './types.js';\nimport { TokenHandlerRegistry, ParseContext } from './handlers/index.js';\n\nexport interface ParserOptions {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n preserveRawHTML?: boolean;\n slotPattern?: RegExp;\n onSlot?: (name: string) => string;\n errorRecovery?: 'throw' | 'warn' | 'silent';\n maxRecursionDepth?: number;\n allowedHTMLTags?: string[];\n /**\n * Callback invoked when a token type has no dedicated handler.\n * The catch-all handler will still produce a container node for the content,\n * but this callback allows callers to log, warn, or track unhandled types.\n *\n * @param type - The unhandled token type name (e.g. 'table', 'def')\n * @param token - The raw marked token\n */\n onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n}\n\nconst DEFAULT_SLOT_PATTERN = /\\[\\[(.*?)\\]\\]/g;\n\n// Re-export handler types for convenience\nexport { TokenHandlerRegistry } from './handlers/index.js';\nexport type { TokenHandler, ParseContext } from './handlers/index.js';\n\n// ─── MarkdownParser ───────────────────────────────────────────────────────────\n\nexport class MarkdownParser {\n private imagePathPrefix: string;\n private imageBaseUrl: string;\n private preserveRawHTML: boolean;\n private slotPattern: RegExp;\n private onSlot: ((name: string) => string) | undefined;\n private errorRecovery: 'throw' | 'warn' | 'silent';\n private maxRecursionDepth: number;\n private allowedHTMLTags: Set<string>;\n private handlerRegistry: TokenHandlerRegistry;\n private onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n\n constructor(options?: ParserOptions) {\n this.imagePathPrefix = options?.imagePathPrefix || '';\n this.imageBaseUrl = options?.imageBaseUrl || '';\n this.preserveRawHTML = options?.preserveRawHTML ?? false;\n this.slotPattern = options?.slotPattern ?? DEFAULT_SLOT_PATTERN;\n this.onSlot = options?.onSlot;\n this.errorRecovery = options?.errorRecovery ?? 'throw';\n this.maxRecursionDepth = options?.maxRecursionDepth ?? 100;\n this.allowedHTMLTags = new Set([\n ...defaultAllowedHTMLTags,\n ...(options?.allowedHTMLTags ?? [])\n ]);\n this.handlerRegistry = new TokenHandlerRegistry();\n this.onUnhandledToken = options?.onUnhandledToken;\n }\n\n /** Access the handler registry for customization. */\n get handlers(): TokenHandlerRegistry {\n return this.handlerRegistry;\n }\n\n private processImagePath(src: string): string {\n if (src.startsWith('http') || src.startsWith('/')) {\n return src;\n }\n let path = this.imagePathPrefix ? `${this.imagePathPrefix}${src}` : src;\n if (this.imageBaseUrl && !path.startsWith('http')) {\n path = `${this.imageBaseUrl}${path}`;\n }\n return path;\n }\n\n private processInlineFormatting(text: string): string {\n return text\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>');\n }\n\n private processSlots(text: string): string {\n if (!this.onSlot) return text;\n return text.replace(this.slotPattern, (match, name: string) => {\n return this.onSlot!(name.trim());\n });\n }\n\n private processRawHTML(html: string): string {\n if (!this.allowedHTMLTags.has('script')) {\n html = html.replace(/<script[\\s\\S]*?<\\/script>/gi, '');\n html = html.replace(/<\\/?script[^>]*>/gi, '');\n }\n if (!this.allowedHTMLTags.has('style')) {\n html = html.replace(/<style[\\s\\S]*?<\\/style>/gi, '');\n html = html.replace(/<\\/?style[^>]*>/gi, '');\n }\n return html;\n }\n\n /**\n * Build the ParseContext that is passed to every token handler.\n * This is the bridge between the parser's private services and the handlers.\n */\n private createContext(): ParseContext {\n const self = this;\n return {\n get preserveRawHTML() { return self.preserveRawHTML; },\n get errorRecovery() { return self.errorRecovery; },\n get maxRecursionDepth() { return self.maxRecursionDepth; },\n processImagePath: (src: string) => self.processImagePath(src),\n processInlineFormatting: (text: string) => self.processInlineFormatting(text),\n processSlots: (text: string) => self.processSlots(text),\n processRawHTML: (html: string) => self.processRawHTML(html),\n parseTokens: (tokens: unknown[], depth: number) => self.parseTokens(tokens, depth),\n reportUnhandled: (type: string, token: Record<string, unknown>) => {\n self.onUnhandledToken?.(type, token);\n }\n };\n }\n\n private parseTokens(tokens: unknown[], depth: number = 0): ContentNode[] {\n if (depth > this.maxRecursionDepth) {\n const msg = `[md2html] Max recursion depth (${this.maxRecursionDepth}) exceeded, truncating`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n return [];\n }\n\n const nodes: ContentNode[] = [];\n const ctx = this.createContext();\n\n for (const token of tokens) {\n const typedToken = token as Record<string, unknown>;\n // The registry automatically falls back to the catch-all handler\n const handler = this.handlerRegistry.get(typedToken.type as string);\n const node = handler.handle(typedToken, ctx);\n if (node) {\n nodes.push(node);\n }\n }\n\n return nodes;\n }\n\n parse(markdown: string, options?: ParseOptions): MarkdownContent {\n const parseOptions = {\n gfm: options?.gfm ?? true,\n breaks: options?.breaks ?? false,\n pedantic: options?.pedantic ?? false\n };\n\n try {\n const tokens = marked.lexer(markdown, parseOptions as Parameters<typeof marked.lexer>[1]);\n const content = this.parseTokens(tokens);\n\n return {\n title: '',\n content\n };\n } catch (err) {\n if (this.errorRecovery === 'throw') throw err;\n\n const msg = `[md2html] Parse error: ${err instanceof Error ? err.message : String(err)}`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n\n return {\n title: '',\n content: [{ type: 'text', content: markdown }]\n };\n }\n }\n\n parseToNodes(markdown: string, options?: ParseOptions): ContentNode[] {\n return this.parse(markdown, options).content;\n }\n}\n","import { ContentNode, StyleConfig, StyleConfigV2, nodeTypeToScope } from './types.js';\n\nexport class HTMLRenderer {\n private config: Required<StyleConfigV2>;\n\n constructor(config: StyleConfigV2 = {}) {\n this.config = {\n classPrefix: config.classPrefix || '',\n customCSS: config.customCSS || '',\n addHeadingIds: config.addHeadingIds ?? false,\n emitScopeAnchors: config.emitScopeAnchors ?? false\n };\n }\n\n private hasClassConfig(): boolean {\n return this.config.classPrefix !== '' || this.config.addHeadingIds;\n }\n\n private getClass(baseClass: string, nodeClass?: string): string {\n if (!this.hasClassConfig()) {\n return nodeClass || '';\n }\n const prefix = this.config.classPrefix;\n const classes = [prefix ? `${prefix}${baseClass}` : baseClass];\n if (nodeClass) classes.push(nodeClass);\n return classes.join(' ');\n }\n\n private generateHeadingId(content?: string): string {\n if (!content) return '';\n return content\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n }\n\n /**\n * Get the scope attribute string for a node type.\n * Returns empty string if emitScopeAnchors is disabled.\n */\n private getScopeAttr(node: ContentNode): string {\n if (!this.config.emitScopeAnchors) return '';\n const scopeValue = node.scope || nodeTypeToScope[node.type] || 'container';\n return ` data-md-scope=\"${scopeValue}\"`;\n }\n\n private renderWithClass(tag: string, content: string, baseClass?: string, nodeClass?: string, extraAttrs?: string): string {\n const classAttr = this.hasClassConfig() && baseClass \n ? ` class=\"${this.getClass(baseClass, nodeClass)}\"` \n : '';\n return `<${tag}${classAttr}${extraAttrs || ''}>${content}</${tag}>`;\n }\n\n renderNode(node: ContentNode): string {\n const scopeAttr = this.getScopeAttr(node);\n\n switch (node.type) {\n case 'heading':\n const level = node.attributes?.level || '2';\n const headingId = this.config.addHeadingIds \n ? ` id=\"${this.generateHeadingId(node.content)}\"` \n : '';\n let headingClass = '';\n if (this.hasClassConfig()) {\n const prefix = this.config.classPrefix;\n const levelClass = level === '1' ? 'h1' : level === '2' ? 'h2' : level === '3' ? 'h3' : level === '4' ? 'h4' : level === '5' ? 'h5' : 'h6';\n headingClass = prefix ? `${prefix}${levelClass}` : levelClass;\n }\n if (!headingClass) {\n return `<h${level}${headingId}${scopeAttr}>${node.content || ''}</h${level}>`;\n }\n return `<h${level}${headingId}${scopeAttr} class=\"${headingClass}\">${node.content || ''}</h${level}>`;\n \n case 'paragraph':\n if (node.children) {\n const childrenHtml = node.children.map(child => this.renderNode(child)).join('');\n return this.renderWithClass('p', childrenHtml, 'paragraph', undefined, scopeAttr);\n }\n return this.renderWithClass('p', node.content || '', 'paragraph', undefined, scopeAttr);\n \n case 'list':\n const tag = node.ordered ? 'ol' : 'ul';\n const items = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass(tag, items, 'list', undefined, scopeAttr);\n \n case 'list-item':\n return this.renderWithClass('li', node.content || '', 'list-item', undefined, scopeAttr);\n \n case 'image':\n const src = node.src || node.attributes?.src || '';\n const alt = node.alt || node.attributes?.alt || '';\n const classStr = this.getClass('image', node.className || undefined);\n return `<img src=\"${src}\" alt=\"${alt}\"${classStr ? ` class=\"${classStr}\"` : ''}${scopeAttr}>`;\n \n case 'code':\n const codeClass = this.hasClassConfig() \n ? ` class=\"${this.getClass('code')} language-${node.attributes?.lang || ''}\"` \n : ` class=\"language-${node.attributes?.lang || ''}\"`;\n return `<pre${scopeAttr}><code${codeClass}>${node.content || ''}</code></pre>`;\n \n case 'container':\n if (node.attributes?.tag === 'hr') return '<hr>';\n if (node.attributes?.tag === 'blockquote') {\n const children = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass('blockquote', children, 'blockquote', undefined, scopeAttr);\n }\n // If node has rawHTML, emit it directly\n if (node.rawHTML) {\n return node.rawHTML;\n }\n const containerChildren = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass('div', containerChildren, 'container', node.className || undefined, scopeAttr);\n \n case 'strong':\n return `<strong${scopeAttr}>${node.content || ''}</strong>`;\n \n case 'emphasis':\n return `<em${scopeAttr}>${node.content || ''}</em>`;\n \n case 'link':\n const href = node.attributes?.href || '';\n return `<a href=\"${href}\"${scopeAttr}>${node.content || ''}</a>`;\n \n case 'text':\n default:\n return node.content || '';\n }\n }\n\n renderNodes(nodes: ContentNode[]): string {\n if (!nodes || nodes.length === 0) {\n return '';\n }\n // Wrap in scope root if emitScopeAnchors is enabled\n if (this.config.emitScopeAnchors) {\n const inner = nodes.map(node => this.renderNode(node)).join('\\n');\n return `<div data-md-scope=\"root\">\\n${inner}\\n</div>`;\n }\n return nodes.map(node => this.renderNode(node)).join('\\n');\n }\n\n renderToHTMLString(nodes: ContentNode[]): string {\n return this.renderNodes(nodes);\n }\n\n render(markdown: string): string {\n return markdown;\n }\n\n getCustomCSS(): string {\n return this.config.customCSS;\n }\n}\n","import { MarkdownParser } from './parser.js';\nimport { HTMLRenderer } from './renderer.js';\nimport { ContentNode, MarkdownContent, PipelineConfigV2 } from './types.js';\n\ntype NormalizedPipelineConfig = Required<Omit<PipelineConfigV2, 'onSlot' | 'slotPattern'>> & {\n onSlot?: (name: string) => string;\n slotPattern: RegExp;\n};\n\nexport class MarkdownPipeline {\n private parser: MarkdownParser;\n private renderer: HTMLRenderer;\n private config: NormalizedPipelineConfig;\n\n constructor(config: PipelineConfigV2 = {}) {\n this.config = {\n imagePathPrefix: config.imagePathPrefix || '',\n imageBaseUrl: config.imageBaseUrl || '',\n parseOptions: {\n gfm: config.parseOptions?.gfm ?? true,\n breaks: config.parseOptions?.breaks ?? false,\n pedantic: config.parseOptions?.pedantic ?? false\n },\n styleOptions: {\n classPrefix: config.styleOptions?.classPrefix || '',\n customCSS: config.styleOptions?.customCSS || '',\n addHeadingIds: config.styleOptions?.addHeadingIds ?? false,\n emitScopeAnchors: config.styleOptions?.emitScopeAnchors ?? false\n },\n preserveRawHTML: config.preserveRawHTML ?? false,\n slotPattern: config.slotPattern ?? /\\[\\[(.*?)\\]\\]/g,\n onSlot: config.onSlot,\n errorRecovery: config.errorRecovery ?? 'throw',\n maxRecursionDepth: config.maxRecursionDepth ?? 100,\n allowedHTMLTags: config.allowedHTMLTags ?? []\n };\n\n this.parser = new MarkdownParser({\n imagePathPrefix: this.config.imagePathPrefix,\n imageBaseUrl: this.config.imageBaseUrl,\n preserveRawHTML: this.config.preserveRawHTML,\n slotPattern: this.config.slotPattern,\n onSlot: this.config.onSlot,\n errorRecovery: this.config.errorRecovery,\n maxRecursionDepth: this.config.maxRecursionDepth,\n allowedHTMLTags: this.config.allowedHTMLTags\n });\n this.renderer = new HTMLRenderer(this.config.styleOptions);\n }\n\n parse(markdown: string): ContentNode[] {\n return this.parser.parseToNodes(markdown, this.config.parseOptions);\n }\n\n parseWithMetadata(markdown: string): MarkdownContent {\n return this.parser.parse(markdown, this.config.parseOptions);\n }\n\n render(nodes: ContentNode[]): string {\n return this.renderer.renderNodes(nodes);\n }\n\n renderMarkdown(markdown: string): string {\n const nodes = this.parse(markdown);\n return this.render(nodes);\n }\n\n renderPage(title: string, nodes: ContentNode[], options?: {\n lang?: string;\n charset?: string;\n }): string {\n const html = this.render(nodes);\n return `<!DOCTYPE html>\n<html lang=\"${options?.lang || 'en'}\">\n<head>\n <meta charset=\"${options?.charset || 'UTF-8'}\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n</head>\n<body>\n ${html}\n</body>\n</html>`;\n }\n\n getConfig(): Readonly<PipelineConfigV2> {\n return { ...this.config };\n }\n\n getCustomCSS(): string {\n return this.renderer.getCustomCSS();\n }\n}\n"],"names":[],"mappings":";AAiFO,MAAM,yBAAyB;AAAA,EACpC;AAAA,EAAO;AAAA,EAAS;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAW;AAAA,EAC1C;AAAA,EAAS;AAAA,EAAU;AAAA,EAAU;AAAA,EAAO;AAAA,EAAQ;AAAA,EAC5C;AAAA,EAAc;AAAA,EAAW;AAAA,EAAW;AAAA,EAAQ;AAAA,EAC5C;AAAA,EAAS;AAAA,EAAS;AAAA,EAAU;AAAA,EAAU;AACxC;AAiBO,MAAM,kBAAuD;AAAA,EAClE,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAA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GN;AAAA,EAEA,YAAwC;AACtC,WAAO,EAAE,GAAG,KAAK,OAAA;AAAA,EACnB;AAAA,EAEA,eAAuB;AACrB,WAAO,KAAK,SAAS,aAAA;AAAA,EACvB;AACF;"}
1
+ {"version":3,"file":"index.js","sources":["../src/types.ts","../src/handlers/heading-handler.ts","../src/handlers/paragraph-handler.ts","../src/handlers/list-handler.ts","../src/handlers/image-handler.ts","../src/handlers/code-handler.ts","../src/handlers/hr-handler.ts","../src/handlers/blockquote-handler.ts","../src/handlers/html-handler.ts","../src/handlers/catchall-handler.ts","../src/handlers/registry.ts","../src/parser.ts","../src/renderer.ts","../src/pipeline.ts"],"sourcesContent":["export type ContentNodeType = \n | 'text' \n | 'heading' \n | 'paragraph' \n | 'list' \n | 'list-item' \n | 'image' \n | 'code' \n | 'container'\n | 'strong'\n | 'emphasis'\n | 'link';\n\nexport interface ContentNode {\n type: ContentNodeType;\n content?: string;\n children?: ContentNode[];\n attributes?: Record<string, unknown>;\n className?: string;\n src?: string;\n alt?: string;\n ordered?: boolean;\n /** Raw HTML content for passthrough mode */\n rawHTML?: string;\n /** Scope anchor value for data-md-scope */\n scope?: string;\n}\n\nexport interface MarkdownContent {\n title: string;\n metadata?: Record<string, unknown>;\n content: ContentNode[];\n}\n\nexport interface ParseOptions {\n gfm?: boolean;\n breaks?: boolean;\n pedantic?: boolean;\n}\n\nexport interface StyleConfig {\n classPrefix?: string;\n customCSS?: string;\n addHeadingIds?: boolean;\n}\n\n/**\n * v2: Extended StyleConfig with scope anchor support.\n */\nexport interface StyleConfigV2 extends StyleConfig {\n /** Emit data-md-scope attributes for CSS @scope anchoring (default: false) */\n emitScopeAnchors?: boolean;\n}\n\nexport interface PipelineConfig {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n parseOptions?: ParseOptions;\n styleOptions?: StyleConfig | StyleConfigV2;\n}\n\n/**\n * v2: Extended PipelineConfig with raw HTML passthrough, slot hooks, and error recovery.\n */\nexport interface PipelineConfigV2 extends PipelineConfig {\n styleOptions?: StyleConfigV2;\n /** Preserve raw HTML tags in markdown (img, style, div, span, etc.) (default: false) */\n preserveRawHTML?: boolean;\n /** Regex pattern for slot placeholders like [[SLOT_NAME]] (default: /\\[\\[(.*?)\\]\\]/g) */\n slotPattern?: RegExp;\n /** Callback to resolve slot values. Called with the slot name, returns replacement string. */\n onSlot?: (name: string) => string;\n /** Error recovery mode (default: 'throw' — backward compatible) */\n errorRecovery?: 'throw' | 'warn' | 'silent';\n /** Max recursion depth to prevent stack overflow (default: 100) */\n maxRecursionDepth?: number;\n /** Additional allowed HTML tags for preserveRawHTML mode */\n allowedHTMLTags?: string[];\n /**\n * Allowed HTML attributes per tag for preserveRawHTML mode.\n * Key \"*\" applies to all tags. Key \"tag\" applies to specific tags.\n * Supports \"data-*\" wildcard prefix matching.\n * Example: { \"*\": [\"id\", \"class\"], \"script\": [\"type\", \"src\"] }\n */\n allowedAttributes?: Record<string, string[]>;\n}\n\n\n/** Default allowed HTML tags for preserveRawHTML mode */\nexport const defaultAllowedHTMLTags = [\n 'img', 'style', 'div', 'span', 'section', 'article',\n 'aside', 'header', 'footer', 'nav', 'main', 'figure',\n 'figcaption', 'details', 'summary', 'mark', 'time',\n 'video', 'audio', 'source', 'iframe', 'embed'\n];\n\n/** Scope hierarchy values for data-md-scope */\nexport type ScopeValue =\n | 'root'\n | 'heading'\n | 'paragraph'\n | 'list'\n | 'list-item'\n | 'image'\n | 'code'\n | 'strong'\n | 'emphasis'\n | 'link'\n | 'container';\n\n/** Maps ContentNodeType to ScopeValue */\nexport const nodeTypeToScope: Record<ContentNodeType, ScopeValue> = {\n 'text': 'root',\n 'heading': 'heading',\n 'paragraph': 'paragraph',\n 'list': 'list',\n 'list-item': 'list-item',\n 'image': 'image',\n 'code': 'code',\n 'container': 'container',\n 'strong': 'strong',\n 'emphasis': 'emphasis',\n 'link': 'link',\n};\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'heading' tokens (h1-h6).\n */\nexport class HeadingHandler implements TokenHandler {\n readonly type = 'heading';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'heading' as const,\n content: ctx.processSlots(token.text as string),\n attributes: { level: String(token.depth) }\n };\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'paragraph' tokens, including inline images and raw HTML.\n */\nexport class ParagraphHandler implements TokenHandler {\n readonly type = 'paragraph';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokens = (token.tokens as Array<Record<string, unknown>>) || [];\n const hasInlineImage = tokens.some(t => t.type === 'image');\n const hasInlineHTML = tokens.some(t => t.type === 'html');\n\n if (hasInlineImage || (ctx.preserveRawHTML && hasInlineHTML)) {\n const children = tokens.map(t => {\n if (t.type === 'image') {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(t.href as string),\n alt: t.text as string || ''\n };\n }\n if (t.type === 'html' && ctx.preserveRawHTML) {\n const processed = ctx.processRawHTML(t.raw as string);\n if (processed.trim()) {\n return { type: 'text' as const, content: processed };\n }\n return null;\n }\n return {\n type: 'text' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || ''))\n };\n }).filter(Boolean) as ContentNode[];\n\n if (children.length === 0) return null;\n\n return { type: 'paragraph' as const, children };\n }\n\n return {\n type: 'paragraph' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(token.text as string))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'list' tokens (ordered and unordered).\n */\nexport class ListHandler implements TokenHandler {\n readonly type = 'list';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'list' as const,\n ordered: token.ordered as boolean,\n children: (token.items as Array<Record<string, unknown>>).map((item) => ({\n type: 'list-item' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(item.text as string))\n }))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'image' tokens.\n */\nexport class ImageHandler implements TokenHandler {\n readonly type = 'image';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(token.href as string),\n alt: token.title as string || ''\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'code' tokens (fenced code blocks).\n */\nexport class CodeHandler implements TokenHandler {\n readonly type = 'code';\n\n handle(token: Record<string, unknown>, _ctx: ParseContext) {\n return {\n type: 'code' as const,\n content: token.text as string,\n attributes: { lang: token.lang as string || '' }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'hr' tokens (horizontal rules).\n */\nexport class HrHandler implements TokenHandler {\n readonly type = 'hr';\n\n handle(_token: Record<string, unknown>, _ctx: ParseContext) {\n return { type: 'container' as const, attributes: { tag: 'hr' } };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'blockquote' tokens.\n */\nexport class BlockquoteHandler implements TokenHandler {\n readonly type = 'blockquote';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'container' as const,\n attributes: { tag: 'blockquote' },\n children: ctx.parseTokens((token.tokens as unknown[]) || [], ctx.maxRecursionDepth + 1)\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'html' tokens (inline or block-level raw HTML).\n * In preserveRawHTML mode, passes through allowed HTML tags.\n * Otherwise, stores the raw content as a container node.\n */\nexport class HtmlHandler implements TokenHandler {\n readonly type = 'html';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n if (ctx.preserveRawHTML) {\n const raw = token.raw as string;\n const processed = ctx.processRawHTML(raw);\n if (processed.trim()) {\n return { type: 'container' as const, rawHTML: processed };\n }\n return null;\n }\n return { type: 'container' as const, content: token.raw as string };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Catch-all handler for any token type that doesn't have a dedicated handler.\n * Wraps the raw token content in a container node so content is never silently lost.\n * Reports the unhandled type via the context's reportUnhandled callback.\n */\nexport class CatchAllHandler implements TokenHandler {\n readonly type = '*';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokenType = token.type as string;\n\n // Report the unhandled token so callers can be notified\n ctx.reportUnhandled(tokenType, token);\n\n // Try to extract meaningful content from the raw token\n const raw = token.raw as string | undefined;\n const text = token.text as string | undefined;\n const content = raw || text || `[unhandled: ${tokenType}]`;\n\n return {\n type: 'container' as const,\n content,\n attributes: {\n 'data-unhandled': tokenType,\n tag: 'div'\n }\n };\n }\n}\n","import type { TokenHandler } from './types.js';\nimport { HeadingHandler } from './heading-handler.js';\nimport { ParagraphHandler } from './paragraph-handler.js';\nimport { ListHandler } from './list-handler.js';\nimport { ImageHandler } from './image-handler.js';\nimport { CodeHandler } from './code-handler.js';\nimport { HrHandler } from './hr-handler.js';\nimport { BlockquoteHandler } from './blockquote-handler.js';\nimport { HtmlHandler } from './html-handler.js';\nimport { CatchAllHandler } from './catchall-handler.js';\n\n/**\n * Registry of token handlers. Handlers can be added/overridden externally\n * to extend the parser without modifying its internals.\n *\n * The registry uses a two-tier lookup:\n * 1. First, check for a dedicated handler by token type name\n * 2. If none found, fall back to the catch-all handler (registered as '*')\n *\n * The catch-all handler ensures no content is silently lost — unhandled\n * token types are wrapped in a container node with `data-unhandled` attribute.\n */\nexport class TokenHandlerRegistry {\n private handlers = new Map<string, TokenHandler>();\n private catchAll: TokenHandler;\n\n constructor() {\n // Register all built-in handlers\n this.register(new HeadingHandler());\n this.register(new ParagraphHandler());\n this.register(new ListHandler());\n this.register(new ImageHandler());\n this.register(new CodeHandler());\n this.register(new HrHandler());\n this.register(new BlockquoteHandler());\n this.register(new HtmlHandler());\n\n // Catch-all handler for any unregistered token types\n this.catchAll = new CatchAllHandler();\n }\n\n /** Register a handler. Overrides any existing handler for the same token type. */\n register(handler: TokenHandler): void {\n this.handlers.set(handler.type, handler);\n }\n\n /** Unregister a handler by token type. */\n unregister(type: string): void {\n this.handlers.delete(type);\n }\n\n /**\n * Get a handler for the given token type.\n * Falls back to the catch-all handler if no dedicated handler is registered.\n */\n get(type: string): TokenHandler {\n return this.handlers.get(type) ?? this.catchAll;\n }\n\n /** Check if a dedicated handler exists for the given token type (excludes catch-all). */\n has(type: string): boolean {\n return this.handlers.has(type);\n }\n\n /** Get all registered dedicated handler types. */\n get types(): string[] {\n return Array.from(this.handlers.keys());\n }\n\n /** Replace the catch-all handler with a custom implementation. */\n setCatchAll(handler: TokenHandler): void {\n this.catchAll = handler;\n }\n\n /** Get the current catch-all handler. */\n getCatchAll(): TokenHandler {\n return this.catchAll;\n }\n}\n","import { marked } from 'marked';\nimport { ContentNode, MarkdownContent, ParseOptions, defaultAllowedHTMLTags } from './types.js';\nimport { TokenHandlerRegistry, ParseContext } from './handlers/index.js';\n\nexport interface ParserOptions {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n preserveRawHTML?: boolean;\n slotPattern?: RegExp;\n onSlot?: (name: string) => string;\n errorRecovery?: 'throw' | 'warn' | 'silent';\n maxRecursionDepth?: number;\n allowedHTMLTags?: string[];\n /**\n * Allowed HTML attributes per tag for preserveRawHTML mode.\n * Key \"*\" applies to all tags. Key \"tag\" applies to specific tags.\n * Supports \"data-*\" wildcard prefix matching.\n */\n allowedAttributes?: Record<string, string[]>;\n /**\n * Callback invoked when a token type has no dedicated handler.\n\n * The catch-all handler will still produce a container node for the content,\n * but this callback allows callers to log, warn, or track unhandled types.\n *\n * @param type - The unhandled token type name (e.g. 'table', 'def')\n * @param token - The raw marked token\n */\n onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n}\n\nconst DEFAULT_SLOT_PATTERN = /\\[\\[(.*?)\\]\\]/g;\n\n// Re-export handler types for convenience\nexport { TokenHandlerRegistry } from './handlers/index.js';\nexport type { TokenHandler, ParseContext } from './handlers/index.js';\n\n// ─── MarkdownParser ───────────────────────────────────────────────────────────\n\nexport class MarkdownParser {\n private imagePathPrefix: string;\n private imageBaseUrl: string;\n private preserveRawHTML: boolean;\n private slotPattern: RegExp;\n private onSlot: ((name: string) => string) | undefined;\n private errorRecovery: 'throw' | 'warn' | 'silent';\n private maxRecursionDepth: number;\n private allowedHTMLTags: Set<string>;\n private allowedAttributes: Record<string, string[]>;\n private handlerRegistry: TokenHandlerRegistry;\n private onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n\n constructor(options?: ParserOptions) {\n this.imagePathPrefix = options?.imagePathPrefix || '';\n this.imageBaseUrl = options?.imageBaseUrl || '';\n this.preserveRawHTML = options?.preserveRawHTML ?? false;\n this.slotPattern = options?.slotPattern ?? DEFAULT_SLOT_PATTERN;\n this.onSlot = options?.onSlot;\n this.errorRecovery = options?.errorRecovery ?? 'throw';\n this.maxRecursionDepth = options?.maxRecursionDepth ?? 100;\n this.allowedHTMLTags = new Set([\n ...defaultAllowedHTMLTags,\n ...(options?.allowedHTMLTags ?? [])\n ]);\n this.allowedAttributes = options?.allowedAttributes ?? {};\n this.handlerRegistry = new TokenHandlerRegistry();\n this.onUnhandledToken = options?.onUnhandledToken;\n }\n\n\n /** Access the handler registry for customization. */\n get handlers(): TokenHandlerRegistry {\n return this.handlerRegistry;\n }\n\n private processImagePath(src: string): string {\n if (src.startsWith('http') || src.startsWith('/')) {\n return src;\n }\n let path = this.imagePathPrefix ? `${this.imagePathPrefix}${src}` : src;\n if (this.imageBaseUrl && !path.startsWith('http')) {\n path = `${this.imageBaseUrl}${path}`;\n }\n return path;\n }\n\n private processInlineFormatting(text: string): string {\n return text\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>');\n }\n\n private processSlots(text: string): string {\n if (!this.onSlot) return text;\n return text.replace(this.slotPattern, (match, name: string) => {\n return this.onSlot!(name.trim());\n });\n }\n\n /**\n * Check if an attribute name is allowed for a given tag.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private isAttributeAllowed(tagName: string, attrName: string): boolean {\n const globalAllowed = this.allowedAttributes['*'];\n if (globalAllowed && this.matchesAttributeList(attrName, globalAllowed)) {\n return true;\n }\n const tagAllowed = this.allowedAttributes[tagName];\n if (tagAllowed && this.matchesAttributeList(attrName, tagAllowed)) {\n return true;\n }\n return false;\n }\n\n /**\n * Check if an attribute name matches a list of allowed patterns.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private matchesAttributeList(attrName: string, allowed: string[]): boolean {\n const lower = attrName.toLowerCase();\n for (const pattern of allowed) {\n if (pattern.endsWith('-*')) {\n const prefix = pattern.slice(0, -1).toLowerCase();\n if (lower.startsWith(prefix)) return true;\n } else if (pattern.toLowerCase() === lower) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Filter attributes on an HTML tag, keeping only allowed ones.\n */\n private filterTagAttributes(tag: string): string {\n // Match opening tag: <tagname ...attrs...>\n const tagMatch = tag.match(/^<\\/?(\\w+)/);\n if (!tagMatch) return tag;\n const tagName = tagMatch[1].toLowerCase();\n\n // If no attribute rules defined, return as-is\n const hasRules = Object.keys(this.allowedAttributes).length > 0;\n if (!hasRules) return tag;\n\n // Extract all attributes from the tag\n const attrRegex = /(\\S+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|(\\S+))/g;\n const selfClosing = tag.endsWith('/>');\n\n // Get the tag opening part (e.g., <div or </div)\n const tagOpen = tagMatch[0];\n const remaining = tag.slice(tagOpen.length);\n\n // Rebuild the tag with only allowed attributes\n let filtered = tagOpen;\n let match: RegExpExecArray | null;\n while ((match = attrRegex.exec(remaining)) !== null) {\n const attrName = match[1];\n const attrValue = match[2] ?? match[3] ?? match[4] ?? '';\n if (this.isAttributeAllowed(tagName, attrName)) {\n filtered += ` ${attrName}=\"${attrValue.replace(/\"/g, '\"')}\"`;\n }\n }\n\n // Close the tag\n if (selfClosing) {\n filtered += ' /';\n }\n filtered += '>';\n\n return filtered;\n }\n\n private processRawHTML(html: string): string {\n if (!this.allowedHTMLTags.has('script')) {\n html = html.replace(/<script[\\s\\S]*?<\\/script>/gi, '');\n html = html.replace(/<\\/?script[^>]*>/gi, '');\n }\n if (!this.allowedHTMLTags.has('style')) {\n html = html.replace(/<style[\\s\\S]*?<\\/style>/gi, '');\n html = html.replace(/<\\/?style[^>]*>/gi, '');\n }\n\n // Filter attributes on all remaining HTML tags\n const hasAttrRules = Object.keys(this.allowedAttributes).length > 0;\n if (hasAttrRules) {\n html = html.replace(/<[^>]+>/g, (match) => this.filterTagAttributes(match));\n }\n\n return html;\n }\n\n\n /**\n * Build the ParseContext that is passed to every token handler.\n * This is the bridge between the parser's private services and the handlers.\n */\n private createContext(): ParseContext {\n const self = this;\n return {\n get preserveRawHTML() { return self.preserveRawHTML; },\n get errorRecovery() { return self.errorRecovery; },\n get maxRecursionDepth() { return self.maxRecursionDepth; },\n processImagePath: (src: string) => self.processImagePath(src),\n processInlineFormatting: (text: string) => self.processInlineFormatting(text),\n processSlots: (text: string) => self.processSlots(text),\n processRawHTML: (html: string) => self.processRawHTML(html),\n parseTokens: (tokens: unknown[], depth: number) => self.parseTokens(tokens, depth),\n reportUnhandled: (type: string, token: Record<string, unknown>) => {\n self.onUnhandledToken?.(type, token);\n }\n };\n }\n\n private parseTokens(tokens: unknown[], depth: number = 0): ContentNode[] {\n if (depth > this.maxRecursionDepth) {\n const msg = `[md2html] Max recursion depth (${this.maxRecursionDepth}) exceeded, truncating`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n return [];\n }\n\n const nodes: ContentNode[] = [];\n const ctx = this.createContext();\n\n for (const token of tokens) {\n const typedToken = token as Record<string, unknown>;\n // The registry automatically falls back to the catch-all handler\n const handler = this.handlerRegistry.get(typedToken.type as string);\n const node = handler.handle(typedToken, ctx);\n if (node) {\n nodes.push(node);\n }\n }\n\n return nodes;\n }\n\n parse(markdown: string, options?: ParseOptions): MarkdownContent {\n const parseOptions = {\n gfm: options?.gfm ?? true,\n breaks: options?.breaks ?? false,\n pedantic: options?.pedantic ?? false\n };\n\n try {\n const tokens = marked.lexer(markdown, parseOptions as Parameters<typeof marked.lexer>[1]);\n const content = this.parseTokens(tokens);\n\n return {\n title: '',\n content\n };\n } catch (err) {\n if (this.errorRecovery === 'throw') throw err;\n\n const msg = `[md2html] Parse error: ${err instanceof Error ? err.message : String(err)}`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n\n return {\n title: '',\n content: [{ type: 'text', content: markdown }]\n };\n }\n }\n\n parseToNodes(markdown: string, options?: ParseOptions): ContentNode[] {\n return this.parse(markdown, options).content;\n }\n}\n","import { ContentNode, StyleConfig, StyleConfigV2, nodeTypeToScope } from './types.js';\n\nexport class HTMLRenderer {\n private config: Required<StyleConfigV2>;\n\n constructor(config: StyleConfigV2 = {}) {\n this.config = {\n classPrefix: config.classPrefix || '',\n customCSS: config.customCSS || '',\n addHeadingIds: config.addHeadingIds ?? false,\n emitScopeAnchors: config.emitScopeAnchors ?? false\n };\n }\n\n private hasClassConfig(): boolean {\n return this.config.classPrefix !== '' || this.config.addHeadingIds;\n }\n\n private getClass(baseClass: string, nodeClass?: string): string {\n if (!this.hasClassConfig()) {\n return nodeClass || '';\n }\n const prefix = this.config.classPrefix;\n const classes = [prefix ? `${prefix}${baseClass}` : baseClass];\n if (nodeClass) classes.push(nodeClass);\n return classes.join(' ');\n }\n\n private generateHeadingId(content?: string): string {\n if (!content) return '';\n return content\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n }\n\n /**\n * Get the scope attribute string for a node type.\n * Returns empty string if emitScopeAnchors is disabled.\n */\n private getScopeAttr(node: ContentNode): string {\n if (!this.config.emitScopeAnchors) return '';\n const scopeValue = node.scope || nodeTypeToScope[node.type] || 'container';\n return ` data-md-scope=\"${scopeValue}\"`;\n }\n\n private renderWithClass(tag: string, content: string, baseClass?: string, nodeClass?: string, extraAttrs?: string): string {\n const classAttr = this.hasClassConfig() && baseClass \n ? ` class=\"${this.getClass(baseClass, nodeClass)}\"` \n : '';\n return `<${tag}${classAttr}${extraAttrs || ''}>${content}</${tag}>`;\n }\n\n renderNode(node: ContentNode): string {\n const scopeAttr = this.getScopeAttr(node);\n\n switch (node.type) {\n case 'heading':\n const level = node.attributes?.level || '2';\n const headingId = this.config.addHeadingIds \n ? ` id=\"${this.generateHeadingId(node.content)}\"` \n : '';\n let headingClass = '';\n if (this.hasClassConfig()) {\n const prefix = this.config.classPrefix;\n const levelClass = level === '1' ? 'h1' : level === '2' ? 'h2' : level === '3' ? 'h3' : level === '4' ? 'h4' : level === '5' ? 'h5' : 'h6';\n headingClass = prefix ? `${prefix}${levelClass}` : levelClass;\n }\n if (!headingClass) {\n return `<h${level}${headingId}${scopeAttr}>${node.content || ''}</h${level}>`;\n }\n return `<h${level}${headingId}${scopeAttr} class=\"${headingClass}\">${node.content || ''}</h${level}>`;\n \n case 'paragraph':\n if (node.children) {\n const childrenHtml = node.children.map(child => this.renderNode(child)).join('');\n return this.renderWithClass('p', childrenHtml, 'paragraph', undefined, scopeAttr);\n }\n return this.renderWithClass('p', node.content || '', 'paragraph', undefined, scopeAttr);\n \n case 'list':\n const tag = node.ordered ? 'ol' : 'ul';\n const items = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass(tag, items, 'list', undefined, scopeAttr);\n \n case 'list-item':\n return this.renderWithClass('li', node.content || '', 'list-item', undefined, scopeAttr);\n \n case 'image':\n const src = node.src || node.attributes?.src || '';\n const alt = node.alt || node.attributes?.alt || '';\n const classStr = this.getClass('image', node.className || undefined);\n return `<img src=\"${src}\" alt=\"${alt}\"${classStr ? ` class=\"${classStr}\"` : ''}${scopeAttr}>`;\n \n case 'code':\n const codeClass = this.hasClassConfig() \n ? ` class=\"${this.getClass('code')} language-${node.attributes?.lang || ''}\"` \n : ` class=\"language-${node.attributes?.lang || ''}\"`;\n return `<pre${scopeAttr}><code${codeClass}>${node.content || ''}</code></pre>`;\n \n case 'container':\n if (node.attributes?.tag === 'hr') return '<hr>';\n if (node.attributes?.tag === 'blockquote') {\n const children = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass('blockquote', children, 'blockquote', undefined, scopeAttr);\n }\n // If node has rawHTML, emit it directly\n if (node.rawHTML) {\n return node.rawHTML;\n }\n const containerChildren = node.children?.map(child => this.renderNode(child)).join('') || '';\n return this.renderWithClass('div', containerChildren, 'container', node.className || undefined, scopeAttr);\n \n case 'strong':\n return `<strong${scopeAttr}>${node.content || ''}</strong>`;\n \n case 'emphasis':\n return `<em${scopeAttr}>${node.content || ''}</em>`;\n \n case 'link':\n const href = node.attributes?.href || '';\n return `<a href=\"${href}\"${scopeAttr}>${node.content || ''}</a>`;\n \n case 'text':\n default:\n return node.content || '';\n }\n }\n\n renderNodes(nodes: ContentNode[]): string {\n if (!nodes || nodes.length === 0) {\n return '';\n }\n // Wrap in scope root if emitScopeAnchors is enabled\n if (this.config.emitScopeAnchors) {\n const inner = nodes.map(node => this.renderNode(node)).join('\\n');\n return `<div data-md-scope=\"root\">\\n${inner}\\n</div>`;\n }\n return nodes.map(node => this.renderNode(node)).join('\\n');\n }\n\n renderToHTMLString(nodes: ContentNode[]): string {\n return this.renderNodes(nodes);\n }\n\n render(markdown: string): string {\n return markdown;\n }\n\n getCustomCSS(): string {\n return this.config.customCSS;\n }\n}\n","import { MarkdownParser } from './parser.js';\nimport { HTMLRenderer } from './renderer.js';\nimport { ContentNode, MarkdownContent, PipelineConfigV2 } from './types.js';\n\ntype NormalizedPipelineConfig = Required<Omit<PipelineConfigV2, 'onSlot' | 'slotPattern'>> & {\n onSlot?: (name: string) => string;\n slotPattern: RegExp;\n};\n\nexport class MarkdownPipeline {\n private parser: MarkdownParser;\n private renderer: HTMLRenderer;\n private config: NormalizedPipelineConfig;\n\n constructor(config: PipelineConfigV2 = {}) {\n this.config = {\n imagePathPrefix: config.imagePathPrefix || '',\n imageBaseUrl: config.imageBaseUrl || '',\n parseOptions: {\n gfm: config.parseOptions?.gfm ?? true,\n breaks: config.parseOptions?.breaks ?? false,\n pedantic: config.parseOptions?.pedantic ?? false\n },\n styleOptions: {\n classPrefix: config.styleOptions?.classPrefix || '',\n customCSS: config.styleOptions?.customCSS || '',\n addHeadingIds: config.styleOptions?.addHeadingIds ?? false,\n emitScopeAnchors: config.styleOptions?.emitScopeAnchors ?? false\n },\n preserveRawHTML: config.preserveRawHTML ?? false,\n slotPattern: config.slotPattern ?? /\\[\\[(.*?)\\]\\]/g,\n onSlot: config.onSlot,\n errorRecovery: config.errorRecovery ?? 'throw',\n maxRecursionDepth: config.maxRecursionDepth ?? 100,\n allowedHTMLTags: config.allowedHTMLTags ?? [],\n allowedAttributes: config.allowedAttributes ?? {}\n };\n\n\n this.parser = new MarkdownParser({\n imagePathPrefix: this.config.imagePathPrefix,\n imageBaseUrl: this.config.imageBaseUrl,\n preserveRawHTML: this.config.preserveRawHTML,\n slotPattern: this.config.slotPattern,\n onSlot: this.config.onSlot,\n errorRecovery: this.config.errorRecovery,\n maxRecursionDepth: this.config.maxRecursionDepth,\n allowedHTMLTags: this.config.allowedHTMLTags,\n allowedAttributes: this.config.allowedAttributes\n });\n\n this.renderer = new HTMLRenderer(this.config.styleOptions);\n }\n\n parse(markdown: string): ContentNode[] {\n return this.parser.parseToNodes(markdown, this.config.parseOptions);\n }\n\n parseWithMetadata(markdown: string): MarkdownContent {\n return this.parser.parse(markdown, this.config.parseOptions);\n }\n\n render(nodes: ContentNode[]): string {\n return this.renderer.renderNodes(nodes);\n }\n\n renderMarkdown(markdown: string): string {\n const nodes = this.parse(markdown);\n return this.render(nodes);\n }\n\n renderPage(title: string, nodes: ContentNode[], options?: {\n lang?: string;\n charset?: string;\n }): string {\n const html = this.render(nodes);\n return `<!DOCTYPE html>\n<html lang=\"${options?.lang || 'en'}\">\n<head>\n <meta charset=\"${options?.charset || 'UTF-8'}\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n</head>\n<body>\n ${html}\n</body>\n</html>`;\n }\n\n getConfig(): Readonly<PipelineConfigV2> {\n return { ...this.config };\n }\n\n getCustomCSS(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AAK,OAAO;AAAA,MAC1B,iBAAiB,KAAK,OAAO;AAAA,MAC7B,aAAa,KAAK,OAAO;AAAA,MACzB,QAAQ,KAAK,OAAO;AAAA,MACpB,eAAe,KAAK,OAAO;AAAA,MAC3B,mBAAmB,KAAK,OAAO;AAAA,MAC/B,iBAAiB,KAAK,OAAO;AAAA,MAC7B,mBAAmB,KAAK,OAAO;AAAA,IAAA,CAChC;AAED,SAAK,WAAW,IAAI,aAAa,KAAK,OAAO,YAAY;AAAA,EAC3D;AAAA,EAEA,MAAM,UAAiC;AACrC,WAAO,KAAK,OAAO,aAAa,UAAU,KAAK,OAAO,YAAY;AAAA,EACpE;AAAA,EAEA,kBAAkB,UAAmC;AACnD,WAAO,KAAK,OAAO,MAAM,UAAU,KAAK,OAAO,YAAY;AAAA,EAC7D;AAAA,EAEA,OAAO,OAA8B;AACnC,WAAO,KAAK,SAAS,YAAY,KAAK;AAAA,EACxC;AAAA,EAEA,eAAe,UAA0B;AACvC,UAAM,QAAQ,KAAK,MAAM,QAAQ;AACjC,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,WAAW,OAAe,OAAsB,SAGrC;AACT,UAAM,OAAO,KAAK,OAAO,KAAK;AAC9B,WAAO;AAAA,cACG,SAAS,QAAQ,IAAI;AAAA;AAAA,mBAEhB,SAAS,WAAW,OAAO;AAAA;AAAA,WAEnC,KAAK;AAAA;AAAA;AAAA,IAGZ,IAAI;AAAA;AAAA;AAAA,EAGN;AAAA,EAEA,YAAwC;AACtC,WAAO,EAAE,GAAG,KAAK,OAAA;AAAA,EACnB;AAAA,EAEA,eAAuB;AACrB,WAAO,KAAK,SAAS,aAAA;AAAA,EACvB;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leadertechie/md2html",
3
- "version": "0.1.0-alpha.15",
3
+ "version": "0.1.0-alpha.16",
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",