Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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