fix: article toc display (#376)

pull/384/head
Seaton Jiang 2021-05-24 12:04:59 +08:00
parent 1fa538ba2a
commit 499d08f278
No known key found for this signature in database
GPG Key ID: C1086BAE716FF138
3 changed files with 14 additions and 17 deletions

View File

@ -2172,47 +2172,44 @@ ol {
background-color: #f7f6f6;
}
.k-main .sidebar .w-toc .item .ul-3 {
.k-main .sidebar .w-toc .item ul {
padding-left: 0;
}
.k-main .sidebar .w-toc .item ul li::before {
position: absolute;
top: 15px;
bottom: 0;
left: -6px;
width: 11px;
height: 11px;
border: 3px solid #fff;
border-radius: 15px;
background: #a7a7a7;
content: "";
}
.k-main .sidebar .w-toc .item .li-1::before {
border-width: 1px;
}
.k-main .sidebar .w-toc .item .li-2::before {
top: 10%;
left: -6px;
width: 11px;
height: 11px;
border-width: 2px;
}
.k-main .sidebar .w-toc .item .li-1 a,
.k-main .sidebar .w-toc .item .li-2 a {
font-weight: 500;
font-size: 15px;
}
.k-main .sidebar .w-toc .item .li-3::before {
top: 30%;
left: -6px;
width: 11px;
height: 11px;
}
.k-main .sidebar .w-toc .item .li-3 a {
padding-left: 25px;
font-weight: 400;
font-size: 14px;
}
.k-main .sidebar .w-toc .item .li-2:hover::before,
.k-main .sidebar .w-toc .item .li-3:hover::before {
.k-main .sidebar .w-toc .item li:hover::before {
background: #00a2ff;
}

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
* 文章相关函数
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2021.05.22
* @version 2021.05.24
*/
// 文章链接添加 target 和 rel
@ -582,7 +582,7 @@ function article_toc()
$index .= '</li>';
}
}
$index .= '<li class="li-'.$toc_depth.'"><a href="#toc-' . $toc_item['count'] . '">' . $toc_item['text'] . '</a>';
$index .= '<li class="li-'.$toc_depth.'"><a href="#toc-' . $toc_item['count'] . '">' . str_replace(array('[h2title]', '[/h2title]'),array('', ''),$toc_item['text']) . '</a>';
$prev_depth = $toc_item['depth'];
}
for ($i = 0; $i <= $to_depth; $i++) {