feat: improve heading appearance with heading level markers #

This commit is contained in:
Price Hiller 2023-12-14 15:59:43 -06:00
parent cbaf7ebe37
commit 5bff8aa977
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
2 changed files with 18 additions and 2 deletions

View File

@ -203,7 +203,7 @@ img {
.anchor:visited, .anchor:visited,
.anchor:link, .anchor:link,
.anchor:active { .anchor:active {
color: var(--boatYellow2); color: var(--carpYellow);
} }
h1, h1,
@ -216,6 +216,8 @@ h6 {
font-family: sans-serif; font-family: sans-serif;
margin-top: 20px; margin-top: 20px;
margin-bottom: 5px; margin-bottom: 5px;
text-decoration: underline;
text-decoration-color: var(--boatYellow2);
} }
h1 { h1 {
@ -242,6 +244,12 @@ h6 {
font-size: 1.1rem; font-size: 1.1rem;
} }
heading-level {
color: var(--autumnYellow);
font-weight: normal;
font-size: .9em;
}
a:link { a:link {
color: var(--crystalBlue); color: var(--crystalBlue);
} }

View File

@ -48,6 +48,11 @@ impl HeadingAdapter for HeaderLinkAdapter {
output, output,
"<a id=\"{}\" class=\"anchor\" href=\"#{}\">", "<a id=\"{}\" class=\"anchor\" href=\"#{}\">",
id, id id, id
)?;
write!(
output,
"<heading-level>{} </heading-level>",
"#".repeat(heading.level as usize)
) )
} }
@ -85,7 +90,10 @@ impl MDComrakSettings<'_> {
R: std::io::BufRead + std::io::Seek, R: std::io::BufRead + std::io::Seek,
{ {
let mut syntaxes = SyntaxSet::load_defaults_newlines().into_builder(); let mut syntaxes = SyntaxSet::load_defaults_newlines().into_builder();
syntaxes.add_from_folder(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/syntaxes/"), true)?; syntaxes.add_from_folder(
concat!(env!("CARGO_MANIFEST_DIR"), "/assets/syntaxes/"),
true,
)?;
let theme = ThemeSet::load_from_reader(theme_cursor)?; let theme = ThemeSet::load_from_reader(theme_cursor)?;
let mut theme_set = ThemeSet::new(); let mut theme_set = ThemeSet::new();
theme_set.themes.insert(String::from(theme_name), theme); theme_set.themes.insert(String::from(theme_name), theme);