Skip to content

Commit

Permalink
Fix toc indent with level larger 4
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiju committed Jul 29, 2017
1 parent 6c95bd4 commit 52e7f8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions templates/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ function renderTocList(array $elements, Aura\View\View $context)
foreach ($elements as $entry) {
$entryObj = new Bookdown\Bookdown\Content\Heading($entry['number'], $entry['title'], $entry['href'], $entry['id']);

echo '<li class="list-group-item level-' . $entryObj->getLevel() . '">';
echo '<li class="list-group-item level-default level-' . $entryObj->getLevel() . '">';
echo '<div class="row clearfix">';
echo '<div class="col-sm-2">' . '<span class="text-number">' . "{$entryObj->getNumber()}" . '</span></div>';
echo '<div class="col-sm-10">' . $context->anchorRaw($entryObj->getHref(), $entryObj->getTitle()) . '</div>';
echo '</div>';
if (isset($entry['nested'])) {
$collapseId = 'collapse-' . $entryObj->getAnchor();
$collapseId = 'collapse-' . str_replace('.','-', trim($entryObj->getNumber(),'.'));
echo '<a class="bbt-toc-toggle badge glyphicon collapsed" href="#' . $collapseId . '" data-toggle="collapse" aria-expanded="false" aria-controls="' . $collapseId . '"></a>';
echo '<ul class="list-group list-toc-nested collapse" id="' . $collapseId . '">';
renderTocList($entry['nested'], $context);
Expand Down
10 changes: 9 additions & 1 deletion templates/style.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@
font-weight: bold;
padding: 0;
}


.list-toc .list-group-item.level-default {
padding-left: 60px;
}

.list-toc .list-group-item.level-1 {
padding-left: 0;
}

.list-toc .list-group-item.level-2 {
padding-left: 20px;
}
Expand Down

0 comments on commit 52e7f8d

Please sign in to comment.