Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(toc): add custom TOC font size
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Mar 9, 2020
1 parent 2b0e598 commit 1894403
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
9 changes: 8 additions & 1 deletion assets/css/_partial/_single/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
display: block;
display: flex;
justify-content: space-between;
font-size: 1.2em;
font-weight: bold;
line-height: 2em;
padding: 0 .625rem;
Expand Down Expand Up @@ -133,6 +132,14 @@
}

.toc {
.toc-title {
font-size: $toc-title-font-size;
}

.toc-content {
font-size: $toc-content-font-size;
}

ruby {
background: $code-background-color;

Expand Down
4 changes: 4 additions & 0 deletions assets/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ $header-hover-color-dark: #fff !default;
// ========== Header ========== //

// ========== Single Content ========== //
// Font size of the TOC
$toc-title-font-size: 1.2rem !default;
$toc-content-font-size: 0.9rem !default;

// Color of the single link
$single-link-color: #2d96bd !default;
$single-link-color-dark: #eee !default;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
}
const toc = document.getElementById('toc-auto');
const page = document.getElementsByClassName('page')[0];
toc.style.maxWidth = `${page.getBoundingClientRect().left - 40}px`;
toc.style.maxWidth = `${page.getBoundingClientRect().left - 20}px`;
this._tocLinks = this._tocLinks || tocCore.getElementsByTagName('a');
this._tocLis = this._tocLis || tocCore.getElementsByTagName('li');
this._headerLinks = this._headerLinks || document.getElementsByClassName('headerLink') || [];
Expand Down

0 comments on commit 1894403

Please sign in to comment.