remove code and tables from toc

This commit is contained in:
Ville Rantanen
2023-04-19 14:42:10 +03:00
parent 05356a5937
commit 7175186ff7

View File

@@ -49,7 +49,16 @@ def main():
marker_found = False
marker_end_found = False
to_remove = []
in_code = False
for i, row in enumerate(markdown):
in_table = row.startswith("|")
if row.startswith("```"):
in_code = not in_code
if any((in_code, in_table)):
continue
if row.startswith("#"):
headers, title = row.strip().split(" ", 1)
if opts.l: