Docs for lists.

This commit is contained in:
Bob Nystrom
2014-01-31 17:51:09 -08:00
parent 25a6565f9f
commit 3bc79af83a
3 changed files with 96 additions and 1 deletions
+11
View File
@@ -44,6 +44,17 @@ def format_file(path, skip_up_to_date):
else:
print "UNKNOWN COMMAND:", command, args
elif stripped.startswith('#'):
# Add anchors to the headers.
index = stripped.find(" ")
headertype = stripped[:index]
header = stripped[index:].strip()
anchor = header.lower().replace(' ', '-')
anchor = anchor.translate(None, '.?!:/')
contents += indentation + headertype
contents += '{1} <a href="#{0}" name="{0}" class="header-anchor">#</a>\n'.format(anchor, header)
else:
contents = contents + line