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() { match compiler.target() {
Target::HTML => { Target::HTML => {
let match_depth = |current: usize, target: usize| -> String { 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(); result += match_depth(current_depth, section.depth).as_str();
if section.kind & section_kind::NO_NUMBER != 0 { if section.kind & section_kind::NO_NUMBER != 0 {
result += format!( 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::refname(compiler.target(), section.title.as_str()),
Compiler::sanitize(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; margin-top: 1.8em;
width: 85%; width: 85%;
padding: 0.5em; 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 { .toc a {
@ -221,6 +226,7 @@ li.navbar-entry-current a {
.toc span { .toc span {
display: flex; display: flex;
justify-content: center; justify-content: center;
font-weight: 600;
} }
/* Sections */ /* Sections */
@ -229,6 +235,10 @@ a.section-link {
text-decoration: none; text-decoration: none;
} }
h1, h2, h3, h4, h5, h6 {
color: #BA54Cc
}
h1:hover a.section-link { h1:hover a.section-link {
display: inline; display: inline;
} }
@ -391,4 +401,3 @@ blockquote p::after {
.blockquote-author { .blockquote-author {
margin-left: 0.2em; margin-left: 0.2em;
} }