Markdown 生成目录

 1 <link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
 2 <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
 3 <script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
 4 <script>hljs.initHighlightingOnLoad();</script>
 5 <script type="text/javascript">
 6 $(document).ready(function(){
 7 $("h2,h3,h4,h5,h6").each(function(i,item){
 8 var tag = $(item).get(0).localName;
 9 $(item).attr("id","wow"+i);
10 $("#category").append('<a class="new'+tag+'" href="#wow'+i+'">'+$(this).text()+'</a></br>');
11 $(".newh2").css("margin-left",0);
12 $(".newh3").css("margin-left",20);
13 $(".newh4").css("margin-left",40);
14 $(".newh5").css("margin-left",60);
15 $(".newh6").css("margin-left",80)
16 });
17 });
18 </script>
19 <div id="category"></div>

 

posted @ 2015-10-08 17:33  LX_明明如月  阅读(260)  评论(0编辑  收藏  举报