Add minimal docs
This commit is contained in:
parent
a8a2e649df
commit
ddbe8125cd
|
@ -15,8 +15,12 @@ pub struct Toc;
|
||||||
|
|
||||||
static DEFAULT_MARKER: &str = "<!-- toc -->\n";
|
static DEFAULT_MARKER: &str = "<!-- toc -->\n";
|
||||||
|
|
||||||
|
/// Configuration for Table of Contents generation
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
/// Marker to use, defaults to `<!-- toc -->\n`
|
||||||
pub marker: String,
|
pub marker: String,
|
||||||
|
/// The maximum level of headers to include in the table of contents.
|
||||||
|
/// Defaults to `4`.
|
||||||
pub max_level: u32,
|
pub max_level: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +245,7 @@ fn add_toc(content: &str, cfg: &Config) -> Result<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Toc {
|
impl Toc {
|
||||||
|
/// Add a table of contents to the given chapter.
|
||||||
pub fn add_toc(chapter: &Chapter, cfg: &Config) -> Result<String> {
|
pub fn add_toc(chapter: &Chapter, cfg: &Config) -> Result<String> {
|
||||||
add_toc(&chapter.content, cfg)
|
add_toc(&chapter.content, cfg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue