remove images before generate a snippet