Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

418 B
Raw Blame
package utility

import "regexp"

var markdownImageMarkup = regexp.MustCompile(`(?is)!\[[^\]]*\]\(([^()]|\([^()]*\))*\)|<div[^>]*>\s*<img[^>]*>\s*</div>|<img[^>]*>`)

// StripMarkdownImages removes inline Markdown images and HTML image markup.
// Inline destinations may contain one level of balanced parentheses.
func StripMarkdownImages(text string) string {
	return markdownImageMarkup.ReplaceAllString(text, "")
}