diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index 47eda596..7a5d8a28 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -108,32 +108,32 @@ impl HelperDef for RenderToc { } // Link - let path_exists = if let Some(path) = item.get("path") { - if !path.is_empty() { - out.write("")?; - true - } else { - false + if path == ¤t_path { + out.write(" class=\"active\"")?; } + + out.write(">")?; + true } else { + out.write("
")?; false }; @@ -165,6 +165,8 @@ impl HelperDef for RenderToc { if path_exists { out.write("")?; + } else { + out.write("
")?; } // Render expand/collapse toggle