pub fn make_table_of_contents(headings: Vec<Heading>) -> Vec<Heading> {
    let mut toc = vec![];
    for heading in headings {
        // First heading or we try to insert the current heading in a previous one
        if toc.is_empty() || !insert_into_parent(toc.iter_mut().last(), &heading) {
            toc.push(heading);
        }
    }

    toc
}
/// Converts the flat temp headings into a nested set of headings
/// representing the hierarchy
Converts the flat temp headings into a nested set of headings
representing the hierarchy
Converts the flat temp headings into a nested set of headings representing the hierarchy
pub fn make_table_of_contents(headings: Vec<Heading>) -> Vec<Heading> {
    let mut toc = vec![];
    for heading in headings {
        // First heading or we try to insert the current heading in a previous one
        if toc.is_empty() || !insert_into_parent(toc.iter_mut().last(), &heading) {
            toc.push(heading);
        }
    }
    toc
}
pub fn make_table_of_contents ( headings : Vec < Heading > ) -> Vec < Heading > { let mut toc = vec ! [ ] ; for heading in headings { // First heading or we try to insert the current heading in a previous one if toc . is_empty ( ) || ! insert_into_parent ( toc . iter_mut ( ) . last ( ) , & heading ) { toc . push ( heading ) ; } } toc }
Converts the flat temp headings into a nested set of headings
representing the hierarchy
Converts the flat temp headings into a nested set of headings representing the hierarchy
headings
Vec<Heading>
headings
Vec<Heading>