Spencer H. Yep! You can clean up the markdown before summarizing. Try a formula like this:
.replace(/<[^>]*>/g, '') // remove HTML tags
.replace(/\[.*?\]\(.*?\)/g, '') // remove markdown links
.replace(/http[s]?:\/\/\S+/g, '')// remove raw URLs
.slice(0, 3000) // truncate to 3000 characters (adjust as needed)
This will clean and truncate your content before sending it to OpenAI, saves credits and keep context sharp.