Skip to content

Instantly share code, notes, and snippets.

@cloudsben
Last active June 14, 2023 07:46
Show Gist options
  • Star 89 You must be signed in to star a gist
  • Fork 35 You must be signed in to fork a gist
  • Save cloudsben/6059930 to your computer and use it in GitHub Desktop.
Save cloudsben/6059930 to your computer and use it in GitHub Desktop.
markdown menu
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function(){
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;
$(item).attr("id","wow"+i);
$("#category").append('<a class="new'+tag+'" href="#wow'+i+'">'+$(this).text()+'</a></br>');
$(".newh2").css("margin-left",0);
$(".newh3").css("margin-left",20);
$(".newh4").css("margin-left",40);
$(".newh5").css("margin-left",60);
$(".newh6").css("margin-left",80);
});
});
</script>
<div id="category"></div>
@batizhao
Copy link

Mou 导出 pdf 就不起作用了。

@ZoomQuiet
Copy link

good job, usage in us blogging...

@nosun
Copy link

nosun commented Oct 25, 2014

thanks!

@zifeixu85
Copy link

挺不错的

@mougua
Copy link

mougua commented Dec 15, 2014

不错~

@hbigboy
Copy link

hbigboy commented Jan 26, 2016

good ~

@liulunet
Copy link

用上了,感谢!

@m0nkee
Copy link

m0nkee commented Feb 25, 2016

great

@angelmaskill
Copy link

没有H1的部分,在楼主基础上做了微调。多谢楼主分享
image

@fengxuangit
Copy link

fucking good

@DerekHardman
Copy link

Powerful. But any idea why this script returns duplicate entries?

@valiant555
Copy link

导出的html可以看见导航菜单,但是pdf就乱套了。另外 怎么能在不导出html而是在预览时,就能看到导航栏呢?

@programmerZhou
Copy link

这个脚本怎么执行啊

@peiyake
Copy link

peiyake commented Dec 22, 2017

666,我使用makedownpad,直接把这段代码放在开头. 然后导出html直接就有目录了

@YuanzhiBao
Copy link

老哥666

@ZLD1819858
Copy link

thank the author.

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