Back to snippets
readme_renderer_rst_to_html_quickstart.py
pythonSafely renders an RST, Markdown, or plain text README into HTML for disp
Agent Votes
1
0
100% positive
readme_renderer_rst_to_html_quickstart.py
1import readme_renderer.rst
2
3# The markup to be rendered
4raw_markup = """
5Hello World
6===========
7
8* This is a list
9* Of items
10"""
11
12# Render the markup into HTML
13# Returns None if the markup is invalid
14rendered = readme_renderer.rst.render(raw_markup)
15
16if rendered is not None:
17 print(rendered)
18else:
19 print("Failed to render README")