docs: add comprehensive list documentation and header anchor links in style

This commit is contained in:
Bob Nystrom
2014-02-01 01:51:09 +00:00
parent b89aac569b
commit 2538922db5
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