Commit Diff


commit - d91b76e7f844d9b8a87a0b186e7aa3431c5dda4b
commit + 833c985010b7052a56a8e04288d6a12e0fdf5651
blob - bf4da523d8a6f36c3e1044c0828eafc9b199b52d
blob + a56dc81ed80256a807463d8407daf745ed7398ee
--- yah2g.py
+++ yah2g.py
@@ -234,11 +234,18 @@ class _RequestHandler(BaseHTTPRequestHandler):
                                 a.attrib.update(target="_blank", href=target)
                             a.text = splitted[1] if len(splitted) > 1 else target
                             flush_before.commit().write(ET.tostring(p) + b"\r\n")
-                        elif line.startswith("#") and len(line.split()) > 1:
-                            splitted = line.split(maxsplit=1)
-                            h = ET.Element("h" + str(len(splitted[0])))
-                            h.text = splitted[1]
+                        elif line.startswith("###"):
+                            h = ET.Element("h3")
+                            h.text = line[3:]
                             flush_before.commit().write(ET.tostring(h) + b"\r\n")
+                        elif line.startswith("##"):
+                            h = ET.Element("h2")
+                            h.text = line[2:]
+                            flush_before.commit().write(ET.tostring(h) + b"\r\n")
+                        elif line.startswith("#"):
+                            h = ET.Element("h1")
+                            h.text = line[1:]
+                            flush_before.commit().write(ET.tostring(h) + b"\r\n")
                         elif line.startswith("* ") and line[2:].strip():
                             if ul.elem is None:
                                 ul.elem = ET.Element("ul")