Factor create_listitem_markup() out of generate_markup().