最近搜索


没有最近搜索

Nicholas Smolney's Avatar

Nicholas Smolney

已加入2021年4月15日

·

最后活动2021年10月27日

关注

0

关注者

0

活动总数

5

投票

0

订阅

3

活动概览

的最新活动 Nicholas Smolney

Nicholas Smolney 进行了评论,

社区评论 Discussion - Tips and best practices from the community

and if anyone else is interested, I made a small addition to my css file to indent for subsequent levels

 

.toc ul{
padding-left: 20px;
}

查看评论 · 已于 2018年5月25日 发布 · Nicholas Smolney

0

关注者

0

投票

0

评论


Nicholas Smolney 进行了评论,

社区评论 Discussion - Tips and best practices from the community

Hey Dave, see below for how I addressed this:

Basically the code didn't account for the case when your next heading is going back a level (current_level < previous_level), so I added that case and added an array to keep track of the previous levels.

/*** Table of contents code ***/
var $headers = $('.article-body h1');

if ($headers.length > 0) {
var $toc = $('

');
var $firstUl = $('

查看评论 · 已于 2018年5月25日 发布 · Nicholas Smolney

0

关注者

0

投票

0

评论