Fix bug with heading link & styles.

master
Araozu 2023-09-14 22:02:38 -05:00
parent ce34180296
commit 2063037bb2
3 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,7 @@ pub struct Config {
pub extension: String,
pub headings: Headings,
pub links_classes: String,
pub file_tree_title_classes: String,
}
pub struct Headings {
@ -141,6 +142,11 @@ pub fn parse(yaml_str: &String) -> Result<Config, String> {
_ => String::from(""),
};
let file_tree_title_classes = match config_yaml.get(ystr!("file_tree_title_classes")) {
Some(Yaml::String(input)) => input.clone(),
_ => String::from(""),
};
Ok(Config {
input: input_folder.clone(),
@ -149,6 +155,7 @@ pub fn parse(yaml_str: &String) -> Result<Config, String> {
extension: file_extension,
headings: headings_yaml,
links_classes: link_classes,
file_tree_title_classes,
})
}

View File

@ -28,7 +28,7 @@ impl Printable for Heading {
format!(
"<h{} id=\"{}\" class=\"heading-linked {}\"><a href=\"#{}\">{}</a></h{}>",
self.depth, extra_classes, html_fragment_text, html_fragment_text, text, self.depth
self.depth, html_fragment_text, extra_classes, html_fragment_text, text, self.depth
)
} else {
format!("<h{}>{}</h{}>", self.depth, text, self.depth)

View File

@ -122,9 +122,10 @@ pub fn generate_pages_html(file_tree: &Node, current_path: &Path, config: &Confi
} else {
format!(
"<li class=\"my-1\">
<div class=\"uppercase opacity-80 mt-6 font-semibold\">{}</div>
<div class=\"opacity-80 mt-6 {}\">{}</div>
<ul>{}</ul>
</li>",
&config.file_tree_title_classes,
folder.name,
sub_nodes_html.join("")
)