Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ hex = "0.4.3"
html5ever = "0.39.0"
indexmap = "2.14.0"
ignore = "0.4.25"
mdbook-core = { path = "crates/mdbook-core", version = "0.5.2" }
mdbook-core = { path = "crates/mdbook-core", version = "0.6.0" }
mdbook-driver = { path = "crates/mdbook-driver", version = "0.5.2" }
mdbook-html = { path = "crates/mdbook-html", version = "0.5.2" }
mdbook-markdown = { path = "crates/mdbook-markdown", version = "0.5.2" }
Expand Down
2 changes: 1 addition & 1 deletion crates/mdbook-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mdbook-core"
version = "0.5.2"
version = "0.6.0"
description = "The base support library for mdbook, intended for internal use only"
edition.workspace = true
license.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions crates/mdbook-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ pub struct HtmlConfig {
pub code: Code,
/// Print settings.
pub print: Print,
/// Don't render section labels.
pub no_section_label: bool,
/// Render numeric section labels in the table of contents.
pub section_label_toc: bool,
/// Search settings. If `None`, the default will be used.
pub search: Option<Search>,
/// Git repository url. If `None`, the git button will not be shown.
Expand Down Expand Up @@ -536,7 +536,7 @@ impl Default for HtmlConfig {
playground: Playground::default(),
code: Code::default(),
print: Print::default(),
no_section_label: false,
section_label_toc: true,
search: None,
git_repository_url: None,
git_repository_icon: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/mdbook-html/src/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl HtmlHandlebars {
handlebars.register_helper(
"toc",
Box::new(helpers::toc::RenderToc {
no_section_label: html_config.no_section_label,
section_label_toc: html_config.section_label_toc,
}),
);
handlebars.register_helper("fa", Box::new(helpers::fontawesome::fa_helper));
Expand Down
4 changes: 2 additions & 2 deletions crates/mdbook-html/src/html_handlebars/helpers/toc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{cmp::Ordering, collections::BTreeMap};
// Handlebars helper to construct TOC
#[derive(Clone, Copy)]
pub(crate) struct RenderToc {
pub no_section_label: bool,
pub section_label_toc: bool,
}

impl HelperDef for RenderToc {
Expand Down Expand Up @@ -134,7 +134,7 @@ impl HelperDef for RenderToc {
}
};

if !self.no_section_label {
if self.section_label_toc {
// Section does not necessarily exist
if let Some(section) = item.get("section") {
out.write("<strong aria-hidden=\"true\">")?;
Expand Down
8 changes: 4 additions & 4 deletions guide/src/format/configuration/renderers.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ admonitions = true
mathjax-support = false
additional-css = ["custom.css", "custom2.css"]
additional-js = ["custom.js"]
no-section-label = false
section-label-toc = true
git-repository-url = "https://github.com/rust-lang/mdBook"
git-repository-icon = "fab-github"
edit-url-template = "https://github.com/rust-lang/mdBook/edit/master/guide/{path}"
Expand Down Expand Up @@ -138,9 +138,9 @@ The following configuration options are available:
- **additional-js:** If you need to add some behaviour to your book without
removing the current behaviour, you can specify a set of JavaScript files that
will be loaded alongside the default one.
- **no-section-label:** mdBook by defaults adds numeric section labels in the table of
contents column. For example, "1.", "2.1". Set this option to true to disable
those labels. Defaults to `false`.
- **section-label-toc:** mdBook by default adds numeric section labels in the table
of contents column. For example, "1.", "2.1". Set this option to `false` to
disable those labels. Defaults to `true`.
- **git-repository-url:** A url to the git repository for the book. If provided
an icon link will be output in the menu bar of the book.
- **git-repository-icon:** The Font Awesome icon class to use for the git repository link. Defaults to `fab-github` which looks like <i class="fab fa-github"></i>. If you are not using GitHub, another option to consider is `fas-code-fork` which looks like <i class="fas fa-code-fork"></i>. The start of the string should be `fa-` for regular icons, `fas-` for solid icons, or `fab-` for brand icons. See the [free icon set](https://fontawesome.com/v6/search) for the available icons.
Expand Down
Loading