Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Last active May 10, 2022 14:56
Show Gist options
  • Save wbamberg/05e16bfbc59652f3243b3762064b86c8 to your computer and use it in GitHub Desktop.
Save wbamberg/05e16bfbc59652f3243b3762064b86c8 to your computer and use it in GitHub Desktop.
import sys, re
from os import walk, path
dir = sys.argv[1]
threshold = 20
for (dirpath, dirnames, filenames) in walk(dir):
for filename in filenames:
if filename.endswith("index.md"):
in_file = open(path.join(dirpath, filename), "r")
lines = in_file.readlines()
h3s = 0
for line in lines:
if line.startswith("### "):
h3s = h3s+1
if h3s > threshold:
print("{} : {}".format(dirpath, h3s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment