Implemented detection of codeblocks and made it ignore everything inside it.

This commit is contained in:
The Wobbler 2025-04-10 10:10:57 +02:00
parent 2e16be6484
commit 15718aff6f

9
omg.py
View file

@ -91,10 +91,19 @@ class OMG:
"links": []
}
codeblock = False
for line in content.split("\n"):
if line == "":
continue
if line.startswith("```"): # detect codeblocks and ignore everything inside it
codeblock = not codeblock
continue
if codeblock:
continue
# ==== headings ====
if line.startswith("#"): # heading or tag
tokens = line.split()