diff options
| author | altaf-creator <dev@altafcreator.com> | 2026-06-13 19:06:09 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2026-06-13 19:06:09 +0800 |
| commit | 1b14996290f228a329d83c164e50c27364cc0a22 (patch) | |
| tree | 14e978e3c17674f36fd36d4d60b278a7e0c788ea /markdown_renderer.py | |
| parent | b9b627ca77048191577b41f40c352a9ce67ef61b (diff) | |
Diffstat (limited to 'markdown_renderer.py')
| -rw-r--r-- | markdown_renderer.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/markdown_renderer.py b/markdown_renderer.py index 1e7c755..7c1bd0b 100644 --- a/markdown_renderer.py +++ b/markdown_renderer.py @@ -8,8 +8,10 @@ class DefaultClassTreeprocessor(markdown.treeprocessors.Treeprocessor): def run(self, root): for element in root.iter("a"): print(element.attrib) - if "class" not in element.attrib or "button" not in element.attrib["class"]: + if "class" not in element.attrib: element.set("class", "link") + elif "button" not in element.attrib["class"]: + element.set("class", element.attrib["class"] + " link") if "href" in element.attrib and element.attrib["href"] == "": del element.attrib["href"] for element in root.iter("img"): |
