Generate a table of contents as a tree of {node: {...}, children: []} objects. We want a pretty complex hierarchy in our table of contents: buildTableOfContents: (files) ->
Given an array of markdowned segments, convert their list of headers into a hierarchical outline (table of contents!)
Generate a table of contents as a tree of {..., children: []} objects. We take a list of file info objects, and a map of outlines to fileInfo.targetPath. We want a pretty complex hierarchy in our table of contents:
Annotate the file data with a title to represent it. If possible, we use the initial header in the file,
Otherwise we just fall back to the file's target path...
Kind of privacy protection and to reduce the size …
Take a flat, though ordered, list of nodes and convert them into a tree.
Nodes are expected to have a depth property. Each node is annotated with an array of
children if it does not exist. Children are appended, otherwise.
Unwind the stack until we get to the first node that is at a lower depth than us. We are considered to be its child
Top level nodes are directly returned in the result list.
It helps visually to separate headers that are not attached to other comments into their own segment.
Style Helpers
A collection of helpful functions to support styles and their behavior.