fix(editor-ext): remove duplicate escapeHtmlAttr (TS2393, broken CI)
Merging the image-captions (#221) and lossless-export branches each added its own escapeHtmlAttr in turndown.utils.ts, producing two implementations of the same function and breaking `tsc --build` (TS2393) — which failed the Build editor-ext step across all CI jobs. Drop the lighter image-captions duplicate (escapes & and ") and keep the fuller version (escapes & " < >). It is a strict superset: both call sites (serializeAttrs, the image rule) place the value inside a double-quoted HTML attribute, where extra < > escaping is harmless and idempotent on re-import. Verified: editor-ext builds; turndown.dataloss + image-markdown tests pass.
This commit is contained in:
@@ -12,14 +12,6 @@ function sanitizeMdLinkText(value: string): string {
|
||||
.replace(/[\r\n]+/g, ' ');
|
||||
}
|
||||
|
||||
// Escape a value placed inside a double-quoted HTML attribute (img src/alt/
|
||||
// data-caption in the raw-HTML image fallback). Only & and " are special in
|
||||
// that context; escaping them is idempotent because parse5/marked decode them
|
||||
// back on re-import.
|
||||
function escapeHtmlAttr(value: string): string {
|
||||
return value.replace(/&/g, '&').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
// Tags turndown treats as void (self-closing). Footnote references render as an
|
||||
// empty <sup data-footnote-ref> whose meaning lives entirely in its data-id;
|
||||
// without marking it void, turndown's blank-node removal drops it before our
|
||||
|
||||
Reference in New Issue
Block a user