remove code and tables from toc
This commit is contained in:
@@ -49,7 +49,16 @@ def main():
|
|||||||
marker_found = False
|
marker_found = False
|
||||||
marker_end_found = False
|
marker_end_found = False
|
||||||
to_remove = []
|
to_remove = []
|
||||||
|
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)):
|
||||||
|
continue
|
||||||
|
|
||||||
if row.startswith("#"):
|
if row.startswith("#"):
|
||||||
headers, title = row.strip().split(" ", 1)
|
headers, title = row.strip().split(" ", 1)
|
||||||
if opts.l:
|
if opts.l:
|
||||||
|
|||||||
Reference in New Issue
Block a user