Learn practical skills, build real-world projects, and advance your career

Markdown Table of Contents & Navigation Menu
Making Python do all the work!
~ Evan Marie Carr (EvanMarie.com)
# Allows print statements with variable background and font color and font size

bgcolor = 'cyan'; text_color = 'purple';
def div_print(text, width='auto',  bgcolor=bgcolor, text_color=text_color,
              fontsize=2):
    from IPython.display import HTML as html_print
        
    return display(html_print("<span style = 'display: block; width: {}; \
                                line-height: 2; background: {};\
                                margin-left: auto; margin-right: auto;\
                                border: 1px solid text_color;\
                                border-radius: 3px; text-align: center;\
                                padding: 3px 8px 3px 8px;'>\
                                <font size={}><text style=color:{}>{}\
                                </text></font></style>".format(width, bgcolor, 
                                                                   fontsize,
                                                                   text_color, text)))

parse_links() creates 3 lists from the given list of topics to be included in the table of contents and navigation menu. These will be used by table_of_contents() and link_menu() to create the markdown code.