html-content

Easily construct HTML document with pandas DataFrame, markdown, matplotlib, plotly and HTML.


License
MIT
Install
pip install html-content==0.0.2

Documentation

HTML Content

Easily construct HTML document with pandas DataFrame, markdown, matplotlib, plotly and HTML.

This tiny package can help build organized content similar to Jupyter notebook, while using pure python code.

Install

pip install html-content==0.0.2

Example

For full example code, please refer to test.py.

content = HtmlContent('Title of example')

# markdown
content.add_markdown('# Header')
content.add_markdown('***')
content.add_markdown('## success text', bg_color=Type.SUCCESS)
content.add_markdown('## warning text', bg_color=Type.WARNING)
content.add_markdown('## error text', bg_color=Type.ERROR)
content.add_markdown('normal text')

# add fig
content.add_matplotlib_fig(create_matplotlib_fig())
content.add_plotly_fig(create_plotly_fig())

# add HTML
content.add_html('<b>Bold font</b>')

# add pandas
df = create_df()
content.add_df(df, caption='pandas table with diverging_gradient=False', diverging_gradient=False)
content.add_df(df, caption='pandas table with diverging_gradient=True', diverging_gradient=True)

# save content to HTML
# content.get_html()
content.save_html('example/content.html')

Snapshot of example/content.html

Part1 Part2 Part3

Reference