Created
August 8, 2016 01:07
-
-
Save davidchambers/0b4daa0917d95f1fccaaea53b66714ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drop(n) { | |
s = "" | |
for (i = n + 1; i <= NF; i += 1) { s = s (s == "" ? "" : " ") $i } | |
return s | |
} | |
/^ *\/\/\. ##/ { | |
indent = substr($2, 2) # reduce indentation by one level | |
gsub(/#/, " ", indent) | |
href = tolower(drop(2)) | |
gsub(/ /, "-", href) | |
print indent "- [" drop(2) "](#" href ")" | |
} | |
/^ *\/\/\#/ { | |
href = $2 | |
sub(/#/, ".prototype.", href) | |
print indent " - [`" drop(1) "`](#" href ")" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment