corrected prev/next to handle md and txt files