console.debug('MarkdownRenderer: Found excluded URL in text:', excludedUrl);
// Find where it appears
const index = text.indexOf(excludeMediaUrls.find(orig => text.includes(orig)) || '');
const index = text.indexOf(excludeUrls.find(orig => text.includes(orig)) || '');
if (index >= 0) {
console.debug('MarkdownRenderer: URL found at index:', index, 'context:', text.substring(Math.max(0, index - 20), Math.min(text.length, index + 100)));
}
@ -764,9 +773,10 @@
@@ -764,9 +773,10 @@
// Helper function to apply exclusion filtering to HTML (used for both fresh and cached content)
function applyExclusionFiltering(htmlContent: string): string {
if (excludeMediaUrls.length === 0) return htmlContent;
const excludeUrls = normalizedExcludeMediaUrls;
if (!excludeUrls || excludeUrls.length === 0) return htmlContent;
const normalizedExcludeUrls = new Set(excludeMediaUrls.map(url => normalizeUrl(url)));
const normalizedExcludeUrls = new Set(excludeUrls.map(url => normalizeUrl(url)));
let filtered = htmlContent;
// Remove ALL img tags with excluded URLs (aggressive cleanup)
@ -898,7 +908,8 @@
@@ -898,7 +908,8 @@
});
// Normalize exclude URLs for comparison
const normalizedExcludeUrls = new Set(excludeMediaUrls.map(url => normalizeUrl(url)));
const excludeUrls = normalizedExcludeMediaUrls;
const normalizedExcludeUrls = new Set(excludeUrls.map(url => normalizeUrl(url)));
// AGGRESSIVE CLEANUP: Remove ALL img tags with excluded URLs first (before any other processing)
// This is the most important step - it catches images regardless of how they were created