Note that this page includes jQuery 1.2.6 in case you want to test execution of a requires-newer-than-1.2.6 bookmarklet. If you want to do version testing, click here for a good starting point.

This bookmarklet, requiring jQuery 1.3.2:

(drag this to your bookmarks bar or right-click and add to bookmarks)

Was generated from this code:

var indices = [];$('h1,h2,h3,h4,h5,h6').each(function(i,e) {
      var hIndex = parseInt(this.nodeName.substring(1)) - 1;
      if (indices.length - 1 > hIndex) {
        indices= indices.slice(0, hIndex + 1 );
      }
      if (indices[hIndex] == undefined) {
         indices[hIndex] = 0;
      }
      indices[hIndex]++;
      $(this).prepend(indices.join(".")+" ").attr("title",this.tagName);
  });

Create another bookmarklet:

(you may want to minify your code first)