Description
The library uses require() in src/inline-renderer.ts:89 to avoid circular dependencies:
const { renderBlock } = require('./block-renderer.js');
However, require() is not available in strict ESM environments:
- Bun
- Deno
- Node.js with
--experimental-vm-modules
- Bundlers in strict ESM mode
This causes a ReferenceError: require is not defined when rendering footnotes.
Steps to Reproduce
- Use the library in Bun or Deno
- Convert a Markdown document containing footnotes
- Error is thrown
Expected Behavior
The library should work in all ESM-compatible environments.
Suggested Fix
Replace require() with dependency injection - pass renderBlock through the RenderContext object. This maintains the circular import avoidance while being fully ESM-compatible.
Description
The library uses
require()insrc/inline-renderer.ts:89to avoid circular dependencies:However,
require()is not available in strict ESM environments:--experimental-vm-modulesThis causes a
ReferenceError: require is not definedwhen rendering footnotes.Steps to Reproduce
Expected Behavior
The library should work in all ESM-compatible environments.
Suggested Fix
Replace
require()with dependency injection - passrenderBlockthrough theRenderContextobject. This maintains the circular import avoidance while being fully ESM-compatible.