moved markdown logic to model