Skip to content

Instantly share code, notes, and snippets.

@tekkub
Created December 7, 2009 08:50
Show Gist options
  • Save tekkub/250718 to your computer and use it in GitHub Desktop.
Save tekkub/250718 to your computer and use it in GitHub Desktop.
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important")
$("div.sidebar").prepend(toc).prepend($("<h3>").text("Table of Contents"))
$("div.main div.wikistyle h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
})
})
@teddyzetterlund
Copy link

Not possible anymore, the new wiki's don't allow embeded javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment