Skip to content

v4.0.5

Choose a tag to compare

@github-actions github-actions released this 21 Jul 21:01

Summary

Release meta

Released on: 2026-07-21
Released by: ggrossetie
Published by: GitHub

Logs: full diff

Changelog

Bug Fixes

  • Fix Document#getLogger() (and getLogger() on any prototype augmented by applyLogging(): Converter, Parser, PathResolver, Table.ParserContext) silently ignoring a per-instance override of the logger getter, even though its own JSDoc describes it as "a method alias for the logger getter". applyLogging() (logging.js) installed getLogger as a fixed arrow function with no this binding, so it always fell back to the global LoggerManager.logger instead of resolving through this.logger — breaking the logger option to convert()/load() once the async-local-storage scope from load() had closed (i.e. during doc.convert(), when most block/inline converters and extensions run). Extensions/converters that follow the documented doc.getLogger() pattern (e.g. to log a warning with messageWithContext()) would have those messages silently escape a caller-supplied logger such as a MemoryLogger
  • Fix inline macro extensions ignoring the contentModel/positionalAttrs (or the DSL contentModel()/positionalAttributes()/resolveAttributes() setters) configuration, so the macro’s bracket content was never parsed into named/positional attributes and always ended up as a raw string in attributes.text instead — e.g. registry.inlineMacro(function () { this.named('emoji'); this.positionalAttributes('size'); this.process(...) }) produced { text: '2x' } instead of { '1': '2x', size: '2x' } for emoji:smile[2x]. Substitutors#subMacros (the inline macro substitution path in substitutors.js) read the extension config with keys that were never populated by the DSL/static config (#1857)

Improvements

  • Extension Processor config keys (contentModel, positionalAttrs, defaultAttrs) now use camelCase consistently across every registration style — the DSL setters, class-based static config, and the block/inline macro substitution code that reads them. The legacy Ruby-style snake_case keys (content_model, positional_attrs, pos_attrs, default_attrs) are still accepted for backward compatibility when a processor class declares its config directly (static config = { content_model: 'attributes' } or MyProcessor.config = { content_model: 'attributes' }). Processor.config also gained a static setter, so assigning a static config object after the class declaration (as shown in the BlockMacroProcessor/InlineMacroProcessor JSDoc examples) no longer throws a TypeError
  • Type AbstractNode#logger/#getLogger() and Reader/PreprocessorReader#logger/#getLogger()/#createLogMessage() with the new LoggerLike union (Logger | MemoryLogger | NullLogger | Console, exported from logging.js) instead of a bare object. In reader.js, fields and helper methods that are only ever touched within the class that declares them (Reader’s cursor mark, PreprocessorReader’s include/conditional-directive bookkeeping) are now real JS #private members instead of _-prefixed by convention; the remaining _-prefixed fields that PreprocessorReader must read/reassign (_dir, _document, _lines, …) are annotated @internal so they’re stripped from the generated public .d.ts without changing runtime access