Mini Markdown
Write to_html(md) that converts a tiny Markdown subset: lines starting with # or ## become <h1>/<h2>; lines starting with "- " form a <ul> of <li>; any other non-empty line is a <p>. Inline, **bold** becomes <strong> and *italic* becomes <em>. Blank lines separate blocks. Return the lines joined with newlines.
Examples
to_html("# Todo\n\n- shop\n- cook") → "<h1>Todo</h1>\n<ul>\n<li>shop</li>\n<li>cook</li>\n</ul>"Exercise
5 checksMini Markdown
import re
def inline(text):
return text
def to_html(md):
...
print(to_html("# My notes\n\nKeep **it** simple.\n\n- plan\n- *build*"))
Press Run to try your code, then Check answer to grade it.