想要开启导航栏,需要写代码进行自定义,具体操作如下:
就在 Tools→ Options → Advanced
中的Custom Html Head Content中,点击HTML head edit将下面的代码复制到弹出的框内即可,保存后按F6快速代开浏览器预览才可显示导航栏,在markdownpad里是显示不了的。
代码出处:https://blog.csdn.net/u010842019/article/details/79868024
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
//是否显示导航栏
var showNavBar = true;
//是否展开导航栏
var expandNavBar = true;
var currentIndex = 0;
var currentScrollHigh = 0;
var currentContentScrollHigh = 0;
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
$(window).onbeforeunload = function(){
currentIndex = 0;
}
$(window).load(function(){
var h1s = $("body").find("h1");
var h2s = $("body").find("h2");
var h3s = $("body").find("h3");
var h4s = $("body").find("h4");
var h5s = $("body").find("h5");
var h6s = $("body").find("h6");
var headCounts = [h1s.length, h2s.length, h3s.length, h4s.length, h5s.length, h6s.length];
var vH1Tag = null; // 显示的最高层级
var vH2Tag = null; // 显示的最低层级
var sum = 0;
for(var i = 0; i < headCounts.length; i++){
if(headCounts[i] > 0){
for( var y = 0; y < headCounts[i]; y++)
sum = sum + 1;
}
}
for(var i = 0; i < headCounts.length; i++){
if(headCounts[i] > 0){
if(vH1Tag == null){
vH1Tag = 'h' + (i + 1);
}else{
vH2Tag = 'h' + (i + 1);
}
}
}
if(vH1Tag == null){
return;
}
$("body").prepend('<div class="BlogAnchor">' +
'<span style="color:red;position:absolute;top:-6px;left:0px;cursor:pointer;" onclick="$(\'.BlogAnchor\').hide();">×</span>' +
'<p>' +
'<b id="AnchorContentToggle" title="收起" style="cursor:pointer;">目录▲</b>' +
'</p>' +
'<div class="AnchorContent" id="AnchorContent"> </div>' +
'</div>' );
var vH1Index = 0;
var vH2Index = 0;
var vIndexH1 = 0;
var vIndexH2 = 0;
var vIndexH3 = 0;
var vIndexH4 = 0;
var vIndexH5 = 0;
var vIndexH6 = 0;
var headerALL = [];
var headerIDALL = [];
var headerHightALL = [];
$("body").find("h1,h2,h3,h4,h5,h6").each(function(i,item){
var id = '';
var name = '';
var