def add_toc(source: str) ->str:
    """Add table of contents to the beginning of the page source"""
    result = (
        '<ac:structured-macro ac:macro-id="1" ac:name="toc" ac:schema-version="1"/>\n'
         + source)
    return result
