mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-22 05:48:31 +08:00
Use Kino as example instead of Jason (#538)
This commit is contained in:
parent
6bf0a6ba7c
commit
bbd7cc79f5
1 changed files with 11 additions and 4 deletions
|
@ -73,14 +73,21 @@ instance, otherwise the command below will fail.
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
Mix.install([
|
Mix.install([
|
||||||
{:jason, "~> 1.2"}
|
{:kino, "~> 0.3.0"}
|
||||||
])
|
])
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[Kino](https://github.com/elixir-nx/kino) is a library that
|
||||||
|
allows you to control parts of Livebook directly from the Elixir
|
||||||
|
code. Let's use it to print a data table:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
%{elixir: "is awesome"}
|
data = [
|
||||||
|> Jason.encode!()
|
%{id: 1, name: "Elixir", website: "https://elixir-lang.org"},
|
||||||
|> IO.puts()
|
%{id: 2, name: "Erlang", website: "https://www.erlang.org"}
|
||||||
|
]
|
||||||
|
|
||||||
|
Kino.DataTable.new(data)
|
||||||
```
|
```
|
||||||
|
|
||||||
It is a good idea to specify versions of the installed packages,
|
It is a good idea to specify versions of the installed packages,
|
||||||
|
|
Loading…
Reference in a new issue