def process_items(item_list: list) ->str:
    """
	Runs through all found toc items and returns them as a string.

	INPUTS:
	item_list: list of ToC items

	OUTPUTS:
	A string representing (possibly nested) html lists of the structure of the ToC
	"""
    unclosed_ol = 0
    out_string = ''
    for index in range(0, len(item_list) - 1):
        this_item = item_list[index]
        next_item = item_list[index + 1]
        if next_item.level == this_item.level:
            out_string += '<li>\n'
            out_string += this_item.toc_link()
            out_string += '</li>\n'
        if next_item.level > this_item.level:
            out_string += '<li>\n'
            out_string += this_item.toc_link()
            out_string += '<ol>\n'
            unclosed_ol += 1
        if next_item.level < this_item.level:
            out_string += '<li>\n'
            out_string += this_item.toc_link()
            out_string += '</li>\n'
            torepeat = this_item.level - next_item.level
            if torepeat > 0 and unclosed_ol > 0:
                for _ in range(0, torepeat):
                    out_string += '</ol>\n'
                    unclosed_ol -= 1
                    out_string += '</li>\n'
    return out_string
