Updated code for generating figures in md documents.