Livebook (Anoma v0.29.0)
I generate out extra information for Livebook
My main purpose is to generate out the TOC for each livebook document we have.
to do this please run toc_toplevel/0
To set a certain order please set sort_order/0
to have the updated
order
API
Summary
Functions
I replace the header with the given TOC
I provide an example of what a TOC looks like
Generates out a TOC, given a series of nested documents
I get out all live view docs
Gets all livemd documents in a sorted list given a path.
I generate out the TOC for all liveview docs
Types
sort()
Functions
add_heading_num(documents)
@spec add_heading_num([String.t()]) :: [ {String.t(), non_neg_integer(), non_neg_integer()} ]
change_header(markdown, header_level, start_header, new_text)
I replace the header with the given TOC
Example
markdown_text = "## Intro ...
Index
text here ## Conclusion All good"
Livebook.change_header(markdown_text, "##", "Index", "New Content") |> IO.puts
## Intro ...
## Index
New Content
## Conclusion
All good
:ok
count_depth(path)
@spec count_depth(Path.t()) :: non_neg_integer()
dir_from_path(dir)
example_toc()
@spec example_toc() :: :ok
I provide an example of what a TOC looks like
generate_heading(path, depth, numbering, from_depth \\ 1)
@spec generate_heading( String.t(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: String.t()
generate_toc(documents, from_depth \\ 0)
@spec generate_toc([Path.t()], non_neg_integer()) :: String.t()
Generates out a TOC, given a series of nested documents
We take a path, and a place where we should be calculating the TOC from.
Example
get_all_livemd_documents()
@spec get_all_livemd_documents() :: [Path.t()]
I get out all live view docs
get_livemd_documents(dir)
Gets all livemd documents in a sorted list given a path.
inject_toc(toc, path)
sort_order()
@spec sort_order() :: sort()
toc_toplevel()
@spec toc_toplevel() :: :ok
I generate out the TOC for all liveview docs