Livebook (Livebook v0.14.5)
This module provides a public Elixir API for integrating with Livebook.
Configuration
See config_runtime/0
for bootstrapping the default runtime
configuration. There are several public configuration entries that
you can customize.
Custom plugs
You can list a number of plugs to call directly before the Livebook router
config :livebook, :plugs, [{CustomPlug, []}]
Embedded runtime dependencies
In case you use the Embedded runtime and support installing
dependencies with Mix.install/2
, you can make those discoverable
in the package search, by configuring a loader function:
config :livebook, Livebook.Runtime.Embedded,
load_packages: {Loader, :packages, []}
The function should return a list of entries like this:
[
%{
dependency: %{dep: {:kino, "~> 0.6.1"}, config: []},
description: "Interactive widgets for Livebook",
name: "kino",
url: "https://hex.pm/packages/kino",
version: "0.6.1"
}
]
Custom learn notebooks
Note that this is compile time configuration.
A list of additional notebooks to include in the Learn section.
Note that the notebooks are loaded and embedded in a compiled module, so the paths are accessed at compile time only.
config :livebook, :learn_notebooks, [
%{
# Required notebook path
path: "/path/to/notebook.livemd",
# Optional notebook identifier for URLs, as in /learn/notebooks/{slug}
# By default the slug is inferred from file name, so there is no need to set it
slug: "my-notebook"
# Optional list of images
image_paths: [
# This image can be sourced as images/myimage.jpg in the notebook
"/path/to/myimage.jpg"
],
# Optional details for the notebook card. If omitted, the notebook
# is hidden in the UI, but still accessible under /learn/notebooks/{slug}
details: %{
cover_path: "/path/to/logo.png",
description: "My custom notebook that showcases some amazing stuff."
}
},
%{
path: "/path/to/other_notebook.livemd"
}
]
Summary
Functions
Executes Livebook's config/runtime.exs
.
Parses the given Live Markdown document and converts it to Elixir source code.
Functions
config_runtime()
Executes Livebook's config/runtime.exs
.
If you use Livebook as a dependency, you can add the following
to your config/runtime.exs
to trigger Livebook's config/runtime.exs
configuration:
Livebook.config_runtime()
live_markdown_to_elixir(markdown)
Parses the given Live Markdown document and converts it to Elixir source code.
Limitations
Note that the resulting script may not compile in some cases, for example if you define a macro in one cell and import it in another cell, it works fine in Livebook, because each cell is compiled separately. However, when running the script it gets compiled as a whole and consequently doing so doesn't work.
Additionally, branching sections are commented out.