Update Kino introductory notebook with Markdown output (#406)

This commit is contained in:
Jonatan Kłosko 2021-06-26 18:32:03 +02:00 committed by GitHub
parent ea413dd5b9
commit a49111afe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@ and interact with it.
```elixir ```elixir
Mix.install([ Mix.install([
{:kino, "~> 0.2.0"}, {:kino, "~> 0.2.1"},
{:vega_lite, "~> 0.1.0"} {:vega_lite, "~> 0.1.0"}
]) ])
``` ```
@ -149,6 +149,33 @@ Kino.DataTable.new(
We can sort by the number of reductions to identify the We can sort by the number of reductions to identify the
most busy processes! most busy processes!
## Kino.Markdown
Sometimes you may want to render arbitrary content as rich-text,
that's when `Kino.Markdown.new/1` comes into play:
```elixir
"""
# Example
A regular Markdown file.
## Code
```elixir
"Elixir" |> String.graphemes() |> Enum.frequencies()
```
## Table
| ID | Name | Website |
| -- | ------ | ----------------------- |
| 1 | Elixir | https://elixir-lang.org |
| 2 | Erlang | https://www.erlang.org |
"""
|> Kino.Markdown.new()
```
## Kino.render/1 ## Kino.render/1
As we saw, Livebook automatically recognises widgets returned As we saw, Livebook automatically recognises widgets returned