Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

batizhao commented Mar 13, 2014

Mou 导出 pdf 就不起作用了。

@ZoomQuiet

This comment has been minimized.

Copy link

ZoomQuiet commented May 8, 2014

good job, usage in us blogging...

@nosun

This comment has been minimized.

Copy link

nosun commented Oct 25, 2014

thanks!

@zifeixu85

This comment has been minimized.

Copy link

zifeixu85 commented Nov 15, 2014

挺不错的

@mougua

This comment has been minimized.

Copy link

mougua commented Dec 15, 2014

不错~

@huangzizhu

This comment has been minimized.

Copy link

huangzizhu commented Jan 26, 2016

good ~

@liulunet

This comment has been minimized.

Copy link

liulunet commented Jan 27, 2016

用上了,感谢!

@m0nkee

This comment has been minimized.

Copy link

m0nkee commented Feb 25, 2016

great

@angelmaskill

This comment has been minimized.

Copy link

angelmaskill commented Mar 18, 2016

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

@fengxuangit

This comment has been minimized.

Copy link

fengxuangit commented May 23, 2016

fucking good

@DerekHardman

This comment has been minimized.

Copy link

DerekHardman commented Jun 2, 2016

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

@valiant555

This comment has been minimized.

Copy link

valiant555 commented Sep 11, 2016

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

@programmerZhou

This comment has been minimized.

Copy link

programmerZhou commented Nov 18, 2016

这个脚本怎么执行啊

@peiyake

This comment has been minimized.

Copy link

peiyake commented Dec 22, 2017

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

@YuanzhiBao

This comment has been minimized.

Copy link

YuanzhiBao commented Feb 18, 2018

老哥666

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