my eye

Change Pre block markdown support to use GitHub style

Committed 9ea023

--- a/web/markdown/__init__.py
+++ b/web/markdown/__init__.py

 
     """
 
-    pattern = r"^[ ]{4}"
+    pattern = r"^`{3}.*"
 
     def parse(self, block):
         """"""
-        text = dedent(block)
-        if text.startswith(">>> "):
+        text = block.removeprefix("```").removesuffix("```")
+        if text.startswith("\n"):
+            html = E.PRE(text.strip())
+        elif text.startswith(">>> "):
             lexer = pygments.lexers.PythonConsoleLexer()
             lexer.add_filter("codetagify")
             formatter = pygments.formatters.HtmlFormatter(cssclass="doctest")
             code = pygments.highlight(text, lexer, formatter)
             html = lxml.html.fromstring(code)
         else:
-            html = E.PRE(text.strip())
+            language, _, code = text.partition("\n")
+            lexer = pygments.lexers.get_lexer_by_name(language)
+            lexer.add_filter("codetagify")
+            formatter = pygments.formatters.HtmlFormatter()
+            code = pygments.highlight(text, lexer, formatter)
+            html = lxml.html.fromstring(code)
         return html