Created
December 28, 2014 13:36
-
-
Save basilfx/1ad484d8965e091252c8 to your computer and use it in GitHub Desktop.
Github Markdown TOC generator
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
var sections = $("h2"); | |
var output = ""; | |
for (var i = 0; i < sections.length; i++) { | |
var link = $(sections[i]).find("a").prop("href"); | |
var text = $(sections[i]).text().trim() | |
output = output + "* [" + text + "](" + link + ")\n"; | |
} | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment