-- Filter to remove image alt text display
function Image(elem)
	-- Clear all caption/alt text
	elem.caption = {}
	elem.attr.attributes = {}
	return elem
end

function Para(elem)
	-- If paragraph contains only an image, keep it
	if #elem.content == 1 and elem.content[1].t == "Image" then
		return elem
	end

	-- Remove any standalone text that looks like alt text (common filenames)
	if #elem.content == 1 and elem.content[1].t == "Str" then
		local text = elem.content[1].text
		-- List of common image extensions
		local image_exts = { "png", "jpg", "jpeg", "gif", "svg", "webp", "bmp" }
		for _, ext in ipairs(image_exts) do
			if text:lower():match("%." .. ext .. "$") then
				return {} -- Remove this paragraph
			end
		end
	end

	return elem
end
