From 05356a593753e1493e82d55be622abbdcd57c6f2 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Wed, 19 Apr 2023 14:36:25 +0300 Subject: [PATCH] skip tables and code --- reporting/md-counters | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reporting/md-counters b/reporting/md-counters index 3427805..04c3223 100755 --- a/reporting/md-counters +++ b/reporting/md-counters @@ -41,7 +41,17 @@ def main(): enumerator_match = [re.compile("^" + " " * (4 * x) + "[\d]+\. ") for x in range(4)] in_enumerator = False + 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)): + print(row) + continue + if opts.n: if row.startswith("#"): headers, title = row.strip().split(" ", 1)