@bobfrankston/mailx-types 0.1.100 → 0.1.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -308,6 +308,20 @@ export function htmlToPlainText(html) {
308
308
  const t = text.replace(/<[^>]+>/g, "").trim();
309
309
  return t && t !== href ? `${t} (${href})` : href;
310
310
  });
311
+ // 2026-09-16 — Claude Code (Fable 5.1), at Bob's direction. Images were
312
+ // stripped with the other tags, so the text/plain alternative of a mail
313
+ // whose point was a picture said nothing about it. A remote image keeps
314
+ // its URL (the plain-text reader can follow it); an inline data:/cid:
315
+ // image has no address a text reader can use, so it becomes a placeholder
316
+ // with the alt text. Same "text (url)" shape as anchors above.
317
+ s = s.replace(/<img\b[^>]*>/gi, (tag) => {
318
+ const src = (tag.match(/\bsrc\s*=\s*(['"])([^'"]*)\1/i) || [])[2]?.trim() || "";
319
+ const alt = (tag.match(/\balt\s*=\s*(['"])([^'"]*)\1/i) || [])[2]?.trim() || "";
320
+ const remote = /^https?:\/\//i.test(src);
321
+ if (remote)
322
+ return alt ? `[image: ${alt}] (${src})` : `(${src})`;
323
+ return alt ? `[image: ${alt}]` : "[image]";
324
+ });
311
325
  // Strip remaining tags.
312
326
  s = s.replace(/<[^>]+>/g, "");
313
327
  // Decode a pragmatic set of HTML entities — the rare ones survive as-is.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-types",
3
- "version": "0.1.100",
3
+ "version": "0.1.102",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",