()
| 388 | }; |
| 389 | |
| 390 | function getActiveProcessor() { |
| 391 | // 优先使用 AST 架构(如果已加载) |
| 392 | const ast = global.MarkdownProcessorAST; |
| 393 | if (ast && typeof ast.render === 'function') { |
| 394 | return ast; |
| 395 | } |
| 396 | |
| 397 | // 其次使用 Enhanced |
| 398 | const enhanced = global.MarkdownProcessorEnhanced; |
| 399 | if (enhanced && typeof enhanced.safeMarkdown === 'function' && typeof enhanced.renderWithKatexFailback === 'function') { |
| 400 | return enhanced; |
| 401 | } |
| 402 | |
| 403 | // 最后使用 Legacy |
| 404 | return legacyImpl; |
| 405 | } |
| 406 | |
| 407 | function safeMarkdown(md, images) { |
| 408 | const impl = getActiveProcessor(); |
no outgoing calls
no test coverage detected