skip tables and code

This commit is contained in:
Ville Rantanen
2023-04-19 14:36:25 +03:00
parent e8725bbeb3
commit 05356a5937

View File

@@ -41,7 +41,17 @@ def main():
enumerator_match = [re.compile("^" + " " * (4 * x) + "[\d]+\. ") for x in range(4)] enumerator_match = [re.compile("^" + " " * (4 * x) + "[\d]+\. ") for x in range(4)]
in_enumerator = False in_enumerator = False
in_code = False
for i, row in enumerate(markdown): for i, row in enumerate(markdown):
in_table = row.startswith("|")
if row.startswith("```"):
in_code = not in_code
if any((in_code, in_table)):
print(row)
continue
if opts.n: if opts.n:
if row.startswith("#"): if row.startswith("#"):
headers, title = row.strip().split(" ", 1) headers, title = row.strip().split(" ", 1)