Better section styleing & Fix toc numbering issue

This commit is contained in:
ef3d0c3e 2024-11-03 10:42:47 +01:00
parent d4d8acfb97
commit ef041fcb5f
2 changed files with 17 additions and 3 deletions

View file

@ -66,6 +66,11 @@ impl Element for Toc {
}
}
if sections.is_empty()
{
return Ok("".into())
}
match compiler.target() {
Target::HTML => {
let match_depth = |current: usize, target: usize| -> String {
@ -92,7 +97,7 @@ impl Element for Toc {
result += match_depth(current_depth, section.depth).as_str();
if section.kind & section_kind::NO_NUMBER != 0 {
result += format!(
"<li><a href=\"#{}\">{}</a></li>",
"<li style=\"list-style-type:none\"><a href=\"#{}\">{}</a></li>",
Compiler::refname(compiler.target(), section.title.as_str()),
Compiler::sanitize(compiler.target(), section.title.as_str())
)

View file

@ -205,7 +205,12 @@ li.navbar-entry-current a {
margin-top: 1.8em;
width: 85%;
padding: 0.5em;
background-color: #1f1f1f;
font-size: 1.15em;
background-color: #242526;
border-radius: 3px;
box-shadow: 0px 0px 3px 1px #242526 inset;
}
.toc a {
@ -221,6 +226,7 @@ li.navbar-entry-current a {
.toc span {
display: flex;
justify-content: center;
font-weight: 600;
}
/* Sections */
@ -229,6 +235,10 @@ a.section-link {
text-decoration: none;
}
h1, h2, h3, h4, h5, h6 {
color: #BA54Cc
}
h1:hover a.section-link {
display: inline;
}
@ -391,4 +401,3 @@ blockquote p::after {
.blockquote-author {
margin-left: 0.2em;
}