diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 63331f306..df17be10f 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -10,6 +10,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/main[co
Bug Fixes::
+* Fix `AbstractNode#imageUri()` no longer percent-encoding spaces in a `data:` URI image target (e.g. `image::data:image/svg+xml,[]`), a regression from the data URI image target support added for inline SVG embedding. That change short-circuited `imageUri()` for any `data:` target by returning it unchanged, bypassing the space-encoding that `normalizeWebPath()` still applies for every other URI-ish target — and that upstream Asciidoctor (Ruby) also applies, since `image_uri` has no `data:`-specific early return at all. `imageUri()` now runs `data:` targets through `encodeSpacesInUri()` before returning them, matching Ruby's output byte-for-byte, while still avoiding the spurious `could not retrieve image data from URI` warning the earlier fix was meant to prevent
* Fix `tasks/changelog.js notes` (used to generate GitHub release notes) leaving AsciiDoc attribute references such as `{uri-repo}/issues/1857[#1857]` unresolved in the generated Markdown. `extractReleaseNotes` used to extract the raw AsciiDoc section for a release and convert only that fragment to Markdown, losing the `:uri-repo:` attribute definition from the changelog header in the process. The whole changelog is now converted to Markdown once, and the release section is extracted from the resulting Markdown instead, so attribute references resolve correctly
* Type `Logger#warn()`/`#debug()`/`#info()`/`#error()`/`#fatal()`/`#unknown()`/`#log()` (and the matching `MemoryLogger` methods) with an optional `progname`/`pn` parameter instead of a required one. The generated `.d.ts` previously declared both arguments as mandatory, so calling `doc.getLogger().warn(doc.messageWithContext(...))` with a single argument — the documented pattern for logging from an extension — was flagged by editors as "expected 2 arguments" even though it is valid at runtime; the error surfaced because `getLogger()` resolves to the `LoggerLike` union (`Logger | MemoryLogger | NullLogger | Console`) and TypeScript requires a call to satisfy every member's signature
* Type `messageWithContext()`/`createLogMessage()` on `Document`, `ConverterBase`, `PathResolver`, and `Table.ParserContext` (and the static equivalents on `Parser`). These are installed at runtime by the `applyLogging()` mixin (`logging.js`) *after* the class body closes, so `tsc`'s JSDoc-based declaration emit never picked them up — `doc.messageWithContext(...)`, the pattern shown in the extensions guide, previously had no type at all on the public API surface
diff --git a/packages/core/src/abstract_node.js b/packages/core/src/abstract_node.js
index 797b7efa1..70615af29 100644
--- a/packages/core/src/abstract_node.js
+++ b/packages/core/src/abstract_node.js
@@ -475,8 +475,10 @@ export class AbstractNode {
* @returns {Promise} a Promise resolving to a String reference or data URI.
*/
async imageUri(targetImage, assetDirKey = 'imagesdir') {
- // A data URI is already an embedded image, so use it as-is rather than reading or re-encoding it.
- if (targetImage.startsWith('data:')) return targetImage
+ // A data URI is already an embedded image, so use it as-is (aside from space
+ // encoding, which normalizeWebPath would otherwise apply) rather than reading
+ // or re-encoding it.
+ if (targetImage.startsWith('data:')) return encodeSpacesInUri(targetImage)
const doc = this.document
if (doc.safe < SafeMode.SECURE && doc.hasAttribute('data-uri')) {
let imagesBase
diff --git a/packages/core/test/blocks.images.test.js b/packages/core/test/blocks.images.test.js
index caca4e3f3..7ecc185be 100644
--- a/packages/core/test/blocks.images.test.js
+++ b/packages/core/test/blocks.images.test.js
@@ -793,6 +793,17 @@ image::data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=[Do
)
})
+ test('encodes spaces in an embedded data uri image target', async () => {
+ const input =
+ "image::data:image/svg+xml,[Dot]"
+ const output = await convertStringToEmbedded(input)
+ assert.ok(
+ output.includes(
+ "data:image/svg+xml,"
+ )
+ )
+ })
+
test('cleans reference to ancestor directories in imagesdir before reading image if safe mode level is at least SAFE', async () => {
await usingMemoryLogger(async (logger) => {
const input = `\