Migrate the codebox macro to the native title feature for code blocks
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 17 Nov 2021 08:28:10 +0000 (09:28 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 17 Nov 2021 08:28:10 +0000 (09:28 +0100)
main.py

diff --git a/main.py b/main.py
index 8e816f7deb209b6ad3c7c51f8e5ae7faf67fe1a2..0bc8a53ae608a2fb39905be7940f3afeae78ebb9 100644 (file)
--- a/main.py
+++ b/main.py
@@ -18,24 +18,15 @@ def define_env(env):
                 ).replace('<p>', '').replace('</p>', '')
                 
                 return f"""
-<div class="titledCodeBox">
-    <div class="codeBoxTitle">
-        <code>{title}</code>
-        <a class="codeBoxTitleGitHubLink" href="{editLink}" title="View on GitHub">{icon}</a>
-    </div>
-    ```{language}
-    --8<-- "{filepath}"
-    ```
-</div>
+```{language} title='{title} <a class="codeBoxTitleGitHubLink" href="{editLink}" title="View on GitHub">{icon}</a>'
+--8<-- "{filepath}"
+```
 """
             else:
                 return f"""
-<div class="titledCodeBox">
-    <div class="codeBoxTitle"><code>{title}</code></div>
-```{language}
+```{language} title="{title}"
 {contents}
 ```
-</div>
 """
         else:
             if filepath is not None: