From 15718aff6f352ef198209046d22e84f55b77f5a9 Mon Sep 17 00:00:00 2001 From: The Wobbler Date: Thu, 10 Apr 2025 10:10:57 +0200 Subject: [PATCH] Implemented detection of codeblocks and made it ignore everything inside it. --- omg.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/omg.py b/omg.py index f797fd1..14ecea6 100755 --- a/omg.py +++ b/omg.py @@ -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()