Skip to content

Commit 78acfa8

Browse files
committed
Scope @ escaping to URL strings only
Use isExternalPath() to only escape @ in strings that start with a protocol scheme (http:, https:, mailto:, etc.). Preserves intentional citations like @smith2024 in book description or other metadata fields.
1 parent 3aeceee commit 78acfa8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/command/render/pandoc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Document } from "../../core/deno-dom.ts";
2727
import { execProcess } from "../../core/process.ts";
2828
import { dirAndStem, normalizePath } from "../../core/path.ts";
2929
import { mergeConfigs } from "../../core/config.ts";
30+
import { isExternalPath } from "../../core/url.ts";
3031

3132
import {
3233
Format,
@@ -1844,7 +1845,7 @@ function resolveTextHighlightStyle(
18441845
// deno-lint-ignore no-explicit-any
18451846
function escapeAtInMetadata(value: any): any {
18461847
if (typeof value === "string") {
1847-
return value.replaceAll("@", "@");
1848+
return isExternalPath(value) ? value.replaceAll("@", "@") : value;
18481849
}
18491850
if (Array.isArray(value)) {
18501851
return value.map(escapeAtInMetadata);

0 commit comments

Comments
 (0)