mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-13 22:29:48 +08:00
e99ce744cd
- Browser strategy: headless first with automatic retry in visible Chrome on failure - New --browser auto|headless|headed flag with --headless/--headed shortcuts - Content cleaner module for HTML preprocessing (remove ads, base64 images, scripts) - Media localizer now handles base64 data URIs alongside remote URLs - Capture finalUrl from browser to track redirects for output path - Agent quality gate documentation for post-capture validation - Upgrade defuddle ^0.12.0 → ^0.14.0 - Add unit tests for content-cleaner, html-to-markdown, legacy-converter, media-localizer
29 lines
888 B
TypeScript
29 lines
888 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { extractContent } from "./html-to-markdown.js";
|
|
|
|
const EMBEDDED_IMAGE_HTML = `<!doctype html>
|
|
<html>
|
|
<body>
|
|
<main>
|
|
<article>
|
|
<h1>Embedded Image Story</h1>
|
|
<p>
|
|
This paragraph is intentionally long enough to satisfy the extractor thresholds so the
|
|
resulting markdown keeps the main article body and the embedded image reference.
|
|
</p>
|
|
<img src="data:image/png;base64,AAAA" alt="inline">
|
|
</article>
|
|
</main>
|
|
</body>
|
|
</html>`;
|
|
|
|
test("extractContent preserves base64 images when requested for media download", async () => {
|
|
const result = await extractContent(EMBEDDED_IMAGE_HTML, "https://example.com/embedded", {
|
|
preserveBase64Images: true,
|
|
});
|
|
|
|
assert.match(result.markdown, /!\[inline\]\(data:image\/png;base64,AAAA\)/);
|
|
});
|